diff --git a/Makefile b/Makefile
index 2708df60..8db7ae3b 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/certora/applyHarness.patch b/certora/applyHarness.patch
index 62c1705e..06b4e1ca 100644
--- a/certora/applyHarness.patch
+++ b/certora/applyHarness.patch
@@ -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),
diff --git a/certora/conf/NEW-pool-no-summarizations.conf b/certora/conf/NEW-pool-no-summarizations.conf
index 080f07f5..bcf611fc 100644
--- a/certora/conf/NEW-pool-no-summarizations.conf
+++ b/certora/conf/NEW-pool-no-summarizations.conf
@@ -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",
@@ -20,7 +19,6 @@
],
"struct_link": [
"PoolHarness:aTokenAddress=ATokenHarness",
- "PoolHarness:stableDebtTokenAddress=StableDebtTokenHarness",
"PoolHarness:variableDebtTokenAddress=VariableDebtTokenInstance",
"PoolHarness:interestRateStrategyAddress=DefaultReserveInterestRateStrategyV2",
],
diff --git a/certora/conf/NEW-pool-simple-properties.conf b/certora/conf/NEW-pool-simple-properties.conf
index 6c81b8ad..da979e32 100644
--- a/certora/conf/NEW-pool-simple-properties.conf
+++ b/certora/conf/NEW-pool-simple-properties.conf
@@ -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",
@@ -17,7 +16,6 @@
],
"struct_link": [
"PoolHarness:aTokenAddress=ATokenHarness",
- "PoolHarness:stableDebtTokenAddress=StableDebtTokenHarness",
"PoolHarness:variableDebtTokenAddress=VariableDebtTokenInstance",
"PoolHarness:interestRateStrategyAddress=DefaultReserveInterestRateStrategyV2",
],
diff --git a/certora/conf/StableDebtToken.conf b/certora/conf/StableDebtToken.conf
deleted file mode 100644
index 0d94747f..00000000
--- a/certora/conf/StableDebtToken.conf
+++ /dev/null
@@ -1,19 +0,0 @@
-//===================================================================================
-// IMPORTANT:
-// This file can be DELETED, since Stable coins are removed.
-// In the implementation all the function either revert or return 0
-// ===================================================================================
-
-{
- "cache": "StableToken",
- "files": [
- "certora/harness/StableDebtTokenHarness.sol:StableDebtTokenHarness"
- ],
- "loop_iter": "4",
- "msg": "stableTokenCLI",
- "optimistic_loop": true,
- "process": "emv",
- "solc": "solc8.19",
-// "build_cache": true,
- "verify": "StableDebtTokenHarness:certora/specs/StableDebtToken.spec"
-}
diff --git a/certora/harness/ATokenHarness.sol b/certora/harness/ATokenHarness.sol
index cc23245c..bcb5d32a 100644
--- a/certora/harness/ATokenHarness.sol
+++ b/certora/harness/ATokenHarness.sol
@@ -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.
diff --git a/certora/harness/PoolHarness.sol b/certora/harness/PoolHarness.sol
index 70deadf9..96ad8637 100644
--- a/certora/harness/PoolHarness.sol
+++ b/certora/harness/PoolHarness.sol
@@ -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;
@@ -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) {
@@ -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;
}
diff --git a/certora/harness/ReserveConfigurationHarness.sol b/certora/harness/ReserveConfigurationHarness.sol
index d4edade2..b74bd81a 100644
--- a/certora/harness/ReserveConfigurationHarness.sol
+++ b/certora/harness/ReserveConfigurationHarness.sol
@@ -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;
@@ -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;
@@ -301,7 +290,7 @@ 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) {
@@ -309,8 +298,6 @@ contract ReserveConfigurationHarness {
} else if (id == 2) {
setBorrowingEnabled(val);
} else if (id == 3) {
- setStableRateBorrowingEnabled(val);
- } else if (id == 4) {
setPaused(val);
} else {
setBorrowableInIsolation(val);
@@ -319,7 +306,7 @@ 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) {
@@ -327,8 +314,6 @@ contract ReserveConfigurationHarness {
} else if (id == 2) {
return getBorrowingEnabled();
} else if (id == 3) {
- return getStableRateBorrowingEnabled();
- } else if (id == 4) {
return getPaused();
} else {
return getBorrowableInIsolation();
diff --git a/certora/harness/SimpleERC20.sol b/certora/harness/SimpleERC20.sol
index 81d12bad..68733603 100644
--- a/certora/harness/SimpleERC20.sol
+++ b/certora/harness/SimpleERC20.sol
@@ -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.
diff --git a/certora/harness/StableDebtTokenHarness.sol b/certora/harness/StableDebtTokenHarness.sol
deleted file mode 100644
index 99ce3355..00000000
--- a/certora/harness/StableDebtTokenHarness.sol
+++ /dev/null
@@ -1,17 +0,0 @@
-pragma solidity ^0.8.19;
-
-import {StableDebtTokenInstance} from '../munged/core/instances/StableDebtTokenInstance.sol';
-import {IncentivizedERC20} from '../munged/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol';
-import {IPool} from '../munged/core/contracts/interfaces/IPool.sol';
-
-contract StableDebtTokenHarness is StableDebtTokenInstance {
- constructor(IPool pool) public StableDebtTokenInstance(pool) {}
-
- function additionalData(address user) public view returns (uint128) {
- return _userState[user].additionalData;
- }
-
- function debtTotalSupply() public view returns (uint256) {
- return super.totalSupply();
- }
-}
diff --git a/certora/harness/SymbolicPriceOracle.sol b/certora/harness/SymbolicPriceOracle.sol
index b90e21dd..d268e5d0 100644
--- a/certora/harness/SymbolicPriceOracle.sol
+++ b/certora/harness/SymbolicPriceOracle.sol
@@ -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;
diff --git a/certora/harness/UserConfigurationHarness.sol b/certora/harness/UserConfigurationHarness.sol
index 4c82a29b..3f1637ea 100644
--- a/certora/harness/UserConfigurationHarness.sol
+++ b/certora/harness/UserConfigurationHarness.sol
@@ -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.
diff --git a/certora/harness/VariableDebtTokenHarness.sol b/certora/harness/VariableDebtTokenHarness.sol
index 33da454f..ca2696a6 100644
--- a/certora/harness/VariableDebtTokenHarness.sol
+++ b/certora/harness/VariableDebtTokenHarness.sol
@@ -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;
diff --git a/certora/specs/NEW-pool-base.spec b/certora/specs/NEW-pool-base.spec
index 9a9e86ba..68e386d8 100644
--- a/certora/specs/NEW-pool-base.spec
+++ b/certora/specs/NEW-pool-base.spec
@@ -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);
diff --git a/certora/specs/NEW-pool-no-summarizations.spec b/certora/specs/NEW-pool-no-summarizations.spec
index aad2c00c..826b0fb7 100644
--- a/certora/specs/NEW-pool-no-summarizations.spec
+++ b/certora/specs/NEW-pool-no-summarizations.spec
@@ -11,7 +11,6 @@ methods {
// function _.executeOperation(address[] a, uint256[]b, uint256[]c, address d, bytes e) external => DISPATCHER(true);
- function _.getAverageStableRate() external => DISPATCHER(true);
function _.isPoolAdmin(address a) external => DISPATCHER(true);
function _.getConfiguration(address a) external => DISPATCHER(true);
@@ -37,11 +36,10 @@ function ghostUpdate() returns bool {
}
-function calculateInterestRatesMock(DataTypes.CalculateInterestRatesParams params) returns (uint256, uint256, uint256) {
+function calculateInterestRatesMock(DataTypes.CalculateInterestRatesParams params) returns (uint256, uint256) {
uint256 liquidityRate = 1;
- uint256 stableBorrowRate = 1;
uint256 variableBorrowRate = 1;
- return (liquidityRate, stableBorrowRate, variableBorrowRate);
+ return (liquidityRate, variableBorrowRate);
}
diff --git a/certora/specs/ReserveConfiguration.spec b/certora/specs/ReserveConfiguration.spec
index cb13162c..b927763b 100644
--- a/certora/specs/ReserveConfiguration.spec
+++ b/certora/specs/ReserveConfiguration.spec
@@ -19,8 +19,6 @@ methods {
function getSiloedBorrowing() external returns (bool) envfree;
function setBorrowingEnabled(bool) external envfree;
function getBorrowingEnabled() external returns (bool) envfree;
- function setStableRateBorrowingEnabled(bool) external envfree;
- function getStableRateBorrowingEnabled() external returns (bool) envfree;
function setReserveFactor(uint256) external envfree;
function getReserveFactor() external returns (uint256) envfree;
function setBorrowCap(uint256) external envfree;
@@ -104,12 +102,6 @@ rule setBorrowingEnabledIntegrity(bool enabled) {
assert getBorrowingEnabled() == enabled;
}
-// checks the integrity of set StableRateBorrowingEnabled function and correct retrieval of the corresponding getter.
-rule setStableRateBorrowingEnabledIntegrity(bool enabled) {
- setStableRateBorrowingEnabled(enabled);
- assert getStableRateBorrowingEnabled() == enabled;
-}
-
// checks the integrity of set ReserveFactor function and correct retrieval of the corresponding getter.
rule setReserveFactorIntegrity(uint256 reserveFactor) {
setReserveFactor(reserveFactor);
diff --git a/certora/specs/StableDebtToken.spec b/certora/specs/StableDebtToken.spec
deleted file mode 100644
index 00937585..00000000
--- a/certora/specs/StableDebtToken.spec
+++ /dev/null
@@ -1,327 +0,0 @@
-/*===================================================================================
- IMPORTANT:
- This file can be DELETED, since Stable coins are removed.
- In the implementation all the function either revert or return 0
- ===================================================================================*/
-
-methods {
- function _.calculateCompoundedInterest(uint256 r, uint40 t0, uint256 t1) internal =>
- calculateCompoundedInterestSummary(r, t0, t1) expect uint256 ALL;
- function additionalData(address) external returns uint128 envfree;
- function getAverageStableRate() external returns uint256 envfree;
- function _.handleAction(address, uint256, uint256) external => NONDET;
-
- function _.rayMul(uint256 x, uint256 y) internal => rayMulSummariztion(x, y) expect uint256 ALL;
- function _.rayDiv(uint256 x, uint256 y) internal => rayDivSummariztion(x, y) expect uint256 ALL;
-}
-
-function PLUS256(uint256 x, uint256 y) returns uint256 {
- return (assert_uint256( (x+y) % 2^256) );
-}
-
-definition RAY() returns uint = 1000000000000000000000000000;
-
-definition disAllowedFunctions(method f) returns bool =
- f.selector == sig:transfer(address, uint256).selector ||
- f.selector == sig:allowance(address, address).selector ||
- f.selector == sig:approve(address, uint256).selector ||
- f.selector == sig:transferFrom(address, address, uint256).selector ||
- f.selector == sig:increaseAllowance(address, uint256).selector ||
- f.selector == sig:decreaseAllowance(address, uint256).selector;
-
-ghost mapping(uint256 => mapping(uint256 => uint256)) calculateCompoundedInterestSummaryValues;
-function calculateCompoundedInterestSummary(uint256 rate, uint40 t0, uint256 t1) returns uint256 {
- uint256 deltaT = assert_uint256( (t1-t0) % 2^256 );
-
- if (deltaT == 0) {
- return RAY();
- }
- if (rate == RAY()) {
- return RAY();
- }
- if (rate >= RAY()) {
- require calculateCompoundedInterestSummaryValues[rate][deltaT] >= rate;
- }
- else {
- require calculateCompoundedInterestSummaryValues[rate][deltaT] < rate;
- }
- return calculateCompoundedInterestSummaryValues[rate][deltaT];
-}
-
-ghost mapping(uint256 => mapping(uint256 => uint256)) rayMulSummariztionValues;
-function rayMulSummariztion(uint256 x, uint256 y) returns uint256 {
- if ((x == 0) || (y == 0)) {
- return 0;
- }
- if (x == RAY()) {
- return y;
- }
- if (y == RAY()) {
- return x;
- }
-
- if (y > x) {
- if (y > RAY()) {
- require rayMulSummariztionValues[y][x] >= x;
- }
- if (x > RAY()) {
- require rayMulSummariztionValues[y][x] >= y;
- }
- return rayMulSummariztionValues[y][x];
- }
- else {
- if (x > RAY()) {
- require rayMulSummariztionValues[x][y] >= y;
- }
- if (y > RAY()) {
- require rayMulSummariztionValues[x][y] >= x;
- }
- return rayMulSummariztionValues[x][y];
- }
-}
-
-ghost mapping(uint256 => mapping(uint256 => uint256)) rayDivSummariztionValues;
-function rayDivSummariztion(uint256 x, uint256 y) returns uint256 {
- if (x == 0) {
- return 0;
- }
- if (y == RAY()) {
- return x;
- }
- if (y == x) {
- return RAY();
- }
- require y > RAY() => rayDivSummariztionValues[x][y] <= x;
- return rayDivSummariztionValues[x][y];
-}
-
-
-ghost symbolicCompundInterest(uint256, uint40) returns uint256 {
- axiom forall uint256 x. forall uint40 t. symbolicCompundInterest(x, t) >= 1;
-}
-
-
-ghost sumAllBalance() returns mathint {
- init_state axiom sumAllBalance() == 0;
-}
-hook Sstore _userState[KEY address a].balance uint128 balance (uint128 old_balance) {
- havoc sumAllBalance assuming sumAllBalance@new() == sumAllBalance@old() + balance - old_balance;
-}
-hook Sload uint128 balance _userState[KEY address a].balance {
- require sumAllBalance() >= to_mathint(balance);
-}
-
-invariant principalLessThanBalance(env e, address user)
- principalBalanceOf(e, user) <= balanceOf(e, user)
- filtered { f -> !disAllowedFunctions(f) }
-
-/**
- Burning user u amount of x tokens, decreases his balanceOf the user by x.
- (balance is decreased by x and not scaled x because of the summarization to one ray)
-*/
-rule integrityBurn(address a, uint256 x) {
- env e;
- require getIncentivesController(e) == 0;
- uint256 index;
- uint256 balancebefore = balanceOf(e, a);
- burn(e,a,x);
-
- uint256 balanceAfter = balanceOf(e, a);
- assert to_mathint(balanceAfter) == balancebefore - x;
-}
-
-/**
- Mint to user u amount of x tokens, increases his balanceOf the user by x.
- (balance is increased by x and not scaled x because of the summarization to one ray)
-*/
-rule integrityMint(address a, uint256 x) {
- env e;
- address delegatedUser;
- require getIncentivesController(e) == 0;
- uint256 index;
- uint256 balancebefore = balanceOf(e,a);
- mint(e, delegatedUser, a, x, index);
-
- uint256 balanceAfter = balanceOf(e,a);
- assert to_mathint(balanceAfter) == balancebefore+x;
-}
-
-// lastUpdated timestamp must be in the past.
-rule integrityTimeStamp(address user, method f)
- filtered { f -> !f.isView && !disAllowedFunctions(f) }
-{
- env e;
- require assert_uint256(getUserLastUpdated(e, user)) <= e.block.timestamp;
- calldataarg arg;
- f(e,arg);
- assert assert_uint256(getUserLastUpdated(e, user)) <= e.block.timestamp;
-}
-
-rule integrityDelegationWithSig(address delegator, address delegatee, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) {
- env e;
- uint256 oldNonce = nonces(e, delegator);
- delegationWithSig(e, delegator, delegatee, value, deadline, v, r, s);
- assert to_mathint(nonces(e, delegator)) == oldNonce + 1 &&
- borrowAllowance(e, delegator, delegatee) == value;
-}
-
-/*
- Burn is additive, can performed either all at once or gradually
- burn(from,to,x,index); burn(from,to,y,index) ~ burn(from,to,x+y,index) at the same initial state
-*/
-rule additiveBurn(address a, uint256 x, uint256 y) {
- env e;
- storage initialStorage = lastStorage;
- burn(e, a, x);
- burn(e, a, y);
- uint256 balanceScenario1 = balanceOf(e, a);
- uint256 t = PLUS256(x,y);
- burn(e, a, t) at initialStorage;
-
- uint256 balanceScenario2 = balanceOf(e, a);
- assert balanceScenario1 == balanceScenario2, "burn is not additive";
-}
-
-// minting and then buring Variable Debt Token should have no effect on the users balance
-rule inverseMintBurn(address a, address delegatedUser, uint256 amount, uint256 rate) {
- env e;
- uint256 balancebefore = balanceOf(e, a);
- mint(e, delegatedUser, a, amount, rate);
- burn(e, a, amount);
- uint256 balanceAfter = balanceOf(e, a);
- assert balancebefore == balanceAfter, "burn is not the inverse of mint";
-}
-
-// Only the pool with burn or mint operation can change the total supply. (assuming the getReserveNormalizedVariableDebt is not changed)
-rule whoChangeTotalSupply(method f)
- filtered { f -> !f.isView && !disAllowedFunctions(f) }
-{
- env e;
- uint256 oldTotalSupply = totalSupply(e);
- calldataarg args;
- f(e, args);
- uint256 newTotalSupply = totalSupply(e);
- assert oldTotalSupply != newTotalSupply =>
- (e.msg.sender == POOL(e) &&
- (f.selector == sig:burn(address, uint256).selector ||
- f.selector == sig:mint(address, address, uint256, uint256).selector));
-}
-
-// only delegationWithSig operation can change the nonce.
-rule nonceChangePermits(method f)
- filtered { f -> !f.isView && !disAllowedFunctions(f) }
-{
- env e;
- address user;
- uint256 oldNonce = nonces(e, user);
- calldataarg args;
- f(e, args);
- uint256 newNonce = nonces(e, user);
- assert oldNonce != newNonce => f.selector == sig:delegationWithSig(address, address, uint256, uint256, uint8, bytes32, bytes32).selector;
-}
-
-/*
- Mint is additive, can performed either all at once or gradually
- mint(u,x,index); mint(u,y,index) ~ mint(u,x+y,index) at the same initial state
-*/
-rule additiveMint(address a, uint256 x, uint256 y) {
- env e;
- address delegatedUser;
- require getIncentivesController(e) == 0;
- require getUserStableRate(e, a) == 0;
- uint256 index;
- storage initialStorage = lastStorage;
- mint(e, delegatedUser, a, x, index);
- mint(e, delegatedUser, a, y, index);
- uint256 balanceScenario1 = balanceOf(e, a);
-
- uint256 t = PLUS256(x,y);
- mint(e, delegatedUser, a, t ,index) at initialStorage;
-
- uint256 balanceScenario2 = balanceOf(e, a);
- assert balanceScenario1 == balanceScenario2, "mint is not additive";
-}
-
-/*
- Each operation of Stable Debt Token can change at most one user's balance.
-*/
-rule balanceOfChange(address a, address b, method f)
- filtered { f -> !f.isView && !disAllowedFunctions(f) }
-{
- env e;
- require a != b;
- uint256 balanceABefore = balanceOf(e, a);
- uint256 balanceBBefore = balanceOf(e, b);
-
- calldataarg arg;
- f(e, arg);
-
- uint256 balanceAAfter = balanceOf(e, a);
- uint256 balanceBAfter = balanceOf(e, b);
-
- assert (balanceABefore == balanceAAfter || balanceBBefore == balanceBAfter);
-}
-
-// Buring zero amount of tokens should have no effect.
-rule burnZeroDoesntChangeBalance(address u) {
- env e;
- uint256 balanceBefore = balanceOf(e, u);
- burn(e, u, 0);
- uint256 balanceAfter = balanceOf(e, u);
- assert balanceBefore == balanceAfter;
-}
-
-/*
- Burning one user atokens should have no effect on other users that are not involved in the action.
-*/
-rule burnNoChangeToOther(address user, uint256 amount, address other) {
- require other != user;
- env e;
- uint256 otherDataBefore = additionalData(other);
- uint256 otherBalanceBefore = balanceOf(e, other);
-
- burn(e, user, amount);
-
- uint256 otherDataAfter = additionalData(other);
- uint256 otherBalanceAfter = balanceOf(e, other);
-
- assert otherDataBefore == otherDataAfter &&
- otherBalanceBefore == otherBalanceAfter;
-}
-
-/*
- Minting ATokens for a user should have no effect on other users that are not involved in the action.
-*/
-rule mintNoChangeToOther(address user, address onBehalfOf, uint256 amount, uint256 rate, address other) {
- require other != user && other != onBehalfOf;
-
- env e;
- uint128 userDataBefore = additionalData(user);
- uint128 otherDataBefore = additionalData(other);
- uint256 userBalanceBefore = balanceOf(e, user);
- uint256 otherBalanceBefore = balanceOf(e, other);
-
- mint(e, user, onBehalfOf, amount, rate);
-
- uint128 userDataAfter = additionalData(user);
- uint128 otherDataAfter = additionalData(other);
- uint256 userBalanceAfter = balanceOf(e, user);
- uint256 otherBalanceAfter = balanceOf(e, other);
-
- if (user != onBehalfOf) {
- assert userBalanceBefore == userBalanceAfter && userDataBefore == userDataAfter;
- }
-
- assert otherBalanceBefore == otherBalanceAfter && otherDataBefore == otherDataAfter;
-}
-
-/*
- Ensuring that the defined disallowed functions revert in any case.
-*/
-rule disallowedFunctionalities(method f) filtered { f -> disAllowedFunctions(f) }
-{
- env e; calldataarg args;
- f@withrevert(e, args);
- assert lastReverted;
-}
-
diff --git a/changelog/3.2.md b/changelog/3.2.md
new file mode 100644
index 00000000..fe50aea5
--- /dev/null
+++ b/changelog/3.2.md
@@ -0,0 +1,102 @@
+# Aave 3.2
+
+Aave 3.2 focuses on two main areas of the aave protocol:
+
+- the final deprecation of stable borrowing
+- improvements on the eModes
+
+## Stable Rate offboarding
+
+While previous upgrades allowed graceful offboarding of stable borrowing, now with no stable borrow positions being left the protcol can remove all the now obsolete stable rate related logic.
+
+### Migration guide
+
+The upgrade is 100% backwards compatible.
+There are no changes to any methods, nor are there changes to emitted events.
+Parameters emitted in events that relate to stable rate are nulled.
+
+## Emodes: Removal of the eMode oracle
+
+The eMode oracle has never been used and it's usefulnes is debatable.
+Therefore to allow for storage optimization within the eMode configuration and reduce unnecessary code paths - the eMode oracle was removed.
+
+#### Indexers
+
+For backwards compatibility the existing `EModeCategoryAdded` will be emitted, but with `oracle` being nullified.
+
+## Emodes: Liquid eModes
+
+The new Liquid eMode feature of Aave v3.2 removes the previous constraint: **an asset listed on Aave can be eligible for different eModes, and then it only depends on the user to choose which eMode he wants to enter to.**
+
+For example, with liquid eModes, a possible configuration not doable before would be:
+
+- eMode 1, with wstETH, weETH and WETH.
+- eMode 2, with wstETH and WETH.
+- eMode 3, with weETH and WETH.
+- eMode 4, with WETH and GHO.
+
+So then, user A holding the wstETH and weETH collaterals, could borrow WETH at high LTV.
+User B holding only wstETH could borrow WETH at high (but different) LTV.
+User C holding only weETH could similarly borrow WETH at a different LTV than the previous two eModes.
+User D could have a position with WETH collateral and GHO borrowings.
+
+This doesn’t stop there, as more sophisticated configuration strategies could be adopted, like:
+
+- eMode for only WETH and stablecoins.
+- eMode for onboarding less mature LSTs, without requiring them being together with all major LSTs.
+
+**For extra configuration flexibility, liquid eModes also allow now to flag an asset as only borrowable, only collateral, or both, in the context of an eMode.**
+For example, in a hypothetic eMode with only wstETH and WETH, the normal configuration would be wstETH as only collateral and WETH as only borrowable, fully focusing on the wstETH leverage use-case.
+
+### BREAKING CHANGES
+
+- DataTypes.EModeCategory will return the same data as now, but is flagged deprecated and will be removed at a later point.
+
+- the new version of `PoolDataProvider` no longer exposes `PoolDataProvider.getReserveEModeCategory(address asset)` as there no longer is a `1:1` relation between assets and eModes.
+- `reserveConfig.getEModeCategory()` will return the current eMode, but will no longer be updated and is flagged deprecated.
+
+### Migration guide
+
+For existing users, the upgrade is 100% backwards compatible and no migration or similar is required.
+Entering and leaving an eMode still works via `setUserEMode(categoryId)` and `getUserEMode(address user)` like in previous versions of the protocol.
+
+#### Indexers
+
+As collateral/borrowable flags are newly introduced, two new events are being emitted:
+
+- `event AssetCollateralInEModeChanged(address indexed asset, uint8 categoryId, bool collateral);`
+- `event AssetBorrowableInEModeChanged(address indexed asset, uint8 categoryId, bool borrowable);`
+
+#### Getters
+
+In aave 3.1 all eMode parameters were exposed via a single `getEModeCategoryData` getter.
+When checking existing integrations, we noticed that in most cases this approach is suboptimal, given that users only rely on a subset of the data.
+Therefore in addition to the **deprecated** `getEModeCategoryData` getter there are now independent getters for the respective values:
+
+- `getEModeCategoryCollateralConfig(categoryId)`, returning the eMode ltv,lt,lb
+- `getEModeCategoryLabel(categoryId)`, returning the eMode label
+- `getEModeCategoryCollateralBitmap(categoryId)`, returning the collateral bitmap
+- `getEModeCategoryBorrowableBitmap(categoryId)`, returning the borrowable bitmap
+
+#### Identifying eModes for an asset
+
+In the previous version of the eModes feature it was possible to query a reserve configration to receive it's unique eMode.
+The relevant bits on the reseve configuration have been nullified.
+
+To identify eModes of a selected asset, there is currently multiple options:
+
+- onchain one can iterate trough eModes and select the "correct one" based on your application specific needs.
+
+```sol
+for (uint8 i = 1; i < 256; i++) {
+ DataTypes.CollateralConfig memory cfg = pool.getEModeCategoryCollateralConfig(i);
+ // check if it is an active eMode
+ if (cfg.liquidationThreshold != 0) {
+ // check if it's an eMode you are interested in
+ EModeConfiguration.isCollateralAsset(pool.getEModeCategoryCollateralBitmap(i), someReserveIndex);
+ EModeConfiguration.isBorrowableAsset(pool.getEModeCategoryBorrowableBitmap(i), someReserveIndex);
+ }
+}
+```
+
+- an offchain system could listen to `AssetCollateralInEModeChanged` & `AssetBorrowableInEModeChanged` events and feed the onchain contract with an appropriate categoryId
diff --git a/changelog/3.2_3.1_gas-diff.md b/changelog/3.2_3.1_gas-diff.md
new file mode 100644
index 00000000..59555afb
--- /dev/null
+++ b/changelog/3.2_3.1_gas-diff.md
@@ -0,0 +1,255 @@
+```diff
+diff --git a/reports/gas.old b/reports/gas.new
+index 27edd2c..d023564 100644
+--- a/reports/gas.old
++++ b/reports/gas.new
+@@ -1,28 +1,27 @@
+ | Deployment Cost | Deployment Size | | | | |
+ | 465623 | 2115 | | | | |
+ | Function Name | min | avg | median | max | # calls |
+-| ADDRESSES_PROVIDER | 898 | 3118 | 965 | 5465 | 2960 |
++| ADDRESSES_PROVIDER | 898 | 4362 | 5398 | 5465 | 3204 |
+-| DOMAIN_SEPARATOR | 1071 | 3102 | 3071 | 7571 | 260 |
++| DOMAIN_SEPARATOR | 1071 | 4688 | 4156 | 7571 | 5 |
+-| EMISSION_MANAGER | 940 | 940 | 940 | 940 | 711 |
++| EMISSION_MANAGER | 940 | 940 | 940 | 940 | 657 |
+-| FLASHLOAN_PREMIUM_TOTAL | 1002 | 2032 | 3002 | 7524 | 1426 |
++| FLASHLOAN_PREMIUM_TOTAL | 1002 | 2033 | 3002 | 7524 | 1318 |
+-| FLASHLOAN_PREMIUM_TO_PROTOCOL | 1095 | 1099 | 1095 | 7595 | 1423 |
++| FLASHLOAN_PREMIUM_TO_PROTOCOL | 1051 | 1075 | 1073 | 7573 | 1315 |
+-| MAX_GRACE_PERIOD | 5418 | 5418 | 5418 | 5418 | 1792 |
++| MAX_GRACE_PERIOD | 5374 | 5374 | 5374 | 5374 | 1792 |
+-| MAX_NUMBER_RESERVES | 922 | 922 | 922 | 922 | 1 |
++| MAX_NUMBER_RESERVES | 900 | 900 | 900 | 900 | 512 |
+-| MAX_STABLE_RATE_BORROW_SIZE_PERCENT | 1001 | 1001 | 1001 | 1001 | 1 |
+-| POOL | 940 | 2117 | 940 | 5440 | 107 |
++| POOL | 940 | 940 | 940 | 940 | 151 |
+-| RESERVE_TREASURY_ADDRESS | 1033 | 3279 | 3033 | 7533 | 2582 |
++| RESERVE_TREASURY_ADDRESS | 1033 | 1399 | 1033 | 7533 | 11254 |
+-| UNDERLYING_ASSET_ADDRESS | 1011 | 1245 | 1011 | 3055 | 875 |
++| UNDERLYING_ASSET_ADDRESS | 1011 | 1048 | 1055 | 3055 | 18525 |
+-| approve | 51281 | 51337 | 51305 | 51653 | 3093 |
++| approve | 51293 | 51357 | 51341 | 51653 | 39 |
+-| backUnbacked | 139070 | 153427 | 150732 | 173679 | 9 |
++| backUnbacked | 125314 | 140965 | 138917 | 159923 | 9 |
+-| balanceOf | 1033 | 3698 | 3360 | 22860 | 26304 |
++| balanceOf | 1297 | 5838 | 5387 | 22882 | 13022 |
+-| borrow(address,uint256,uint256,uint16,address) | 85039 | 259204 | 263334 | 310883 | 2928 |
++| borrow(address,uint256,uint256,uint16,address) | 74012 | 236273 | 249909 | 289117 | 3979 |
+-| borrow(bytes32) | 243318 | 243318 | 243318 | 243318 | 3 |
++| borrow(bytes32) | 229784 | 229784 | 229784 | 229784 | 3 |
+-| borrowAllowance | 1398 | 1424 | 1424 | 1450 | 10 |
++| borrowAllowance | 1450 | 1450 | 1450 | 1450 | 5 |
+-| configureEModeCategory | 34510 | 34532 | 34532 | 34555 | 512 |
++| configureEModeCategory | 34265 | 34276 | 34276 | 34287 | 512 |
+-| configureReserveAsCollateral | 44067 | 64132 | 72201 | 122702 | 778 |
++| configureReserveAsCollateral | 44089 | 64560 | 57776 | 122574 | 2308 |
+-| decimals | 948 | 1020 | 970 | 7470 | 801 |
++| decimals | 948 | 980 | 970 | 7470 | 18578 |
+ | decreaseAllowance | 34424 | 34424 | 34424 | 34424 | 1 |
+-| delegationWithSig | 29263 | 56423 | 45286 | 84345 | 14 |
++| delegationWithSig | 29263 | 56402 | 45264 | 84300 | 7 |
+-| deposit | 185121 | 234784 | 238060 | 247660 | 4362 |
++| deposit | 91045 | 215439 | 232166 | 235786 | 64 |
+-| disableLiquidationGracePeriod | 43659 | 55023 | 66191 | 66191 | 513 |
++| disableLiquidationGracePeriod | 43570 | 54942 | 66117 | 66117 | 513 |
+-| dropReserve | 32591 | 35807 | 32679 | 114160 | 775 |
++| dropReserve | 32635 | 35738 | 32657 | 105160 | 775 |
+-| flashLoan | 59460 | 177954 | 155739 | 374408 | 266 |
++| flashLoan | 59293 | 166429 | 135219 | 374226 | 267 |
+-| flashLoanSimple | 50968 | 322401 | 191286 | 664969 | 11 |
++| flashLoanSimple | 50944 | 311942 | 179440 | 642995 | 11 |
+-| getAssetIndex | 3098 | 10053 | 9606 | 16527 | 9694 |
++| getAssetIndex | 3708 | 11517 | 14698 | 21619 | 90 |
+-| getAverageStableRate | 5340 | 5340 | 5340 | 5340 | 1 |
+-| getBorrowLogic | 5417 | 5428 | 5428 | 5439 | 2 |
++| getBorrowLogic | 5395 | 5417 | 5417 | 5439 | 2 |
+-| getClaimer | 1244 | 7718 | 7744 | 7744 | 514 |
++| getClaimer | 1244 | 3410 | 1244 | 7744 | 3 |
+-| getConfiguration | 1298 | 1981 | 1320 | 7820 | 32304 |
++| getConfiguration | 1342 | 1917 | 1364 | 7864 | 56492 |
+-| getConfiguratorLogic | 5353 | 5353 | 5353 | 5353 | 1 |
++| getConfiguratorLogic | 5397 | 5397 | 5397 | 5397 | 1 |
+ | getDistributionEnd | 1411 | 1411 | 1411 | 1411 | 1 |
+-| getEModeCategoryData | 2532 | 6296 | 6793 | 11032 | 55 |
++| getEModeCategoryData | 13446 | 13446 | 13446 | 13446 | 3 |
+-| getEModeLogic | 5392 | 5403 | 5403 | 5414 | 2 |
++| getEModeLogic | 5392 | 5425 | 5425 | 5459 | 2 |
+-| getFlashLoanLogic | 5394 | 5405 | 5405 | 5416 | 2 |
++| getFlashLoanLogic | 5416 | 5438 | 5438 | 5461 | 2 |
+-| getIncentivesController | 1044 | 1082 | 1067 | 7588 | 787 |
++| getIncentivesController | 1044 | 1066 | 1088 | 7588 | 18392 |
+-| getLiquidationGracePeriod | 29229 | 29229 | 29229 | 29229 | 2258 |
++| getLiquidationGracePeriod | 29185 | 29204 | 29207 | 29207 | 2270 |
+-| getLiquidationLogic | 5439 | 5439 | 5439 | 5439 | 2 |
++| getLiquidationLogic | 5439 | 5450 | 5450 | 5461 | 2 |
+-| getPendingLtv | 1215 | 1215 | 1215 | 1215 | 771 |
++| getPendingLtv | 1259 | 1259 | 1259 | 1259 | 771 |
+-| getPoolLogic | 5416 | 5438 | 5438 | 5460 | 2 |
++| getPoolLogic | 5393 | 5415 | 5415 | 5438 | 2 |
++| getEModeCategoryBorrowableBitmap | 1287 | 7705 | 7787 | 7787 | 1827 |
++| getEModeCategoryCollateralBitmap | 1297 | 7732 | 7797 | 7797 | 2624 |
++| getEModeCategoryCollateralConfig | 1511 | 2351 | 1511 | 8011 | 110 |
++| getEModeCategoryLabel | 1954 | 2271 | 2212 | 3954 | 25 |
+ | getPreviousIndex | 1270 | 1270 | 1270 | 1270 | 39 |
+ | getReserveAddressById | 1281 | 1281 | 1281 | 1281 | 1 |
+-| getReserveData | 5007 | 7533 | 5029 | 29529 | 11478 |
++| getReserveData | 4889 | 12060 | 10933 | 29433 | 24876 |
+-| getReserveDataExtended | 4122 | 16316 | 4122 | 28622 | 1547 |
++| getReserveDataExtended | 4186 | 4852 | 4186 | 6186 | 6 |
+-| getReserveNormalizedIncome | 0 | 3480 | 1465 | 10427 | 28339 |
++| getReserveNormalizedIncome | 1443 | 1928 | 1487 | 10449 | 12324 |
+-| getReserveNormalizedVariableDebt | 1487 | 1681 | 1509 | 11607 | 7456 |
++| getReserveNormalizedVariableDebt | 1465 | 1675 | 1509 | 11607 | 7709 |
+-| getReservesCount | 1028 | 1028 | 1028 | 1028 | 1 |
++| getReservesCount | 1006 | 1006 | 1006 | 1006 | 2 |
+-| getReservesList | 3804 | 14119 | 16304 | 16304 | 1632 |
++| getReservesList | 3814 | 14280 | 11814 | 104107 | 4195 |
+-| getRewardsByAsset | 2399 | 10619 | 10899 | 10899 | 2419 |
++| getRewardsByAsset | 2399 | 5698 | 3672 | 10899 | 201 |
+-| getScaledUserBalanceAndSupply | 1449 | 5068 | 3449 | 9949 | 21 |
++| getScaledUserBalanceAndSupply | 1449 | 4192 | 3449 | 9949 | 39 |
+-| getSupplyData | 941 | 4320 | 5441 | 5441 | 24634 |
+-| getSupplyLogic | 5395 | 5406 | 5406 | 5417 | 2 |
++| getSupplyLogic | 5395 | 5427 | 5427 | 5459 | 2 |
+-| getTotalSupplyAndAvgRate | 5467 | 5467 | 5467 | 5467 | 1 |
+-| getTotalSupplyLastUpdated | 5380 | 5380 | 5380 | 5380 | 1 |
+-| getUserAccountData | 20331 | 23740 | 24831 | 33184 | 1037 |
++| getUserAccountData | 12857 | 22690 | 23001 | 38126 | 2575 |
+-| getUserConfiguration | 1322 | 1379 | 1322 | 3322 | 1822 |
+-| getUserEMode | 1275 | 1275 | 1275 | 1275 | 1036 |
+-| getUserLastUpdated | 1063 | 1066 | 1063 | 5563 | 1303 |
+-| getUserRewards | 7469 | 8705 | 8749 | 17526 | 267 |
+-| getUserStableRate | 1053 | 1056 | 1053 | 5553 | 1303 |
+-| getVirtualUnderlyingBalance | 1298 | 1298 | 1298 | 1298 | 2161 |
++| getUserConfiguration | 1322 | 1367 | 1322 | 3322 | 1821 |
++| getUserEMode | 1253 | 1253 | 1253 | 1253 | 1296 |
++| getUserRewards | 5237 | 7340 | 7469 | 10837 | 19 |
++| getVirtualUnderlyingBalance | 1276 | 1276 | 1276 | 1343 | 2159 |
+-| initReserve | 33566 | 33566 | 33566 | 33566 | 1024 |
++| initReserve | 33292 | 33324 | 33324 | 33356 | 1024 |
+-| initReserves | 43976 | 1109034 | 67095 | 266376563 | 777 |
++| initReserves | 45710 | 32954623 | 1608767 | 216346556 | 2049 |
+-| liquidationCall(address,address,address,uint256,bool) | 93735 | 277164 | 373019 | 436593 | 3511 |
++| liquidationCall(address,address,address,uint256,bool) | 80781 | 265740 | 351321 | 411059 | 3772 |
+-| liquidationCall(bytes32,bytes32) | 436101 | 436101 | 436101 | 436101 | 1 |
++| liquidationCall(bytes32,bytes32) | 403478 | 403478 | 403478 | 403478 | 1 |
+-| mintToTreasury(address[]) | 99379 | 100961 | 100961 | 102543 | 4 |
++| mintToTreasury(address[]) | 99355 | 100937 | 100937 | 102519 | 4 |
+-| mintUnbacked | 39431 | 157624 | 142643 | 206928 | 17 |
+-| name | 1883 | 2336 | 1883 | 8383 | 1130 |
+-| nonces | 1193 | 3233 | 3271 | 3271 | 266 |
++| mintUnbacked | 39409 | 145643 | 130769 | 193113 | 17 |
++| name | 1625 | 2060 | 1945 | 8383 | 18717 |
++| nonces | 1193 | 2463 | 3271 | 3271 | 10 |
+-| principalBalanceOf | 1054 | 1058 | 1054 | 5554 | 1304 |
+-| rebalanceStableBorrowRate(address,address) | 66731 | 77785 | 76855 | 90701 | 4 |
+-| rebalanceStableBorrowRate(bytes32) | 88567 | 88567 | 88567 | 88567 | 1 |
+-| repay(address,uint256,uint256,address) | 72862 | 145786 | 183147 | 202671 | 12 |
+-| repay(bytes32) | 171079 | 171079 | 171079 | 171079 | 1 |
++| repay(address,uint256,uint256,address) | 60515 | 129404 | 167787 | 187188 | 13 |
+-| repayWithATokens(address,uint256,uint256) | 169667 | 197449 | 198790 | 209791 | 261 |
++| repayWithATokens(address,uint256,uint256) | 155169 | 181413 | 182340 | 193364 | 261 |
+-| repayWithATokens(bytes32) | 174264 | 174264 | 174264 | 174264 | 1 |
+-| repayWithPermit(address,uint256,uint256,address,uint256,uint8,bytes32,bytes32) | 172046 | 202393 | 206845 | 235069 | 768 |
++| repayWithPermit(address,uint256,uint256,address,uint256,uint8,bytes32,bytes32) | 155747 | 185446 | 182899 | 218983 | 768 |
+-| repayWithPermit(bytes32,bytes32,bytes32) | 206026 | 223388 | 232772 | 234406 | 256 |
++| repayWithPermit(bytes32,bytes32,bytes32) | 187610 | 205991 | 197025 | 217816 | 256 |
+-| rescueTokens | 39115 | 70330 | 70428 | 70493 | 515 |
++| repay(bytes32) | 157379 | 157379 | 157379 | 157379 | 1 |
++| repayWithATokens(bytes32) | 160457 | 160457 | 160457 | 160457 | 1 |
++| rescueTokens | 39115 | 70351 | 70450 | 70515 | 515 |
+-| scaledBalanceOf | 1307 | 3892 | 3307 | 7807 | 17058 |
+-| scaledTotalSupply | 988 | 6174 | 7532 | 7532 | 24923 |
+-| setAssetEModeCategory | 43877 | 48416 | 43877 | 79492 | 296 |
+-| setBorrowCap | 43786 | 44831 | 43786 | 70877 | 268 |
+-| setBorrowableInIsolation | 67664 | 70079 | 70466 | 70466 | 13 |
+-| setConfiguration | 32805 | 32816 | 32816 | 32827 | 512 |
+-| setDebtCeiling | 43831 | 48208 | 43831 | 121793 | 274 |
+-| setEModeCategory | 45031 | 53891 | 45031 | 135403 | 295 |
++| scaledBalanceOf | 1307 | 3796 | 3307 | 7807 | 21200 |
++| scaledTotalSupply | 988 | 6101 | 7532 | 7532 | 23280 |
++| setAssetBorrowableInEMode | 94407 | 111508 | 111507 | 124758 | 1801 |
++| setAssetCollateralInEMode | 44103 | 99490 | 107690 | 107690 | 2853 |
++| setBorrowCap | 43764 | 44722 | 43764 | 70919 | 267 |
++| setBorrowableInIsolation | 67662 | 70075 | 70464 | 70464 | 13 |
++| setConfiguration | 32783 | 32794 | 32794 | 32805 | 512 |
++| setDebtCeiling | 43743 | 48113 | 43743 | 121555 | 274 |
++| setEModeCategory | 44850 | 102968 | 108880 | 108892 | 2849 |
+-| setLiquidationGracePeriod | 32857 | 37965 | 37379 | 43790 | 1536 |
+-| setLiquidationProtocolFee | 43996 | 60580 | 69836 | 70926 | 8 |
+-| setPoolPause(bool) | 41133 | 43634 | 43639 | 43645 | 512 |
+-| setPoolPause(bool,uint40) | 43789 | 88304 | 105603 | 134276 | 515 |
+-| setReserveActive | 40884 | 44328 | 40884 | 118172 | 269 |
+-| setReserveBorrowing | 43811 | 44179 | 43811 | 68496 | 260 |
+-| setReserveFactor | 43744 | 44228 | 43744 | 168324 | 258 |
+-| setReserveFlashLoaning | 68469 | 69188 | 68471 | 70625 | 3 |
+-| setReserveFreeze | 47022 | 73134 | 74781 | 99799 | 784 |
+-| setReserveInterestRateData | 44304 | 44449 | 44532 | 44532 | 256 |
+-| setReserveInterestRateStrategyAddress(address,address) | 32846 | 34595 | 33195 | 42729 | 1538 |
+-| setReserveInterestRateStrategyAddress(address,address,bytes) | 44536 | 46606 | 44536 | 204894 | 260 |
+-| setReservePause(address,bool) | 43900 | 57019 | 69938 | 69938 | 513 |
+-| setReservePause(address,bool,uint40) | 41267 | 65950 | 73872 | 78984 | 3086 |
+-| setReserveStableRateBorrowing | 43878 | 55083 | 43878 | 70726 | 447 |
+-| setSiloedBorrowing | 110540 | 120362 | 124195 | 126351 | 3 |
+-| setSupplyCap | 43766 | 57641 | 70845 | 70881 | 528 |
+-| setUnbackedMintCap | 70847 | 70847 | 70847 | 70847 | 7 |
+-| setUserEMode | 48307 | 69273 | 66533 | 124479 | 17 |
+-| setUserUseReserveAsCollateral(address,bool) | 91258 | 106982 | 102533 | 146832 | 42 |
+-| setUserUseReserveAsCollateral(bytes32) | 104249 | 104249 | 104249 | 104249 | 1 |
++| setLiquidationGracePeriod | 32850 | 37953 | 37372 | 43783 | 1536 |
++| setLiquidationProtocolFee | 43996 | 60620 | 69900 | 70990 | 8 |
++| setPoolPause(bool) | 43546 | 43975 | 43558 | 116350 | 515 |
++| setPoolPause(bool,uint40) | 43789 | 88446 | 74811 | 134413 | 512 |
++| setReserveActive | 40906 | 43807 | 40906 | 118044 | 267 |
++| setReserveBorrowing | 43855 | 62331 | 68490 | 68492 | 1024 |
++| setReserveFactor | 43788 | 44208 | 43788 | 151867 | 258 |
++| setReserveFlashLoaning | 68489 | 68494 | 68491 | 70645 | 513 |
++| setReserveFreeze | 47044 | 73136 | 74867 | 99885 | 782 |
++| setReserveInterestRateData | 44360 | 44843 | 44576 | 131113 | 257 |
++| setReserveInterestRateStrategyAddress(address,address) | 32846 | 34588 | 33195 | 42729 | 1538 |
++| setReserveInterestRateStrategyAddress(address,address,bytes) | 44491 | 61354 | 44491 | 190210 | 300 |
++| setReservePause(address,bool) | 43834 | 44174 | 44062 | 67780 | 258 |
++| setReservePause(address,bool,uint40) | 41289 | 65779 | 73951 | 76263 | 3084 |
++| setSiloedBorrowing | 102106 | 111970 | 115825 | 117981 | 3 |
++| setSupplyCap | 43721 | 45734 | 43721 | 70876 | 279 |
++| setUnbackedMintCap | 70911 | 70911 | 70911 | 70911 | 7 |
++| setUserEMode | 40484 | 73767 | 67458 | 121154 | 2583 |
++| setUserUseReserveAsCollateral(address,bool) | 80336 | 96351 | 93552 | 129626 | 42 |
++| setUserUseReserveAsCollateral(bytes32) | 95351 | 95351 | 95351 | 95351 | 1 |
+-| supply(address,uint256,address,uint16) | 67576 | 224075 | 242895 | 255446 | 3134 |
++| supply(address,uint256,address,uint16) | 56642 | 219107 | 226317 | 243572 | 5603 |
+-| supply(bytes32) | 248862 | 248862 | 248862 | 248862 | 7 |
++| supply(bytes32) | 236988 | 236988 | 236988 | 236988 | 7 |
+-| supplyWithPermit(address,uint256,address,uint16,uint256,uint8,bytes32,bytes32) | 154205 | 228834 | 253878 | 278406 | 768 |
++| supplyWithPermit(address,uint256,address,uint16,uint256,uint8,bytes32,bytes32) | 142365 | 216981 | 242026 | 266578 | 768 |
+-| supplyWithPermit(bytes32,bytes32,bytes32) | 274396 | 274465 | 274438 | 274588 | 256 |
++| supplyWithPermit(bytes32,bytes32,bytes32) | 262610 | 262681 | 262658 | 262802 | 256 |
+-| swapBorrowRateMode(address,uint256) | 71875 | 82362 | 72110 | 108180 | 7 |
+-| swapBorrowRateMode(bytes32) | 110034 | 110034 | 110034 | 110034 | 1 |
+-| symbol | 1690 | 2535 | 1904 | 8448 | 1098 |
++| symbol | 1646 | 2124 | 2010 | 8448 | 18692 |
+-| totalSupply | 907 | 8067 | 11570 | 15570 | 5078 |
++| totalSupply | 1024 | 8836 | 11592 | 15592 | 5958 |
+-| transfer | 27662 | 142942 | 149371 | 177944 | 273 |
++| transfer | 27662 | 143985 | 149393 | 167091 | 273 |
+-| transferFrom | 138680 | 138800 | 138800 | 138920 | 2 |
++| transferFrom | 138702 | 138822 | 138822 | 138942 | 2 |
+-| updateAToken | 41834 | 42242 | 41834 | 146921 | 257 |
+-| updateBridgeProtocolFee | 32528 | 33708 | 32595 | 78343 | 526 |
+-| updateFlashloanPremiumToProtocol | 40448 | 40537 | 40448 | 63402 | 258 |
+-| updateFlashloanPremiumTotal | 40447 | 40536 | 40447 | 63412 | 258 |
+-| updateFlashloanPremiums | 32898 | 32909 | 32909 | 32920 | 512 |
+-| updateStableDebtToken | 41688 | 42073 | 41688 | 140830 | 257 |
+-| updateVariableDebtToken | 41710 | 42095 | 41710 | 140832 | 257 |
++| updateAToken | 41767 | 42175 | 41767 | 146804 | 257 |
++| updateBridgeProtocolFee | 32528 | 33697 | 32573 | 78365 | 526 |
++| updateFlashloanPremiumToProtocol | 40448 | 40537 | 40448 | 63357 | 258 |
++| updateFlashloanPremiumTotal | 40402 | 40491 | 40402 | 63322 | 258 |
++| updateFlashloanPremiums | 32853 | 32864 | 32864 | 32875 | 512 |
++| updateVariableDebtToken | 41622 | 42007 | 41622 | 140688 | 257 |
+-| withdraw(address,uint256,address) | 77252 | 147744 | 154662 | 224961 | 23 |
++| withdraw(address,uint256,address) | 66318 | 134721 | 141942 | 204789 | 23 |
+-| withdraw(bytes32) | 150631 | 157711 | 157711 | 164791 | 2 |
++| withdraw(bytes32) | 138760 | 145839 | 145839 | 152919 | 2 |
+```
diff --git a/foundry.toml b/foundry.toml
index e5ae0500..a2c225e2 100644
--- a/foundry.toml
+++ b/foundry.toml
@@ -5,7 +5,7 @@ script = 'scripts'
optimizer = true
optimizer_runs = 200
solc = '0.8.20'
-evm_version = 'paris'
+evm_version = 'shanghai'
bytecode_hash = 'none'
ignored_warnings_from = ["src/periphery/contracts/treasury/RevenueSplitter.sol"]
out = 'out'
@@ -40,6 +40,7 @@ bnb_testnet = "${RPC_BNB_TESTNET}"
bnb = "${RPC_BNB}"
gnosis = "${RPC_GNOSIS}"
base = "${RPC_BASE}"
+metis = "${RPC_METIS}"
[etherscan]
mainnet = { key = "${ETHERSCAN_API_KEY_MAINNET}", chainId = 1 }
@@ -47,14 +48,15 @@ optimism = { key = "${ETHERSCAN_API_KEY_OPTIMISM}", chainId = 10 }
avalanche = { key = "${ETHERSCAN_API_KEY_AVALANCHE}", chainId = 43114 }
polygon = { key = "${ETHERSCAN_API_KEY_POLYGON}", chainId = 137 }
arbitrum = { key = "${ETHERSCAN_API_KEY_ARBITRUM}", chainId = 42161 }
-fantom = { key = "${ETHERSCAN_API_KEY_FANTOM}", chainId = 250 }
+# fantom = { key = "${ETHERSCAN_API_KEY_FANTOM}", chainId = 250 }
scroll = { key = "${ETHERSCAN_API_KEY_SCROLL}", chainId = 534352, url = 'https://api.scrollscan.com/api\?' }
-celo = { key = "${ETHERSCAN_API_KEY_CELO}", chainId = 42220 }
-sepolia = { key = "${ETHERSCAN_API_KEY_MAINNET}", chainId = 11155111 }
-mumbai = { key = "${ETHERSCAN_API_KEY_POLYGON}", chainId = 80001 }
-amoy = { key = "${ETHERSCAN_API_KEY_POLYGON}", chainId = 80002 }
-bnb_testnet = { key = "${ETHERSCAN_API_KEY_BNB}", chainId = 97, url = 'https://api-testnet.bscscan.com/api' }
+# celo = { key = "${ETHERSCAN_API_KEY_CELO}", chainId = 42220 }
+# sepolia = { key = "${ETHERSCAN_API_KEY_MAINNET}", chainId = 11155111 }
+# mumbai = { key = "${ETHERSCAN_API_KEY_POLYGON}", chainId = 80001 }
+# amoy = { key = "${ETHERSCAN_API_KEY_POLYGON}", chainId = 80002 }
+# bnb_testnet = { key = "${ETHERSCAN_API_KEY_BNB}", chainId = 97, url = 'https://api-testnet.bscscan.com/api' }
bnb = { key = "${ETHERSCAN_API_KEY_BNB}", chainId = 56, url = 'https://api.bscscan.com/api' }
base = { key = "${ETHERSCAN_API_KEY_BASE}", chain = 8453 }
gnosis = { key = "${ETHERSCAN_API_KEY_GNOSIS}", chainId = 100 }
+metis = { key = "", chainId = 1088, url = 'https://api.routescan.io/v2/network/mainnet/evm/1088/etherscan/api' }
# See more config options https://github.com/gakonst/foundry/tree/master/config
diff --git a/package.json b/package.json
index e2047c8f..7404519d 100644
--- a/package.json
+++ b/package.json
@@ -22,7 +22,7 @@
"prettier-plugin-solidity": "^1.1.1"
},
"dependencies": {
- "@bgd-labs/aave-cli": "^0.16.4",
+ "@bgd-labs/aave-cli": "^1.0.0",
"catapulta-verify": "^1.1.1"
}
}
diff --git a/report/cmd_line b/report/cmd_line
index 531e7eed..32f76312 100644
--- a/report/cmd_line
+++ b/report/cmd_line
@@ -1 +1 @@
-genhtml ./lcov.info.p -o report --branch-coverage
+genhtml ./lcov.info.p -o report --branch-coverage --rc derive_function_end_line=0 --parallel
diff --git a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/index-sort-b.html b/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/index-sort-b.html
deleted file mode 100644
index 54f9b9fb..00000000
--- a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/index-sort-b.html
+++ /dev/null
@@ -1,169 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - core/contracts/protocol/configuration/src/core/contracts/protocol/configuration
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
|
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../glass.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../updown.png) |
-
-
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
-
-
- ACLManager.sol |
-
-
- |
- 100.0 % |
- 19 |
- 19 |
- - |
- |
- |
- 100.0 % |
- 19 |
- 19 |
-
-
- PoolAddressesProvider.sol |
-
-
- |
- 100.0 % |
- 56 |
- 56 |
- - |
- |
- |
- 100.0 % |
- 22 |
- 22 |
-
-
- PoolAddressesProviderRegistry.sol |
-
-
- |
- 100.0 % |
- 26 |
- 26 |
- - |
- |
- |
- 100.0 % |
- 7 |
- 7 |
-
-
- PriceOracleSentinel.sol |
-
-
- |
- 100.0 % |
- 10 |
- 10 |
- - |
- |
- |
- 100.0 % |
- 7 |
- 7 |
-
-
-
-
-
-
-
-
-
-
diff --git a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/index-sort-f.html b/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/index-sort-f.html
deleted file mode 100644
index fc55300b..00000000
--- a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/index-sort-f.html
+++ /dev/null
@@ -1,169 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - core/contracts/protocol/configuration/src/core/contracts/protocol/configuration
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
|
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../glass.png) |
-
-
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
-
-
- PoolAddressesProviderRegistry.sol |
-
-
- |
- 100.0 % |
- 26 |
- 26 |
- - |
- |
- |
- 100.0 % |
- 7 |
- 7 |
-
-
- PriceOracleSentinel.sol |
-
-
- |
- 100.0 % |
- 10 |
- 10 |
- - |
- |
- |
- 100.0 % |
- 7 |
- 7 |
-
-
- ACLManager.sol |
-
-
- |
- 100.0 % |
- 19 |
- 19 |
- - |
- |
- |
- 100.0 % |
- 19 |
- 19 |
-
-
- PoolAddressesProvider.sol |
-
-
- |
- 100.0 % |
- 56 |
- 56 |
- - |
- |
- |
- 100.0 % |
- 22 |
- 22 |
-
-
-
-
-
-
-
-
-
-
diff --git a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/index-sort-l.html b/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/index-sort-l.html
deleted file mode 100644
index 0c13c5fc..00000000
--- a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/index-sort-l.html
+++ /dev/null
@@ -1,169 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - core/contracts/protocol/configuration/src/core/contracts/protocol/configuration
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
|
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../glass.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../updown.png) |
-
-
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
-
-
- PriceOracleSentinel.sol |
-
-
- |
- 100.0 % |
- 10 |
- 10 |
- - |
- |
- |
- 100.0 % |
- 7 |
- 7 |
-
-
- ACLManager.sol |
-
-
- |
- 100.0 % |
- 19 |
- 19 |
- - |
- |
- |
- 100.0 % |
- 19 |
- 19 |
-
-
- PoolAddressesProviderRegistry.sol |
-
-
- |
- 100.0 % |
- 26 |
- 26 |
- - |
- |
- |
- 100.0 % |
- 7 |
- 7 |
-
-
- PoolAddressesProvider.sol |
-
-
- |
- 100.0 % |
- 56 |
- 56 |
- - |
- |
- |
- 100.0 % |
- 22 |
- 22 |
-
-
-
-
-
-
-
-
-
-
diff --git a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/index.html b/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/index.html
deleted file mode 100644
index bd9350ec..00000000
--- a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/index.html
+++ /dev/null
@@ -1,169 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - core/contracts/protocol/configuration/src/core/contracts/protocol/configuration
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
|
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../glass.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../updown.png) |
-
-
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
-
-
- ACLManager.sol |
-
-
- |
- 100.0 % |
- 19 |
- 19 |
- - |
- |
- |
- 100.0 % |
- 19 |
- 19 |
-
-
- PoolAddressesProvider.sol |
-
-
- |
- 100.0 % |
- 56 |
- 56 |
- - |
- |
- |
- 100.0 % |
- 22 |
- 22 |
-
-
- PoolAddressesProviderRegistry.sol |
-
-
- |
- 100.0 % |
- 26 |
- 26 |
- - |
- |
- |
- 100.0 % |
- 7 |
- 7 |
-
-
- PriceOracleSentinel.sol |
-
-
- |
- 100.0 % |
- 10 |
- 10 |
- - |
- |
- |
- 100.0 % |
- 7 |
- 7 |
-
-
-
-
-
-
-
-
-
-
diff --git a/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol.func-c.html b/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol.func-c.html
deleted file mode 100644
index c983b9c9..00000000
--- a/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol.func-c.html
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol - functions
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
-
-
-
-
diff --git a/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol.func.html b/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol.func.html
deleted file mode 100644
index 971352cb..00000000
--- a/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol.func.html
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol - functions
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
-
-
-
-
diff --git a/report/core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers/index-sort-b.html b/report/core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers/index-sort-b.html
deleted file mode 100644
index 3d12b7bd..00000000
--- a/report/core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers/index-sort-b.html
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
|
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../../../glass.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../../../updown.png) |
-
-
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
-
-
- Helpers.sol |
-
-
- |
- 100.0 % |
- 1 |
- 1 |
- - |
- |
- |
- 100.0 % |
- 1 |
- 1 |
-
-
-
-
-
-
-
-
-
-
diff --git a/report/core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers/index-sort-f.html b/report/core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers/index-sort-f.html
deleted file mode 100644
index 69c76388..00000000
--- a/report/core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers/index-sort-f.html
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
|
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../../../glass.png) |
-
-
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
-
-
- Helpers.sol |
-
-
- |
- 100.0 % |
- 1 |
- 1 |
- - |
- |
- |
- 100.0 % |
- 1 |
- 1 |
-
-
-
-
-
-
-
-
-
-
diff --git a/report/core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers/index-sort-l.html b/report/core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers/index-sort-l.html
deleted file mode 100644
index d2bec174..00000000
--- a/report/core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers/index-sort-l.html
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
|
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../../../glass.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../../../updown.png) |
-
-
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
-
-
- Helpers.sol |
-
-
- |
- 100.0 % |
- 1 |
- 1 |
- - |
- |
- |
- 100.0 % |
- 1 |
- 1 |
-
-
-
-
-
-
-
-
-
-
diff --git a/report/core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers/index.html b/report/core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers/index.html
deleted file mode 100644
index 985d097b..00000000
--- a/report/core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers/index.html
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
|
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../../../glass.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../../../updown.png) |
-
-
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
-
-
- Helpers.sol |
-
-
- |
- 100.0 % |
- 1 |
- 1 |
- - |
- |
- |
- 100.0 % |
- 1 |
- 1 |
-
-
-
-
-
-
-
-
-
-
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/BorrowLogic.sol.func.html b/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/BorrowLogic.sol.func.html
deleted file mode 100644
index 4c169418..00000000
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/BorrowLogic.sol.func.html
+++ /dev/null
@@ -1,112 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/BorrowLogic.sol - functions
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
-
-
-
-
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/EModeLogic.sol.func-c.html b/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/EModeLogic.sol.func-c.html
deleted file mode 100644
index 7a6e66bf..00000000
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/EModeLogic.sol.func-c.html
+++ /dev/null
@@ -1,105 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/EModeLogic.sol - functions
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
-
-
-
-
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/EModeLogic.sol.func.html b/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/EModeLogic.sol.func.html
deleted file mode 100644
index 0117170a..00000000
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/EModeLogic.sol.func.html
+++ /dev/null
@@ -1,105 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/EModeLogic.sol - functions
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
-
-
-
-
diff --git a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/index-sort-b.html b/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/index-sort-b.html
deleted file mode 100644
index 4190f8d8..00000000
--- a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/index-sort-b.html
+++ /dev/null
@@ -1,169 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - core/contracts/protocol/pool/src/core/contracts/protocol/pool
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
|
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../glass.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../updown.png) |
-
-
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
-
-
- DefaultReserveInterestRateStrategyV2.sol |
-
-
- |
- 100.0 % |
- 43 |
- 43 |
- - |
- |
- |
- 100.0 % |
- 13 |
- 13 |
-
-
- L2Pool.sol |
-
-
- |
- 100.0 % |
- 24 |
- 24 |
- - |
- |
- |
- 100.0 % |
- 11 |
- 11 |
-
-
- Pool.sol |
-
-
- |
- 99.1 % |
- 108 |
- 107 |
- - |
- |
- |
- 98.4 % |
- 61 |
- 60 |
-
-
- PoolConfigurator.sol |
-
-
- |
- 96.8 % |
- 190 |
- 184 |
- - |
- |
- |
- 94.9 % |
- 39 |
- 37 |
-
-
-
-
-
-
-
-
-
-
diff --git a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/index-sort-f.html b/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/index-sort-f.html
deleted file mode 100644
index 33c1c9f7..00000000
--- a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/index-sort-f.html
+++ /dev/null
@@ -1,169 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - core/contracts/protocol/pool/src/core/contracts/protocol/pool
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
|
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../glass.png) |
-
-
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
-
-
- PoolConfigurator.sol |
-
-
- |
- 96.8 % |
- 190 |
- 184 |
- - |
- |
- |
- 94.9 % |
- 39 |
- 37 |
-
-
- Pool.sol |
-
-
- |
- 99.1 % |
- 108 |
- 107 |
- - |
- |
- |
- 98.4 % |
- 61 |
- 60 |
-
-
- L2Pool.sol |
-
-
- |
- 100.0 % |
- 24 |
- 24 |
- - |
- |
- |
- 100.0 % |
- 11 |
- 11 |
-
-
- DefaultReserveInterestRateStrategyV2.sol |
-
-
- |
- 100.0 % |
- 43 |
- 43 |
- - |
- |
- |
- 100.0 % |
- 13 |
- 13 |
-
-
-
-
-
-
-
-
-
-
diff --git a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/index-sort-l.html b/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/index-sort-l.html
deleted file mode 100644
index cb465de1..00000000
--- a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/index-sort-l.html
+++ /dev/null
@@ -1,169 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - core/contracts/protocol/pool/src/core/contracts/protocol/pool
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
|
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../glass.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../updown.png) |
-
-
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
-
-
- PoolConfigurator.sol |
-
-
- |
- 96.8 % |
- 190 |
- 184 |
- - |
- |
- |
- 94.9 % |
- 39 |
- 37 |
-
-
- Pool.sol |
-
-
- |
- 99.1 % |
- 108 |
- 107 |
- - |
- |
- |
- 98.4 % |
- 61 |
- 60 |
-
-
- L2Pool.sol |
-
-
- |
- 100.0 % |
- 24 |
- 24 |
- - |
- |
- |
- 100.0 % |
- 11 |
- 11 |
-
-
- DefaultReserveInterestRateStrategyV2.sol |
-
-
- |
- 100.0 % |
- 43 |
- 43 |
- - |
- |
- |
- 100.0 % |
- 13 |
- 13 |
-
-
-
-
-
-
-
-
-
-
diff --git a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/index.html b/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/index.html
deleted file mode 100644
index 01f7d7cf..00000000
--- a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/index.html
+++ /dev/null
@@ -1,169 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - core/contracts/protocol/pool/src/core/contracts/protocol/pool
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
|
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../glass.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../updown.png) |
-
-
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
-
-
- DefaultReserveInterestRateStrategyV2.sol |
-
-
- |
- 100.0 % |
- 43 |
- 43 |
- - |
- |
- |
- 100.0 % |
- 13 |
- 13 |
-
-
- L2Pool.sol |
-
-
- |
- 100.0 % |
- 24 |
- 24 |
- - |
- |
- |
- 100.0 % |
- 11 |
- 11 |
-
-
- Pool.sol |
-
-
- |
- 99.1 % |
- 108 |
- 107 |
- - |
- |
- |
- 98.4 % |
- 61 |
- 60 |
-
-
- PoolConfigurator.sol |
-
-
- |
- 96.8 % |
- 190 |
- 184 |
- - |
- |
- |
- 94.9 % |
- 39 |
- 37 |
-
-
-
-
-
-
-
-
-
-
diff --git a/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/StableDebtToken.sol.func-c.html b/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/StableDebtToken.sol.func-c.html
deleted file mode 100644
index 9132f3db..00000000
--- a/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/StableDebtToken.sol.func-c.html
+++ /dev/null
@@ -1,217 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/StableDebtToken.sol - functions
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
-
-
-
-
diff --git a/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/StableDebtToken.sol.func.html b/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/StableDebtToken.sol.func.html
deleted file mode 100644
index 4db63dd8..00000000
--- a/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/StableDebtToken.sol.func.html
+++ /dev/null
@@ -1,217 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/StableDebtToken.sol - functions
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
-
-
-
-
diff --git a/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/StableDebtToken.sol.gcov.html b/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/StableDebtToken.sol.gcov.html
deleted file mode 100644
index b19a9048..00000000
--- a/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/StableDebtToken.sol.gcov.html
+++ /dev/null
@@ -1,226 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/StableDebtToken.sol
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
|
-
-
-
- Branch data Line data Source code
-
- 1 : : // SPDX-License-Identifier: BUSL-1.1
- 2 : : pragma solidity ^0.8.10;
- 3 : :
- 4 : : import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
- 5 : : import {VersionedInitializable} from '../libraries/aave-upgradeability/VersionedInitializable.sol';
- 6 : : import {Errors} from '../libraries/helpers/Errors.sol';
- 7 : : import {IAaveIncentivesController} from '../../interfaces/IAaveIncentivesController.sol';
- 8 : : import {IInitializableDebtToken} from '../../interfaces/IInitializableDebtToken.sol';
- 9 : : import {IStableDebtToken} from '../../interfaces/IStableDebtToken.sol';
- 10 : : import {IPool} from '../../interfaces/IPool.sol';
- 11 : : import {EIP712Base} from './base/EIP712Base.sol';
- 12 : : import {DebtTokenBase} from './base/DebtTokenBase.sol';
- 13 : : import {IncentivizedERC20} from './base/IncentivizedERC20.sol';
- 14 : :
- 15 : : /**
- 16 : : * @title StableDebtToken
- 17 : : * @author Aave
- 18 : : * @notice Implements a stable debt token to track the borrowing positions of users
- 19 : : * at stable rate mode
- 20 : : * @dev Transfer and approve functionalities are disabled since its a non-transferable token
- 21 : : */
- 22 : : abstract contract StableDebtToken is DebtTokenBase, IncentivizedERC20, IStableDebtToken {
- 23 : : /**
- 24 : : * @dev Constructor.
- 25 : : * @param pool The address of the Pool contract
- 26 : : */
- 27 : : constructor(
- 28 : : IPool pool
- 29 : : ) DebtTokenBase() IncentivizedERC20(pool, 'STABLE_DEBT_TOKEN_IMPL', 'STABLE_DEBT_TOKEN_IMPL', 0) {
- 30 : : // Intentionally left blank
- 31 : : }
- 32 : :
- 33 : : /// @inheritdoc IInitializableDebtToken
- 34 : : function initialize(
- 35 : : IPool initializingPool,
- 36 : : address underlyingAsset,
- 37 : : IAaveIncentivesController incentivesController,
- 38 : : uint8 debtTokenDecimals,
- 39 : : string memory debtTokenName,
- 40 : : string memory debtTokenSymbol,
- 41 : : bytes calldata params
- 42 : : ) external virtual;
- 43 : :
- 44 : : /// @inheritdoc IStableDebtToken
- 45 : 8 : function getAverageStableRate() external pure virtual override returns (uint256) {
- 46 : 0 : return 0;
- 47 : : }
- 48 : :
- 49 : : /// @inheritdoc IStableDebtToken
- 50 : 4023 : function getUserLastUpdated(address) external pure virtual override returns (uint40) {
- 51 : 0 : return 0;
- 52 : : }
- 53 : :
- 54 : : /// @inheritdoc IStableDebtToken
- 55 : 4023 : function getUserStableRate(address) external pure virtual override returns (uint256) {
- 56 : 0 : return 0;
- 57 : : }
- 58 : :
- 59 : : /// @inheritdoc IERC20
- 60 : 34689 : function balanceOf(address) public pure virtual override returns (uint256) {
- 61 : 0 : return 0;
- 62 : : }
- 63 : :
- 64 : : /// @inheritdoc IStableDebtToken
- 65 : 7 : function mint(
- 66 : : address,
- 67 : : address,
- 68 : : uint256,
- 69 : : uint256
- 70 : : ) external virtual override onlyPool returns (bool, uint256, uint256) {
- 71 : 14 : revert(Errors.OPERATION_NOT_SUPPORTED);
- 72 : : }
- 73 : :
- 74 : : /// @inheritdoc IStableDebtToken
- 75 : 3 : function burn(address, uint256) external virtual override onlyPool returns (uint256, uint256) {
- 76 : 6 : revert(Errors.OPERATION_NOT_SUPPORTED);
- 77 : : }
- 78 : :
- 79 : : /// @inheritdoc IStableDebtToken
- 80 : 51684 : function getSupplyData() external pure override returns (uint256, uint256, uint256, uint40) {
- 81 : 103368 : return (0, 0, 0, 0);
- 82 : : }
- 83 : :
- 84 : : /// @inheritdoc IStableDebtToken
- 85 : 1 : function getTotalSupplyAndAvgRate() external pure override returns (uint256, uint256) {
- 86 : 2 : return (0, 0);
- 87 : : }
- 88 : :
- 89 : : /// @inheritdoc IERC20
- 90 : 17 : function totalSupply() public pure virtual override returns (uint256) {
- 91 : 0 : return 0;
- 92 : : }
- 93 : :
- 94 : : /// @inheritdoc IStableDebtToken
- 95 : 1 : function getTotalSupplyLastUpdated() external pure override returns (uint40) {
- 96 : 0 : return 0;
- 97 : : }
- 98 : :
- 99 : : /// @inheritdoc IStableDebtToken
- 100 : 4024 : function principalBalanceOf(address) external pure virtual override returns (uint256) {
- 101 : 0 : return 0;
- 102 : : }
- 103 : :
- 104 : : /// @inheritdoc IStableDebtToken
- 105 : 1016 : function UNDERLYING_ASSET_ADDRESS() external view override returns (address) {
- 106 : 2032 : return _underlyingAsset;
- 107 : : }
- 108 : :
- 109 : : /// @inheritdoc EIP712Base
- 110 : 3474 : function _EIP712BaseId() internal view override returns (string memory) {
- 111 : 10422 : return name();
- 112 : : }
- 113 : :
- 114 : : /**
- 115 : : * @dev Being non transferrable, the debt token does not implement any of the
- 116 : : * standard ERC20 functions for transfer and allowance.
- 117 : : */
- 118 : 1 : function transfer(address, uint256) external virtual override returns (bool) {
- 119 : 2 : revert(Errors.OPERATION_NOT_SUPPORTED);
- 120 : : }
- 121 : :
- 122 : 1 : function allowance(address, address) external view virtual override returns (uint256) {
- 123 : 2 : revert(Errors.OPERATION_NOT_SUPPORTED);
- 124 : : }
- 125 : :
- 126 : 1 : function approve(address, uint256) external virtual override returns (bool) {
- 127 : 2 : revert(Errors.OPERATION_NOT_SUPPORTED);
- 128 : : }
- 129 : :
- 130 : 1 : function transferFrom(address, address, uint256) external virtual override returns (bool) {
- 131 : 2 : revert(Errors.OPERATION_NOT_SUPPORTED);
- 132 : : }
- 133 : :
- 134 : 1 : function increaseAllowance(address, uint256) external virtual override returns (bool) {
- 135 : 2 : revert(Errors.OPERATION_NOT_SUPPORTED);
- 136 : : }
- 137 : :
- 138 : 1 : function decreaseAllowance(address, uint256) external virtual override returns (bool) {
- 139 : 2 : revert(Errors.OPERATION_NOT_SUPPORTED);
- 140 : : }
- 141 : : }
-
- |
-
-
-
-
-
-
-
-
-
diff --git a/report/core/instances/src/core/instances/StableDebtTokenInstance.sol.gcov.html b/report/core/instances/src/core/instances/StableDebtTokenInstance.sol.gcov.html
deleted file mode 100644
index f4dc8848..00000000
--- a/report/core/instances/src/core/instances/StableDebtTokenInstance.sol.gcov.html
+++ /dev/null
@@ -1,131 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - core/instances/src/core/instances/StableDebtTokenInstance.sol
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../glass.png) |
-
-
-
-
-
|
-
-
-
- Branch data Line data Source code
-
- 1 : : // SPDX-License-Identifier: MIT
- 2 : : pragma solidity ^0.8.0;
- 3 : :
- 4 : : import {StableDebtToken, IPool, IInitializableDebtToken, VersionedInitializable, IAaveIncentivesController, Errors} from '../contracts/protocol/tokenization/StableDebtToken.sol';
- 5 : :
- 6 : : contract StableDebtTokenInstance is StableDebtToken {
- 7 : : uint256 public constant DEBT_TOKEN_REVISION = 1;
- 8 : :
- 9 : : constructor(IPool pool) StableDebtToken(pool) {}
- 10 : :
- 11 : : /// @inheritdoc VersionedInitializable
- 12 : 0 : function getRevision() internal pure virtual override returns (uint256) {
- 13 : 0 : return DEBT_TOKEN_REVISION;
- 14 : : }
- 15 : :
- 16 : : /// @inheritdoc IInitializableDebtToken
- 17 : 3476 : function initialize(
- 18 : : IPool initializingPool,
- 19 : : address underlyingAsset,
- 20 : : IAaveIncentivesController incentivesController,
- 21 : : uint8 debtTokenDecimals,
- 22 : : string memory debtTokenName,
- 23 : : string memory debtTokenSymbol,
- 24 : : bytes calldata params
- 25 : : ) external override initializer {
- 26 : 6950 : require(initializingPool == POOL, Errors.POOL_ADDRESSES_DO_NOT_MATCH);
- 27 : 6948 : _setName(debtTokenName);
- 28 : 6948 : _setSymbol(debtTokenSymbol);
- 29 : 6948 : _setDecimals(debtTokenDecimals);
- 30 : :
- 31 : 6948 : _underlyingAsset = underlyingAsset;
- 32 : 6948 : _incentivesController = incentivesController;
- 33 : :
- 34 : 6948 : _domainSeparator = _calculateDomainSeparator();
- 35 : :
- 36 : 6948 : emit Initialized(
- 37 : : underlyingAsset,
- 38 : : address(POOL),
- 39 : : address(incentivesController),
- 40 : : debtTokenDecimals,
- 41 : : debtTokenName,
- 42 : : debtTokenSymbol,
- 43 : : params
- 44 : : );
- 45 : : }
- 46 : : }
-
- |
-
-
-
-
-
-
-
-
-
diff --git a/report/coverage.svg b/report/coverage.svg
deleted file mode 100644
index 238f1ed5..00000000
--- a/report/coverage.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/AaveParaSwapFeeClaimer.sol.func-c.html b/report/extensions/paraswap-adapters/AaveParaSwapFeeClaimer.sol.func-c.html
similarity index 65%
rename from report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/AaveParaSwapFeeClaimer.sol.func-c.html
rename to report/extensions/paraswap-adapters/AaveParaSwapFeeClaimer.sol.func-c.html
index e6bcdf57..4984f5b9 100644
--- a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/AaveParaSwapFeeClaimer.sol.func-c.html
+++ b/report/extensions/paraswap-adapters/AaveParaSwapFeeClaimer.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/AaveParaSwapFeeClaimer.sol - functions
-
+ LCOV - lcov.info.p - extensions/paraswap-adapters/AaveParaSwapFeeClaimer.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,17 +31,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
@@ -53,21 +53,28 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../updown.png) |
+
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../glass.png) |
+
+
+
+
+ AaveParaSwapFeeClaimer. |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../glass.png) |
+ 0 |
@@ -103,8 +110,8 @@
diff --git a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/AaveParaSwapFeeClaimer.sol.func.html b/report/extensions/paraswap-adapters/AaveParaSwapFeeClaimer.sol.func.html
similarity index 64%
rename from report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/AaveParaSwapFeeClaimer.sol.func.html
rename to report/extensions/paraswap-adapters/AaveParaSwapFeeClaimer.sol.func.html
index 57faaedc..3e9f0163 100644
--- a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/AaveParaSwapFeeClaimer.sol.func.html
+++ b/report/extensions/paraswap-adapters/AaveParaSwapFeeClaimer.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/AaveParaSwapFeeClaimer.sol - functions
-
+ LCOV - lcov.info.p - extensions/paraswap-adapters/AaveParaSwapFeeClaimer.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,17 +31,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
@@ -53,21 +53,28 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../glass.png) |
+
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../updown.png) |
+
+
+
+
+ AaveParaSwapFeeClaimer. |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../updown.png) |
+ 0 |
@@ -103,8 +110,8 @@
diff --git a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/AaveParaSwapFeeClaimer.sol.gcov.html b/report/extensions/paraswap-adapters/AaveParaSwapFeeClaimer.sol.gcov.html
similarity index 76%
rename from report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/AaveParaSwapFeeClaimer.sol.gcov.html
rename to report/extensions/paraswap-adapters/AaveParaSwapFeeClaimer.sol.gcov.html
index ff9ddb78..ff368042 100644
--- a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/AaveParaSwapFeeClaimer.sol.gcov.html
+++ b/report/extensions/paraswap-adapters/AaveParaSwapFeeClaimer.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/AaveParaSwapFeeClaimer.sol
-
+ LCOV - lcov.info.p - extensions/paraswap-adapters/AaveParaSwapFeeClaimer.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,17 +31,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -74,7 +74,7 @@
3 : : pragma solidity ^0.8.0;
4 : :
5 : : import {IFeeClaimer} from './interfaces/IFeeClaimer.sol';
- 6 : : import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
+ 6 : : import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
7 : :
8 : : /**
9 : : * @title AaveParaSwapFeeClaimer
@@ -87,26 +87,26 @@
16 : : IFeeClaimer public immutable paraswapFeeClaimer;
17 : :
18 : : constructor(address _aaveCollector, IFeeClaimer _paraswapFeeClaimer) {
- 19 : : require(address(_paraswapFeeClaimer) != address(0), 'PARASWAP_FEE_CLAIMER_REQUIRED');
- 20 : : require(_aaveCollector != address(0), 'COLLECTOR_REQUIRED');
- 21 : : aaveCollector = _aaveCollector;
- 22 : : paraswapFeeClaimer = _paraswapFeeClaimer;
+ 19 : 0 : require(address(_paraswapFeeClaimer) != address(0), 'PARASWAP_FEE_CLAIMER_REQUIRED');
+ 20 : 0 : require(_aaveCollector != address(0), 'COLLECTOR_REQUIRED');
+ 21 : 0 : aaveCollector = _aaveCollector;
+ 22 : 0 : paraswapFeeClaimer = _paraswapFeeClaimer;
23 : : }
24 : :
25 : : /**
26 : : * @dev returns claimable balance for a specified asset
27 : : * @param asset The asset to fetch claimable balance of
28 : : */
- 29 : 5 : function getClaimable(address asset) public view returns (uint256) {
- 30 : 15 : return paraswapFeeClaimer.getBalance(IERC20(asset), address(this));
+ 29 : : function getClaimable(address asset) external view returns (uint256) {
+ 30 : 5 : return paraswapFeeClaimer.getBalance(IERC20(asset), address(this));
31 : : }
32 : :
33 : : /**
34 : : * @dev returns claimable balances for specified assets
35 : : * @param assets The assets to fetch claimable balances of
36 : : */
- 37 : 1 : function batchGetClaimable(address[] memory assets) public view returns (uint256[] memory) {
- 38 : 3 : return paraswapFeeClaimer.batchGetBalance(assets, address(this));
+ 37 : : function batchGetClaimable(address[] memory assets) external view returns (uint256[] memory) {
+ 38 : 1 : return paraswapFeeClaimer.batchGetBalance(assets, address(this));
39 : : }
40 : :
41 : : /**
@@ -114,8 +114,8 @@
43 : : * @notice will revert when there's nothing to claim
44 : : * @param asset The asset to claim rewards of
45 : : */
- 46 : 1 : function claimToCollector(IERC20 asset) external {
- 47 : 2 : paraswapFeeClaimer.withdrawAllERC20(asset, aaveCollector);
+ 46 : : function claimToCollector(IERC20 asset) external {
+ 47 : 1 : paraswapFeeClaimer.withdrawAllERC20(asset, aaveCollector);
48 : : }
49 : :
50 : : /**
@@ -123,8 +123,8 @@
52 : : * @notice will revert when there's nothing to claim on a single supplied asset
53 : : * @param assets The assets to claim rewards of
54 : : */
- 55 : 1 : function batchClaimToCollector(address[] memory assets) external {
- 56 : 2 : paraswapFeeClaimer.batchWithdrawAllERC20(assets, aaveCollector);
+ 55 : : function batchClaimToCollector(address[] memory assets) external {
+ 56 : 1 : paraswapFeeClaimer.batchWithdrawAllERC20(assets, aaveCollector);
57 : : }
58 : : }
@@ -134,8 +134,8 @@
diff --git a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapAdapter.sol.func-c.html b/report/extensions/paraswap-adapters/BaseParaSwapAdapter.sol.func-c.html
similarity index 66%
rename from report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapAdapter.sol.func-c.html
rename to report/extensions/paraswap-adapters/BaseParaSwapAdapter.sol.func-c.html
index dcbd91b9..84c9b528 100644
--- a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapAdapter.sol.func-c.html
+++ b/report/extensions/paraswap-adapters/BaseParaSwapAdapter.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapAdapter.sol - functions
-
+ LCOV - lcov.info.p - extensions/paraswap-adapters/BaseParaSwapAdapter.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,17 +31,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
@@ -53,21 +53,28 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../updown.png) |
+
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../glass.png) |
+
+
+
+
+ BaseParaSwapAdapter. |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../glass.png) |
+ 0 |
@@ -110,8 +117,8 @@
diff --git a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapAdapter.sol.func.html b/report/extensions/paraswap-adapters/BaseParaSwapAdapter.sol.func.html
similarity index 66%
rename from report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapAdapter.sol.func.html
rename to report/extensions/paraswap-adapters/BaseParaSwapAdapter.sol.func.html
index c3716a1f..f53ebc8b 100644
--- a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapAdapter.sol.func.html
+++ b/report/extensions/paraswap-adapters/BaseParaSwapAdapter.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapAdapter.sol - functions
-
+ LCOV - lcov.info.p - extensions/paraswap-adapters/BaseParaSwapAdapter.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,17 +31,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
@@ -53,21 +53,28 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../glass.png) |
+
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../updown.png) |
+
+
+
+
+ BaseParaSwapAdapter. |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../updown.png) |
+ 0 |
@@ -110,8 +117,8 @@
diff --git a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapAdapter.sol.gcov.html b/report/extensions/paraswap-adapters/BaseParaSwapAdapter.sol.gcov.html
similarity index 81%
rename from report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapAdapter.sol.gcov.html
rename to report/extensions/paraswap-adapters/BaseParaSwapAdapter.sol.gcov.html
index a3f06783..50495699 100644
--- a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapAdapter.sol.gcov.html
+++ b/report/extensions/paraswap-adapters/BaseParaSwapAdapter.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapAdapter.sol
-
+ LCOV - lcov.info.p - extensions/paraswap-adapters/BaseParaSwapAdapter.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,17 +31,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -72,16 +72,16 @@
1 : : // SPDX-License-Identifier: BUSL-1.1
2 : : pragma solidity ^0.8.10;
3 : :
- 4 : : import {DataTypes} from 'aave-v3-core/contracts/protocol/libraries/types/DataTypes.sol';
- 5 : : import {FlashLoanSimpleReceiverBase} from 'aave-v3-core/contracts/flashloan/base/FlashLoanSimpleReceiverBase.sol';
- 6 : : import {GPv2SafeERC20} from 'aave-v3-core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol';
- 7 : : import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
- 8 : : import {IERC20Detailed} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol';
- 9 : : import {IERC20WithPermit} from 'aave-v3-core/contracts/interfaces/IERC20WithPermit.sol';
- 10 : : import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
- 11 : : import {IPriceOracleGetter} from 'aave-v3-core/contracts/interfaces/IPriceOracleGetter.sol';
- 12 : : import {SafeMath} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/SafeMath.sol';
- 13 : : import {Ownable} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/Ownable.sol';
+ 4 : : import {DataTypes} from '../../protocol/libraries/types/DataTypes.sol';
+ 5 : : import {FlashLoanSimpleReceiverBase} from '../../misc/flashloan/base/FlashLoanSimpleReceiverBase.sol';
+ 6 : : import {GPv2SafeERC20} from '../../dependencies/gnosis/contracts/GPv2SafeERC20.sol';
+ 7 : : import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
+ 8 : : import {IERC20Detailed} from '../../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
+ 9 : : import {IERC20WithPermit} from '../../interfaces/IERC20WithPermit.sol';
+ 10 : : import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
+ 11 : : import {IPriceOracleGetter} from '../../interfaces/IPriceOracleGetter.sol';
+ 12 : : import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol';
+ 13 : : import {Ownable} from '../../dependencies/openzeppelin/contracts/Ownable.sol';
14 : :
15 : : /**
16 : : * @title BaseParaSwapAdapter
@@ -123,7 +123,7 @@
52 : : constructor(
53 : : IPoolAddressesProvider addressesProvider
54 : : ) FlashLoanSimpleReceiverBase(addressesProvider) {
- 55 : : ORACLE = IPriceOracleGetter(addressesProvider.getPriceOracle());
+ 55 : 0 : ORACLE = IPriceOracleGetter(addressesProvider.getPriceOracle());
56 : : }
57 : :
58 : : /**
@@ -131,41 +131,41 @@
60 : : * @param asset address
61 : : * @return eth price for the asset
62 : : */
- 63 : 30 : function _getPrice(address asset) internal view returns (uint256) {
- 64 : 90 : return ORACLE.getAssetPrice(asset);
+ 63 : : function _getPrice(address asset) internal view returns (uint256) {
+ 64 : 30 : return ORACLE.getAssetPrice(asset);
65 : : }
66 : :
67 : : /**
68 : : * @dev Get the decimals of an asset
69 : : * @return number of decimals of the asset
70 : : */
- 71 : 30 : function _getDecimals(IERC20Detailed asset) internal view returns (uint8) {
- 72 : 90 : uint8 decimals = asset.decimals();
+ 71 : : function _getDecimals(IERC20Detailed asset) internal view returns (uint8) {
+ 72 : 30 : uint8 decimals = asset.decimals();
73 : : // Ensure 10**decimals won't overflow a uint256
- 74 : 60 : require(decimals <= 77, 'TOO_MANY_DECIMALS_ON_TOKEN');
- 75 : 60 : return decimals;
+ 74 : 30 : require(decimals <= 77, 'TOO_MANY_DECIMALS_ON_TOKEN');
+ 75 : 30 : return decimals;
76 : : }
77 : :
78 : : /**
79 : : * @dev Get the aToken associated to the asset
80 : : * @return address of the aToken
81 : : */
- 82 : 21 : function _getReserveData(
+ 82 : : function _getReserveData(
83 : : address asset
84 : : ) internal view returns (DataTypes.ReserveDataLegacy memory) {
- 85 : 63 : return POOL.getReserveData(asset);
+ 85 : 21 : return POOL.getReserveData(asset);
86 : : }
87 : :
- 88 : 20 : function _pullATokenAndWithdraw(
+ 88 : : function _pullATokenAndWithdraw(
89 : : address reserve,
90 : : address user,
91 : : uint256 amount,
92 : : PermitSignature memory permitSignature
93 : : ) internal {
- 94 : 18 : IERC20WithPermit reserveAToken = IERC20WithPermit(
+ 94 : 6 : IERC20WithPermit reserveAToken = IERC20WithPermit(
95 : : _getReserveData(address(reserve)).aTokenAddress
96 : : );
- 97 : 12 : _pullATokenAndWithdraw(reserve, reserveAToken, user, amount, permitSignature);
+ 97 : 6 : _pullATokenAndWithdraw(reserve, reserveAToken, user, amount, permitSignature);
98 : : }
99 : :
100 : : /**
@@ -184,8 +184,8 @@
113 : : PermitSignature memory permitSignature
114 : : ) internal {
115 : : // If deadline is set to zero, assume there is no signature for permit
- 116 : 28 : if (permitSignature.deadline != 0) {
- 117 : 10 : reserveAToken.permit(
+ 116 : 14 : if (permitSignature.deadline != 0) {
+ 117 : 5 : reserveAToken.permit(
118 : : user,
119 : : address(this),
120 : : permitSignature.amount,
@@ -197,10 +197,10 @@
126 : : }
127 : :
128 : : // transfer from user to adapter
- 129 : 28 : reserveAToken.safeTransferFrom(user, address(this), amount);
+ 129 : 14 : reserveAToken.safeTransferFrom(user, address(this), amount);
130 : :
131 : : // withdraw reserve
- 132 : 28 : require(POOL.withdraw(reserve, amount, address(this)) == amount, 'UNEXPECTED_AMOUNT_WITHDRAWN');
+ 132 : 14 : require(POOL.withdraw(reserve, amount, address(this)) == amount, 'UNEXPECTED_AMOUNT_WITHDRAWN');
133 : : }
134 : :
135 : : /**
@@ -208,8 +208,8 @@
137 : : * - Funds should never remain in this contract more time than during transactions
138 : : * - Only callable by the owner
139 : : */
- 140 : 1 : function rescueTokens(IERC20 token) external onlyOwner {
- 141 : 2 : token.safeTransfer(owner(), token.balanceOf(address(this)));
+ 140 : : function rescueTokens(IERC20 token) external onlyOwner {
+ 141 : 1 : token.safeTransfer(owner(), token.balanceOf(address(this)));
142 : : }
143 : : }
@@ -219,8 +219,8 @@
diff --git a/report/core/instances/src/core/instances/VariableDebtTokenInstance.sol.func-c.html b/report/extensions/paraswap-adapters/BaseParaSwapBuyAdapter.sol.func-c.html
similarity index 59%
rename from report/core/instances/src/core/instances/VariableDebtTokenInstance.sol.func-c.html
rename to report/extensions/paraswap-adapters/BaseParaSwapBuyAdapter.sol.func-c.html
index 34e84f9b..af5a5341 100644
--- a/report/core/instances/src/core/instances/VariableDebtTokenInstance.sol.func-c.html
+++ b/report/extensions/paraswap-adapters/BaseParaSwapBuyAdapter.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/instances/src/core/instances/VariableDebtTokenInstance.sol - functions
-
+ LCOV - lcov.info.p - extensions/paraswap-adapters/BaseParaSwapBuyAdapter.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,13 +31,13 @@
|
-
-
-
+
+
+
-
+
|
@@ -53,35 +53,35 @@
- ![](../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../glass.png) |
- VariableDebtTokenInstance.getRevision |
+ BaseParaSwapBuyAdapter. |
0 |
- VariableDebtTokenInstance.initialize |
+ BaseParaSwapBuyAdapter._buyOnParaSwap |
- 3478 |
+ 6 |
@@ -89,8 +89,8 @@
diff --git a/report/core/instances/src/core/instances/StableDebtTokenInstance.sol.func.html b/report/extensions/paraswap-adapters/BaseParaSwapBuyAdapter.sol.func.html
similarity index 59%
rename from report/core/instances/src/core/instances/StableDebtTokenInstance.sol.func.html
rename to report/extensions/paraswap-adapters/BaseParaSwapBuyAdapter.sol.func.html
index b9085eeb..310f2da3 100644
--- a/report/core/instances/src/core/instances/StableDebtTokenInstance.sol.func.html
+++ b/report/extensions/paraswap-adapters/BaseParaSwapBuyAdapter.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/instances/src/core/instances/StableDebtTokenInstance.sol - functions
-
+ LCOV - lcov.info.p - extensions/paraswap-adapters/BaseParaSwapBuyAdapter.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,13 +31,13 @@
|
-
-
-
+
+
+
-
+
|
@@ -53,35 +53,35 @@
- ![](../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../updown.png) |
- StableDebtTokenInstance.getRevision |
+ BaseParaSwapBuyAdapter. |
0 |
- StableDebtTokenInstance.initialize |
+ BaseParaSwapBuyAdapter._buyOnParaSwap |
- 3476 |
+ 6 |
@@ -89,8 +89,8 @@
diff --git a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapBuyAdapter.sol.gcov.html b/report/extensions/paraswap-adapters/BaseParaSwapBuyAdapter.sol.gcov.html
similarity index 75%
rename from report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapBuyAdapter.sol.gcov.html
rename to report/extensions/paraswap-adapters/BaseParaSwapBuyAdapter.sol.gcov.html
index 221a762a..5500645a 100644
--- a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapBuyAdapter.sol.gcov.html
+++ b/report/extensions/paraswap-adapters/BaseParaSwapBuyAdapter.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapBuyAdapter.sol
-
+ LCOV - lcov.info.p - extensions/paraswap-adapters/BaseParaSwapBuyAdapter.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,17 +31,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -72,11 +72,11 @@
1 : : // SPDX-License-Identifier: BUSL-1.1
2 : : pragma solidity ^0.8.10;
3 : :
- 4 : : import {SafeERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/SafeERC20.sol';
- 5 : : import {SafeMath} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/SafeMath.sol';
- 6 : : import {PercentageMath} from 'aave-v3-core/contracts/protocol/libraries/math/PercentageMath.sol';
- 7 : : import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
- 8 : : import {IERC20Detailed} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol';
+ 4 : : import {SafeERC20} from '../../dependencies/openzeppelin/contracts/SafeERC20.sol';
+ 5 : : import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol';
+ 6 : : import {PercentageMath} from '../../protocol/libraries/math/PercentageMath.sol';
+ 7 : : import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
+ 8 : : import {IERC20Detailed} from '../../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
9 : : import {IParaSwapAugustus} from './interfaces/IParaSwapAugustus.sol';
10 : : import {IParaSwapAugustusRegistry} from './interfaces/IParaSwapAugustusRegistry.sol';
11 : : import {BaseParaSwapAdapter} from './BaseParaSwapAdapter.sol';
@@ -97,8 +97,8 @@
26 : : IParaSwapAugustusRegistry augustusRegistry
27 : : ) BaseParaSwapAdapter(addressesProvider) {
28 : : // Do something on Augustus registry to check the right contract was passed
- 29 : : require(!augustusRegistry.isValidAugustus(address(0)), 'Not a valid Augustus address');
- 30 : : AUGUSTUS_REGISTRY = augustusRegistry;
+ 29 : 0 : require(!augustusRegistry.isValidAugustus(address(0)), 'Not a valid Augustus address');
+ 30 : 0 : AUGUSTUS_REGISTRY = augustusRegistry;
31 : : }
32 : :
33 : : /**
@@ -110,49 +110,49 @@
39 : : * @param maxAmountToSwap Max amount to be swapped
40 : : * @param amountToReceive Amount to be received from the swap
41 : : * @return amountSold The amount sold during the swap
- 42 : : */
- 43 : 6 : function _buyOnParaSwap(
- 44 : : uint256 toAmountOffset,
- 45 : : bytes memory paraswapData,
- 46 : : IERC20Detailed assetToSwapFrom,
- 47 : : IERC20Detailed assetToSwapTo,
- 48 : : uint256 maxAmountToSwap,
- 49 : : uint256 amountToReceive
- 50 : : ) internal returns (uint256 amountSold) {
- 51 : 18 : (bytes memory buyCalldata, IParaSwapAugustus augustus) = abi.decode(
- 52 : : paraswapData,
- 53 : : (bytes, IParaSwapAugustus)
- 54 : : );
- 55 : :
- 56 : 12 : require(AUGUSTUS_REGISTRY.isValidAugustus(address(augustus)), 'INVALID_AUGUSTUS');
- 57 : :
- 58 : : {
- 59 : 18 : uint256 fromAssetDecimals = _getDecimals(assetToSwapFrom);
- 60 : 18 : uint256 toAssetDecimals = _getDecimals(assetToSwapTo);
- 61 : :
- 62 : 18 : uint256 fromAssetPrice = _getPrice(address(assetToSwapFrom));
- 63 : 18 : uint256 toAssetPrice = _getPrice(address(assetToSwapTo));
- 64 : :
- 65 : 18 : uint256 expectedMaxAmountToSwap = amountToReceive
- 66 : : .mul(toAssetPrice.mul(10 ** fromAssetDecimals))
- 67 : : .div(fromAssetPrice.mul(10 ** toAssetDecimals))
- 68 : : .percentMul(PercentageMath.PERCENTAGE_FACTOR.add(MAX_SLIPPAGE_PERCENT));
- 69 : :
- 70 : 12 : require(maxAmountToSwap <= expectedMaxAmountToSwap, 'maxAmountToSwap exceed max slippage');
- 71 : : }
- 72 : :
- 73 : 18 : uint256 balanceBeforeAssetFrom = assetToSwapFrom.balanceOf(address(this));
- 74 : 12 : require(balanceBeforeAssetFrom >= maxAmountToSwap, 'INSUFFICIENT_BALANCE_BEFORE_SWAP');
- 75 : 18 : uint256 balanceBeforeAssetTo = assetToSwapTo.balanceOf(address(this));
- 76 : :
- 77 : 18 : address tokenTransferProxy = augustus.getTokenTransferProxy();
- 78 : 12 : assetToSwapFrom.safeApprove(tokenTransferProxy, 0);
- 79 : 12 : assetToSwapFrom.safeApprove(tokenTransferProxy, maxAmountToSwap);
+ 42 : : * @return amountBought The amount bought during the swap
+ 43 : : */
+ 44 : : function _buyOnParaSwap(
+ 45 : : uint256 toAmountOffset,
+ 46 : : bytes memory paraswapData,
+ 47 : : IERC20Detailed assetToSwapFrom,
+ 48 : : IERC20Detailed assetToSwapTo,
+ 49 : : uint256 maxAmountToSwap,
+ 50 : : uint256 amountToReceive
+ 51 : : ) internal returns (uint256 amountSold, uint256 amountBought) {
+ 52 : 6 : (bytes memory buyCalldata, IParaSwapAugustus augustus) = abi.decode(
+ 53 : : paraswapData,
+ 54 : : (bytes, IParaSwapAugustus)
+ 55 : : );
+ 56 : :
+ 57 : 6 : require(AUGUSTUS_REGISTRY.isValidAugustus(address(augustus)), 'INVALID_AUGUSTUS');
+ 58 : :
+ 59 : : {
+ 60 : 6 : uint256 fromAssetDecimals = _getDecimals(assetToSwapFrom);
+ 61 : 6 : uint256 toAssetDecimals = _getDecimals(assetToSwapTo);
+ 62 : :
+ 63 : 6 : uint256 fromAssetPrice = _getPrice(address(assetToSwapFrom));
+ 64 : 6 : uint256 toAssetPrice = _getPrice(address(assetToSwapTo));
+ 65 : :
+ 66 : 6 : uint256 expectedMaxAmountToSwap = amountToReceive
+ 67 : : .mul(toAssetPrice.mul(10 ** fromAssetDecimals))
+ 68 : : .div(fromAssetPrice.mul(10 ** toAssetDecimals))
+ 69 : : .percentMul(PercentageMath.PERCENTAGE_FACTOR.add(MAX_SLIPPAGE_PERCENT));
+ 70 : :
+ 71 : 6 : require(maxAmountToSwap <= expectedMaxAmountToSwap, 'maxAmountToSwap exceed max slippage');
+ 72 : : }
+ 73 : :
+ 74 : 6 : uint256 balanceBeforeAssetFrom = assetToSwapFrom.balanceOf(address(this));
+ 75 : 6 : require(balanceBeforeAssetFrom >= maxAmountToSwap, 'INSUFFICIENT_BALANCE_BEFORE_SWAP');
+ 76 : 6 : uint256 balanceBeforeAssetTo = assetToSwapTo.balanceOf(address(this));
+ 77 : :
+ 78 : 6 : address tokenTransferProxy = augustus.getTokenTransferProxy();
+ 79 : 6 : assetToSwapFrom.safeApprove(tokenTransferProxy, maxAmountToSwap);
80 : :
- 81 : 12 : if (toAmountOffset != 0) {
+ 81 : 6 : if (toAmountOffset != 0) {
82 : : // Ensure 256 bit (32 bytes) toAmountOffset value is within bounds of the
83 : : // calldata, not overlapping with the first 4 bytes (function selector).
- 84 : 2 : require(
+ 84 : 1 : require(
85 : : toAmountOffset >= 4 && toAmountOffset <= buyCalldata.length.sub(32),
86 : : 'TO_AMOUNT_OFFSET_OUT_OF_RANGE'
87 : : );
@@ -160,27 +160,30 @@
89 : : // In memory, buyCalldata consists of a 256 bit length field, followed by
90 : : // the actual bytes data, that is why 32 is added to the byte offset.
91 : : assembly {
- 92 : : mstore(add(buyCalldata, add(toAmountOffset, 32)), amountToReceive)
+ 92 : 0 : mstore(add(buyCalldata, add(toAmountOffset, 32)), amountToReceive)
93 : : }
94 : : }
- 95 : 15 : (bool success, ) = address(augustus).call(buyCalldata);
- 96 : 10 : if (!success) {
+ 95 : 5 : (bool success, ) = address(augustus).call(buyCalldata);
+ 96 : 5 : if (!success) {
97 : : // Copy revert reason from call
98 : : assembly {
- 99 : : returndatacopy(0, 0, returndatasize())
- 100 : : revert(0, returndatasize())
+ 99 : 0 : returndatacopy(0, 0, returndatasize())
+ 100 : 0 : revert(0, returndatasize())
101 : : }
102 : : }
103 : :
- 104 : 15 : uint256 balanceAfterAssetFrom = assetToSwapFrom.balanceOf(address(this));
- 105 : 10 : amountSold = balanceBeforeAssetFrom - balanceAfterAssetFrom;
- 106 : 10 : require(amountSold <= maxAmountToSwap, 'WRONG_BALANCE_AFTER_SWAP');
- 107 : 15 : uint256 amountReceived = assetToSwapTo.balanceOf(address(this)).sub(balanceBeforeAssetTo);
- 108 : 10 : require(amountReceived >= amountToReceive, 'INSUFFICIENT_AMOUNT_RECEIVED');
- 109 : :
- 110 : 10 : emit Bought(address(assetToSwapFrom), address(assetToSwapTo), amountSold, amountReceived);
- 111 : : }
- 112 : : }
+ 104 : : // Reset allowance
+ 105 : 5 : assetToSwapFrom.safeApprove(tokenTransferProxy, 0);
+ 106 : :
+ 107 : 5 : uint256 balanceAfterAssetFrom = assetToSwapFrom.balanceOf(address(this));
+ 108 : 5 : amountSold = balanceBeforeAssetFrom - balanceAfterAssetFrom;
+ 109 : 5 : require(amountSold <= maxAmountToSwap, 'WRONG_BALANCE_AFTER_SWAP');
+ 110 : 5 : amountBought = assetToSwapTo.balanceOf(address(this)).sub(balanceBeforeAssetTo);
+ 111 : 5 : require(amountBought >= amountToReceive, 'INSUFFICIENT_AMOUNT_RECEIVED');
+ 112 : :
+ 113 : 5 : emit Bought(address(assetToSwapFrom), address(assetToSwapTo), amountSold, amountBought);
+ 114 : : }
+ 115 : : }
@@ -188,8 +191,8 @@
diff --git a/report/core/instances/src/core/instances/StableDebtTokenInstance.sol.func-c.html b/report/extensions/paraswap-adapters/BaseParaSwapSellAdapter.sol.func-c.html
similarity index 59%
rename from report/core/instances/src/core/instances/StableDebtTokenInstance.sol.func-c.html
rename to report/extensions/paraswap-adapters/BaseParaSwapSellAdapter.sol.func-c.html
index 405abeaf..c8215b33 100644
--- a/report/core/instances/src/core/instances/StableDebtTokenInstance.sol.func-c.html
+++ b/report/extensions/paraswap-adapters/BaseParaSwapSellAdapter.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/instances/src/core/instances/StableDebtTokenInstance.sol - functions
-
+ LCOV - lcov.info.p - extensions/paraswap-adapters/BaseParaSwapSellAdapter.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,13 +31,13 @@
|
-
-
-
+
+
+
-
+
|
@@ -53,35 +53,35 @@
- ![](../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../glass.png) |
- StableDebtTokenInstance.getRevision |
+ BaseParaSwapSellAdapter. |
0 |
- StableDebtTokenInstance.initialize |
+ BaseParaSwapSellAdapter._sellOnParaSwap |
- 3476 |
+ 9 |
@@ -89,8 +89,8 @@
diff --git a/report/core/instances/src/core/instances/VariableDebtTokenInstance.sol.func.html b/report/extensions/paraswap-adapters/BaseParaSwapSellAdapter.sol.func.html
similarity index 59%
rename from report/core/instances/src/core/instances/VariableDebtTokenInstance.sol.func.html
rename to report/extensions/paraswap-adapters/BaseParaSwapSellAdapter.sol.func.html
index 2b0b5821..0c5f7eb6 100644
--- a/report/core/instances/src/core/instances/VariableDebtTokenInstance.sol.func.html
+++ b/report/extensions/paraswap-adapters/BaseParaSwapSellAdapter.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/instances/src/core/instances/VariableDebtTokenInstance.sol - functions
-
+ LCOV - lcov.info.p - extensions/paraswap-adapters/BaseParaSwapSellAdapter.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,13 +31,13 @@
|
-
-
-
+
+
+
-
+
|
@@ -53,35 +53,35 @@
- ![](../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../updown.png) |
- VariableDebtTokenInstance.getRevision |
+ BaseParaSwapSellAdapter. |
0 |
- VariableDebtTokenInstance.initialize |
+ BaseParaSwapSellAdapter._sellOnParaSwap |
- 3478 |
+ 9 |
@@ -89,8 +89,8 @@
diff --git a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapSellAdapter.sol.gcov.html b/report/extensions/paraswap-adapters/BaseParaSwapSellAdapter.sol.gcov.html
similarity index 79%
rename from report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapSellAdapter.sol.gcov.html
rename to report/extensions/paraswap-adapters/BaseParaSwapSellAdapter.sol.gcov.html
index 485592d0..98a66965 100644
--- a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapSellAdapter.sol.gcov.html
+++ b/report/extensions/paraswap-adapters/BaseParaSwapSellAdapter.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapSellAdapter.sol
-
+ LCOV - lcov.info.p - extensions/paraswap-adapters/BaseParaSwapSellAdapter.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,17 +31,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -72,11 +72,11 @@
1 : : // SPDX-License-Identifier: BUSL-1.1
2 : : pragma solidity ^0.8.10;
3 : :
- 4 : : import {SafeERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/SafeERC20.sol';
- 5 : : import {SafeMath} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/SafeMath.sol';
- 6 : : import {PercentageMath} from 'aave-v3-core/contracts/protocol/libraries/math/PercentageMath.sol';
- 7 : : import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
- 8 : : import {IERC20Detailed} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol';
+ 4 : : import {SafeERC20} from '../../dependencies/openzeppelin/contracts/SafeERC20.sol';
+ 5 : : import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol';
+ 6 : : import {PercentageMath} from '../../protocol/libraries/math/PercentageMath.sol';
+ 7 : : import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
+ 8 : : import {IERC20Detailed} from '../../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
9 : : import {IParaSwapAugustus} from './interfaces/IParaSwapAugustus.sol';
10 : : import {IParaSwapAugustusRegistry} from './interfaces/IParaSwapAugustusRegistry.sol';
11 : : import {BaseParaSwapAdapter} from './BaseParaSwapAdapter.sol';
@@ -98,8 +98,8 @@
27 : : IParaSwapAugustusRegistry augustusRegistry
28 : : ) BaseParaSwapAdapter(addressesProvider) {
29 : : // Do something on Augustus registry to check the right contract was passed
- 30 : : require(!augustusRegistry.isValidAugustus(address(0)));
- 31 : : AUGUSTUS_REGISTRY = augustusRegistry;
+ 30 : 0 : require(!augustusRegistry.isValidAugustus(address(0)));
+ 31 : 0 : AUGUSTUS_REGISTRY = augustusRegistry;
32 : : }
33 : :
34 : : /**
@@ -113,7 +113,7 @@
42 : : * @param minAmountToReceive Minimum amount to be received from the swap
43 : : * @return amountReceived The amount received from the swap
44 : : */
- 45 : 9 : function _sellOnParaSwap(
+ 45 : : function _sellOnParaSwap(
46 : : uint256 fromAmountOffset,
47 : : bytes memory swapCalldata,
48 : : IParaSwapAugustus augustus,
@@ -122,35 +122,35 @@
51 : : uint256 amountToSwap,
52 : : uint256 minAmountToReceive
53 : : ) internal returns (uint256 amountReceived) {
- 54 : 18 : require(AUGUSTUS_REGISTRY.isValidAugustus(address(augustus)), 'INVALID_AUGUSTUS');
+ 54 : 9 : require(AUGUSTUS_REGISTRY.isValidAugustus(address(augustus)), 'INVALID_AUGUSTUS');
55 : :
56 : : {
- 57 : 27 : uint256 fromAssetDecimals = _getDecimals(assetToSwapFrom);
- 58 : 27 : uint256 toAssetDecimals = _getDecimals(assetToSwapTo);
+ 57 : 9 : uint256 fromAssetDecimals = _getDecimals(assetToSwapFrom);
+ 58 : 9 : uint256 toAssetDecimals = _getDecimals(assetToSwapTo);
59 : :
- 60 : 27 : uint256 fromAssetPrice = _getPrice(address(assetToSwapFrom));
- 61 : 27 : uint256 toAssetPrice = _getPrice(address(assetToSwapTo));
+ 60 : 9 : uint256 fromAssetPrice = _getPrice(address(assetToSwapFrom));
+ 61 : 9 : uint256 toAssetPrice = _getPrice(address(assetToSwapTo));
62 : :
- 63 : 27 : uint256 expectedMinAmountOut = amountToSwap
+ 63 : 9 : uint256 expectedMinAmountOut = amountToSwap
64 : : .mul(fromAssetPrice.mul(10 ** toAssetDecimals))
65 : : .div(toAssetPrice.mul(10 ** fromAssetDecimals))
66 : : .percentMul(PercentageMath.PERCENTAGE_FACTOR - MAX_SLIPPAGE_PERCENT);
67 : :
- 68 : 18 : require(expectedMinAmountOut <= minAmountToReceive, 'MIN_AMOUNT_EXCEEDS_MAX_SLIPPAGE');
+ 68 : 9 : require(expectedMinAmountOut <= minAmountToReceive, 'MIN_AMOUNT_EXCEEDS_MAX_SLIPPAGE');
69 : : }
70 : :
- 71 : 27 : uint256 balanceBeforeAssetFrom = assetToSwapFrom.balanceOf(address(this));
- 72 : 18 : require(balanceBeforeAssetFrom >= amountToSwap, 'INSUFFICIENT_BALANCE_BEFORE_SWAP');
- 73 : 27 : uint256 balanceBeforeAssetTo = assetToSwapTo.balanceOf(address(this));
+ 71 : 9 : uint256 balanceBeforeAssetFrom = assetToSwapFrom.balanceOf(address(this));
+ 72 : 9 : require(balanceBeforeAssetFrom >= amountToSwap, 'INSUFFICIENT_BALANCE_BEFORE_SWAP');
+ 73 : 9 : uint256 balanceBeforeAssetTo = assetToSwapTo.balanceOf(address(this));
74 : :
- 75 : 27 : address tokenTransferProxy = augustus.getTokenTransferProxy();
- 76 : 18 : assetToSwapFrom.safeApprove(tokenTransferProxy, 0);
- 77 : 18 : assetToSwapFrom.safeApprove(tokenTransferProxy, amountToSwap);
+ 75 : 9 : address tokenTransferProxy = augustus.getTokenTransferProxy();
+ 76 : 9 : assetToSwapFrom.safeApprove(tokenTransferProxy, 0);
+ 77 : 9 : assetToSwapFrom.safeApprove(tokenTransferProxy, amountToSwap);
78 : :
- 79 : 18 : if (fromAmountOffset != 0) {
+ 79 : 9 : if (fromAmountOffset != 0) {
80 : : // Ensure 256 bit (32 bytes) fromAmount value is within bounds of the
81 : : // calldata, not overlapping with the first 4 bytes (function selector).
- 82 : 6 : require(
+ 82 : 3 : require(
83 : : fromAmountOffset >= 4 && fromAmountOffset <= swapCalldata.length.sub(32),
84 : : 'FROM_AMOUNT_OFFSET_OUT_OF_RANGE'
85 : : );
@@ -158,27 +158,28 @@
87 : : // In memory, swapCalldata consists of a 256 bit length field, followed by
88 : : // the actual bytes data, that is why 32 is added to the byte offset.
89 : : assembly {
- 90 : : mstore(add(swapCalldata, add(fromAmountOffset, 32)), amountToSwap)
+ 90 : 0 : mstore(add(swapCalldata, add(fromAmountOffset, 32)), amountToSwap)
91 : : }
92 : : }
- 93 : 18 : (bool success, ) = address(augustus).call(swapCalldata);
- 94 : 12 : if (!success) {
+ 93 : 6 : (bool success, ) = address(augustus).call(swapCalldata);
+ 94 : 6 : if (!success) {
95 : : // Copy revert reason from call
96 : : assembly {
- 97 : : returndatacopy(0, 0, returndatasize())
- 98 : : revert(0, returndatasize())
+ 97 : 0 : returndatacopy(0, 0, returndatasize())
+ 98 : 0 : revert(0, returndatasize())
99 : : }
100 : : }
- 101 : 12 : require(
- 102 : : assetToSwapFrom.balanceOf(address(this)) == balanceBeforeAssetFrom - amountToSwap,
- 103 : : 'WRONG_BALANCE_AFTER_SWAP'
- 104 : : );
- 105 : 12 : amountReceived = assetToSwapTo.balanceOf(address(this)).sub(balanceBeforeAssetTo);
- 106 : 12 : require(amountReceived >= minAmountToReceive, 'INSUFFICIENT_AMOUNT_RECEIVED');
- 107 : :
- 108 : 12 : emit Swapped(address(assetToSwapFrom), address(assetToSwapTo), amountToSwap, amountReceived);
- 109 : : }
- 110 : : }
+ 101 : :
+ 102 : 6 : require(
+ 103 : : assetToSwapFrom.balanceOf(address(this)) == balanceBeforeAssetFrom - amountToSwap,
+ 104 : : 'WRONG_BALANCE_AFTER_SWAP'
+ 105 : : );
+ 106 : 6 : amountReceived = assetToSwapTo.balanceOf(address(this)).sub(balanceBeforeAssetTo);
+ 107 : 6 : require(amountReceived >= minAmountToReceive, 'INSUFFICIENT_AMOUNT_RECEIVED');
+ 108 : :
+ 109 : 6 : emit Swapped(address(assetToSwapFrom), address(assetToSwapTo), amountToSwap, amountReceived);
+ 110 : : }
+ 111 : : }
@@ -186,8 +187,8 @@
diff --git a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapLiquiditySwapAdapter.sol.func-c.html b/report/extensions/paraswap-adapters/ParaSwapLiquiditySwapAdapter.sol.func-c.html
similarity index 64%
rename from report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapLiquiditySwapAdapter.sol.func-c.html
rename to report/extensions/paraswap-adapters/ParaSwapLiquiditySwapAdapter.sol.func-c.html
index 8a0f181f..399ff583 100644
--- a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapLiquiditySwapAdapter.sol.func-c.html
+++ b/report/extensions/paraswap-adapters/ParaSwapLiquiditySwapAdapter.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapLiquiditySwapAdapter.sol - functions
-
+ LCOV - lcov.info.p - extensions/paraswap-adapters/ParaSwapLiquiditySwapAdapter.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,17 +31,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
@@ -53,21 +53,28 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../updown.png) |
+
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../glass.png) |
+
+
+
+
+ ParaSwapLiquiditySwapAdapter. |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../glass.png) |
+ 0 |
@@ -96,8 +103,8 @@
diff --git a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapLiquiditySwapAdapter.sol.func.html b/report/extensions/paraswap-adapters/ParaSwapLiquiditySwapAdapter.sol.func.html
similarity index 64%
rename from report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapLiquiditySwapAdapter.sol.func.html
rename to report/extensions/paraswap-adapters/ParaSwapLiquiditySwapAdapter.sol.func.html
index 1bcf5d38..e628152b 100644
--- a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapLiquiditySwapAdapter.sol.func.html
+++ b/report/extensions/paraswap-adapters/ParaSwapLiquiditySwapAdapter.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapLiquiditySwapAdapter.sol - functions
-
+ LCOV - lcov.info.p - extensions/paraswap-adapters/ParaSwapLiquiditySwapAdapter.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,17 +31,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
@@ -53,21 +53,28 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../glass.png) |
+
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../updown.png) |
+
+
+
+
+ ParaSwapLiquiditySwapAdapter. |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../updown.png) |
+ 0 |
@@ -96,8 +103,8 @@
diff --git a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapLiquiditySwapAdapter.sol.gcov.html b/report/extensions/paraswap-adapters/ParaSwapLiquiditySwapAdapter.sol.gcov.html
similarity index 86%
rename from report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapLiquiditySwapAdapter.sol.gcov.html
rename to report/extensions/paraswap-adapters/ParaSwapLiquiditySwapAdapter.sol.gcov.html
index 63a5e17b..7f70f051 100644
--- a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapLiquiditySwapAdapter.sol.gcov.html
+++ b/report/extensions/paraswap-adapters/ParaSwapLiquiditySwapAdapter.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapLiquiditySwapAdapter.sol
-
+ LCOV - lcov.info.p - extensions/paraswap-adapters/ParaSwapLiquiditySwapAdapter.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,17 +31,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -72,11 +72,11 @@
1 : : // SPDX-License-Identifier: BUSL-1.1
2 : : pragma solidity ^0.8.10;
3 : :
- 4 : : import {IERC20Detailed} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol';
- 5 : : import {IERC20WithPermit} from 'aave-v3-core/contracts/interfaces/IERC20WithPermit.sol';
- 6 : : import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
- 7 : : import {SafeERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/SafeERC20.sol';
- 8 : : import {SafeMath} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/SafeMath.sol';
+ 4 : : import {IERC20Detailed} from '../../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
+ 5 : : import {IERC20WithPermit} from '../../interfaces/IERC20WithPermit.sol';
+ 6 : : import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
+ 7 : : import {SafeERC20} from '../../dependencies/openzeppelin/contracts/SafeERC20.sol';
+ 8 : : import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol';
9 : : import {BaseParaSwapSellAdapter} from './BaseParaSwapSellAdapter.sol';
10 : : import {IParaSwapAugustusRegistry} from './interfaces/IParaSwapAugustusRegistry.sol';
11 : : import {IParaSwapAugustus} from './interfaces/IParaSwapAugustus.sol';
@@ -96,7 +96,7 @@
25 : : IParaSwapAugustusRegistry augustusRegistry,
26 : : address owner
27 : : ) BaseParaSwapSellAdapter(addressesProvider, augustusRegistry) {
- 28 : : transferOwnership(owner);
+ 28 : 0 : transferOwnership(owner);
29 : : }
30 : :
31 : : /**
@@ -116,32 +116,32 @@
45 : : * address augustus Address of ParaSwap's AugustusSwapper contract
46 : : * PermitSignature permitParams Struct containing the permit signatures, set to all zeroes if not used
47 : : */
- 48 : 3 : function executeOperation(
+ 48 : : function executeOperation(
49 : : address asset,
50 : : uint256 amount,
51 : : uint256 premium,
52 : : address initiator,
53 : : bytes calldata params
54 : : ) external override nonReentrant returns (bool) {
- 55 : 6 : require(msg.sender == address(POOL), 'CALLER_MUST_BE_POOL');
+ 55 : 3 : require(msg.sender == address(POOL), 'CALLER_MUST_BE_POOL');
56 : :
- 57 : 6 : uint256 flashLoanAmount = amount;
- 58 : 6 : uint256 premiumLocal = premium;
- 59 : 6 : address initiatorLocal = initiator;
- 60 : 9 : IERC20Detailed assetToSwapFrom = IERC20Detailed(asset);
- 61 : 6 : (
+ 57 : 3 : uint256 flashLoanAmount = amount;
+ 58 : 3 : uint256 premiumLocal = premium;
+ 59 : 3 : address initiatorLocal = initiator;
+ 60 : 3 : IERC20Detailed assetToSwapFrom = IERC20Detailed(asset);
+ 61 : 3 : (
62 : : IERC20Detailed assetToSwapTo,
63 : : uint256 minAmountToReceive,
64 : : uint256 swapAllBalanceOffset,
65 : : bytes memory swapCalldata,
66 : : IParaSwapAugustus augustus,
67 : : PermitSignature memory permitParams
- 68 : 6 : ) = abi.decode(
+ 68 : 3 : ) = abi.decode(
69 : : params,
70 : : (IERC20Detailed, uint256, uint256, bytes, IParaSwapAugustus, PermitSignature)
71 : : );
72 : :
- 73 : 6 : _swapLiquidity(
+ 73 : 3 : _swapLiquidity(
74 : : swapAllBalanceOffset,
75 : : swapCalldata,
76 : : augustus,
@@ -154,7 +154,7 @@
83 : : minAmountToReceive
84 : : );
85 : :
- 86 : 4 : return true;
+ 86 : 2 : return true;
87 : : }
88 : :
89 : : /**
@@ -170,7 +170,7 @@
99 : : * @param augustus Address of ParaSwap's AugustusSwapper contract
100 : : * @param permitParams Struct containing the permit signatures, set to all zeroes if not used
101 : : */
- 102 : 3 : function swapAndDeposit(
+ 102 : : function swapAndDeposit(
103 : : IERC20Detailed assetToSwapFrom,
104 : : IERC20Detailed assetToSwapTo,
105 : : uint256 amountToSwap,
@@ -180,17 +180,17 @@
109 : : IParaSwapAugustus augustus,
110 : : PermitSignature calldata permitParams
111 : : ) external nonReentrant {
- 112 : 9 : IERC20WithPermit aToken = IERC20WithPermit(
+ 112 : 3 : IERC20WithPermit aToken = IERC20WithPermit(
113 : : _getReserveData(address(assetToSwapFrom)).aTokenAddress
114 : : );
115 : :
- 116 : 6 : if (swapAllBalanceOffset != 0) {
- 117 : 3 : uint256 balance = aToken.balanceOf(msg.sender);
- 118 : 2 : require(balance <= amountToSwap, 'INSUFFICIENT_AMOUNT_TO_SWAP');
- 119 : 2 : amountToSwap = balance;
+ 116 : 3 : if (swapAllBalanceOffset != 0) {
+ 117 : 1 : uint256 balance = aToken.balanceOf(msg.sender);
+ 118 : 1 : require(balance <= amountToSwap, 'INSUFFICIENT_AMOUNT_TO_SWAP');
+ 119 : 1 : amountToSwap = balance;
120 : : }
121 : :
- 122 : 6 : _pullATokenAndWithdraw(
+ 122 : 3 : _pullATokenAndWithdraw(
123 : : address(assetToSwapFrom),
124 : : aToken,
125 : : msg.sender,
@@ -198,7 +198,7 @@
127 : : permitParams
128 : : );
129 : :
- 130 : 9 : uint256 amountReceived = _sellOnParaSwap(
+ 130 : 3 : uint256 amountReceived = _sellOnParaSwap(
131 : : swapAllBalanceOffset,
132 : : swapCalldata,
133 : : augustus,
@@ -208,9 +208,9 @@
137 : : minAmountToReceive
138 : : );
139 : :
- 140 : 4 : assetToSwapTo.safeApprove(address(POOL), 0);
- 141 : 4 : assetToSwapTo.safeApprove(address(POOL), amountReceived);
- 142 : 4 : POOL.deposit(address(assetToSwapTo), amountReceived, msg.sender, 0);
+ 140 : 2 : assetToSwapTo.safeApprove(address(POOL), 0);
+ 141 : 2 : assetToSwapTo.safeApprove(address(POOL), amountReceived);
+ 142 : 2 : POOL.deposit(address(assetToSwapTo), amountReceived, msg.sender, 0);
143 : : }
144 : :
145 : : /**
@@ -226,7 +226,7 @@
155 : : * @param assetToSwapTo Address of the underlying asset to be swapped to and deposited
156 : : * @param minAmountToReceive Min amount to be received from the swap
157 : : */
- 158 : 3 : function _swapLiquidity(
+ 158 : : function _swapLiquidity(
159 : : uint256 swapAllBalanceOffset,
160 : : bytes memory swapCalldata,
161 : : IParaSwapAugustus augustus,
@@ -238,21 +238,21 @@
167 : : IERC20Detailed assetToSwapTo,
168 : : uint256 minAmountToReceive
169 : : ) internal {
- 170 : 9 : IERC20WithPermit aToken = IERC20WithPermit(
+ 170 : 3 : IERC20WithPermit aToken = IERC20WithPermit(
171 : : _getReserveData(address(assetToSwapFrom)).aTokenAddress
172 : : );
- 173 : 6 : uint256 amountToSwap = flashLoanAmount;
+ 173 : 3 : uint256 amountToSwap = flashLoanAmount;
174 : :
- 175 : 9 : uint256 balance = aToken.balanceOf(initiator);
- 176 : 6 : if (swapAllBalanceOffset != 0) {
- 177 : 3 : uint256 balanceToSwap = balance.sub(premium);
- 178 : 2 : require(balanceToSwap <= amountToSwap, 'INSUFFICIENT_AMOUNT_TO_SWAP');
- 179 : 2 : amountToSwap = balanceToSwap;
+ 175 : 3 : uint256 balance = aToken.balanceOf(initiator);
+ 176 : 3 : if (swapAllBalanceOffset != 0) {
+ 177 : 1 : uint256 balanceToSwap = balance.sub(premium);
+ 178 : 1 : require(balanceToSwap <= amountToSwap, 'INSUFFICIENT_AMOUNT_TO_SWAP');
+ 179 : 1 : amountToSwap = balanceToSwap;
180 : : } else {
- 181 : 4 : require(balance >= amountToSwap.add(premium), 'INSUFFICIENT_ATOKEN_BALANCE');
+ 181 : 2 : require(balance >= amountToSwap.add(premium), 'INSUFFICIENT_ATOKEN_BALANCE');
182 : : }
183 : :
- 184 : 9 : uint256 amountReceived = _sellOnParaSwap(
+ 184 : 3 : uint256 amountReceived = _sellOnParaSwap(
185 : : swapAllBalanceOffset,
186 : : swapCalldata,
187 : : augustus,
@@ -262,11 +262,11 @@
191 : : minAmountToReceive
192 : : );
193 : :
- 194 : 4 : assetToSwapTo.safeApprove(address(POOL), 0);
- 195 : 4 : assetToSwapTo.safeApprove(address(POOL), amountReceived);
- 196 : 4 : POOL.deposit(address(assetToSwapTo), amountReceived, initiator, 0);
+ 194 : 2 : assetToSwapTo.safeApprove(address(POOL), 0);
+ 195 : 2 : assetToSwapTo.safeApprove(address(POOL), amountReceived);
+ 196 : 2 : POOL.deposit(address(assetToSwapTo), amountReceived, initiator, 0);
197 : :
- 198 : 4 : _pullATokenAndWithdraw(
+ 198 : 2 : _pullATokenAndWithdraw(
199 : : address(assetToSwapFrom),
200 : : aToken,
201 : : initiator,
@@ -275,8 +275,8 @@
204 : : );
205 : :
206 : : // Repay flash loan
- 207 : 4 : assetToSwapFrom.safeApprove(address(POOL), 0);
- 208 : 4 : assetToSwapFrom.safeApprove(address(POOL), flashLoanAmount.add(premium));
+ 207 : 2 : assetToSwapFrom.safeApprove(address(POOL), 0);
+ 208 : 2 : assetToSwapFrom.safeApprove(address(POOL), flashLoanAmount.add(premium));
209 : : }
210 : : }
@@ -286,8 +286,8 @@
diff --git a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapRepayAdapter.sol.func-c.html b/report/extensions/paraswap-adapters/ParaSwapRepayAdapter.sol.func-c.html
similarity index 61%
rename from report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapRepayAdapter.sol.func-c.html
rename to report/extensions/paraswap-adapters/ParaSwapRepayAdapter.sol.func-c.html
index 09b21b97..542c078b 100644
--- a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapRepayAdapter.sol.func-c.html
+++ b/report/extensions/paraswap-adapters/ParaSwapRepayAdapter.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapRepayAdapter.sol - functions
-
+ LCOV - lcov.info.p - extensions/paraswap-adapters/ParaSwapRepayAdapter.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,17 +31,17 @@
|
-
-
-
+
+
+
-
+
|
-
-
+
+
@@ -53,26 +53,33 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../updown.png) |
+
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../glass.png) |
+
+
+
+
+ ParaSwapRepayAdapter. |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../glass.png) |
+ 0 |
- ParaSwapRepayAdapter._swapAndRepay |
+ ParaSwapRepayAdapter._swapAndRepay |
2 |
@@ -93,7 +100,7 @@
- ParaSwapRepayAdapter.getDebtRepayAmount |
+ ParaSwapRepayAdapter.getDebtRepayAmount |
6 |
@@ -103,8 +110,8 @@
diff --git a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapRepayAdapter.sol.func.html b/report/extensions/paraswap-adapters/ParaSwapRepayAdapter.sol.func.html
similarity index 61%
rename from report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapRepayAdapter.sol.func.html
rename to report/extensions/paraswap-adapters/ParaSwapRepayAdapter.sol.func.html
index fc79c5bb..9a5fa9b0 100644
--- a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapRepayAdapter.sol.func.html
+++ b/report/extensions/paraswap-adapters/ParaSwapRepayAdapter.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapRepayAdapter.sol - functions
-
+ LCOV - lcov.info.p - extensions/paraswap-adapters/ParaSwapRepayAdapter.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,17 +31,17 @@
|
-
-
-
+
+
+
-
+
|
-
-
+
+
@@ -53,26 +53,33 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../glass.png) |
+
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../updown.png) |
+
+
+
+
+ ParaSwapRepayAdapter. |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../updown.png) |
+ 0 |
- ParaSwapRepayAdapter._swapAndRepay |
+ ParaSwapRepayAdapter._swapAndRepay |
2 |
@@ -86,7 +93,7 @@
- ParaSwapRepayAdapter.getDebtRepayAmount |
+ ParaSwapRepayAdapter.getDebtRepayAmount |
6 |
@@ -103,8 +110,8 @@
diff --git a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapRepayAdapter.sol.gcov.html b/report/extensions/paraswap-adapters/ParaSwapRepayAdapter.sol.gcov.html
similarity index 80%
rename from report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapRepayAdapter.sol.gcov.html
rename to report/extensions/paraswap-adapters/ParaSwapRepayAdapter.sol.gcov.html
index fe75f161..10eff6f6 100644
--- a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapRepayAdapter.sol.gcov.html
+++ b/report/extensions/paraswap-adapters/ParaSwapRepayAdapter.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapRepayAdapter.sol
-
+ LCOV - lcov.info.p - extensions/paraswap-adapters/ParaSwapRepayAdapter.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,17 +31,17 @@
|
-
-
-
+
+
+
-
+
|
-
-
+
+
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -72,13 +72,13 @@
1 : : // SPDX-License-Identifier: BUSL-1.1
2 : : pragma solidity ^0.8.10;
3 : :
- 4 : : import {DataTypes} from 'aave-v3-core/contracts/protocol/libraries/types/DataTypes.sol';
- 5 : : import {IERC20Detailed} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol';
- 6 : : import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
- 7 : : import {IERC20WithPermit} from 'aave-v3-core/contracts/interfaces/IERC20WithPermit.sol';
- 8 : : import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
- 9 : : import {SafeERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/SafeERC20.sol';
- 10 : : import {SafeMath} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/SafeMath.sol';
+ 4 : : import {DataTypes} from '../../protocol/libraries/types/DataTypes.sol';
+ 5 : : import {IERC20Detailed} from '../../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
+ 6 : : import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
+ 7 : : import {IERC20WithPermit} from '../../interfaces/IERC20WithPermit.sol';
+ 8 : : import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
+ 9 : : import {SafeERC20} from '../../dependencies/openzeppelin/contracts/SafeERC20.sol';
+ 10 : : import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol';
11 : : import {BaseParaSwapBuyAdapter} from './BaseParaSwapBuyAdapter.sol';
12 : : import {IParaSwapAugustusRegistry} from './interfaces/IParaSwapAugustusRegistry.sol';
13 : : import {IParaSwapAugustus} from './interfaces/IParaSwapAugustus.sol';
@@ -106,7 +106,7 @@
35 : : IParaSwapAugustusRegistry augustusRegistry,
36 : : address owner
37 : : ) BaseParaSwapBuyAdapter(addressesProvider, augustusRegistry) {
- 38 : : transferOwnership(owner);
+ 38 : 0 : transferOwnership(owner);
39 : : }
40 : :
41 : : /**
@@ -131,23 +131,23 @@
60 : : * * IParaSwapAugustus augustus Address of Augustus Swapper
61 : : * PermitSignature permitParams Struct containing the permit signatures, set to all zeroes if not used
62 : : */
- 63 : 2 : function executeOperation(
+ 63 : : function executeOperation(
64 : : address asset,
65 : : uint256 amount,
66 : : uint256 premium,
67 : : address initiator,
68 : : bytes calldata params
69 : : ) external override nonReentrant returns (bool) {
- 70 : 4 : require(msg.sender == address(POOL), 'CALLER_MUST_BE_POOL');
+ 70 : 2 : require(msg.sender == address(POOL), 'CALLER_MUST_BE_POOL');
71 : :
- 72 : 4 : uint256 collateralAmount = amount;
- 73 : 4 : address initiatorLocal = initiator;
+ 72 : 2 : uint256 collateralAmount = amount;
+ 73 : 2 : address initiatorLocal = initiator;
74 : :
- 75 : 6 : IERC20Detailed collateralAsset = IERC20Detailed(asset);
+ 75 : 2 : IERC20Detailed collateralAsset = IERC20Detailed(asset);
76 : :
- 77 : 4 : _swapAndRepay(params, premium, initiatorLocal, collateralAsset, collateralAmount);
+ 77 : 2 : _swapAndRepay(params, premium, initiatorLocal, collateralAsset, collateralAmount);
78 : :
- 79 : 4 : return true;
+ 79 : 2 : return true;
80 : : }
81 : :
82 : : /**
@@ -164,7 +164,7 @@
93 : : * @param paraswapData Data for Paraswap Adapter
94 : : * @param permitSignature struct containing the permit signature
95 : : */
- 96 : 4 : function swapAndRepay(
+ 96 : : function swapAndRepay(
97 : : IERC20Detailed collateralAsset,
98 : : IERC20Detailed debtAsset,
99 : : uint256 collateralAmount,
@@ -174,7 +174,7 @@
103 : : bytes calldata paraswapData,
104 : : PermitSignature calldata permitSignature
105 : : ) external nonReentrant {
- 106 : 8 : debtRepayAmount = getDebtRepayAmount(
+ 106 : 4 : debtRepayAmount = getDebtRepayAmount(
107 : : debtAsset,
108 : : debtRateMode,
109 : : buyAllBalanceOffset,
@@ -183,9 +183,9 @@
112 : : );
113 : :
114 : : // Pull aTokens from user
- 115 : 8 : _pullATokenAndWithdraw(address(collateralAsset), msg.sender, collateralAmount, permitSignature);
+ 115 : 4 : _pullATokenAndWithdraw(address(collateralAsset), msg.sender, collateralAmount, permitSignature);
116 : : //buy debt asset using collateral asset
- 117 : 12 : uint256 amountSold = _buyOnParaSwap(
+ 117 : 4 : (uint256 amountSold, uint256 amountBought) = _buyOnParaSwap(
118 : : buyAllBalanceOffset,
119 : : paraswapData,
120 : : collateralAsset,
@@ -194,107 +194,123 @@
123 : : debtRepayAmount
124 : : );
125 : :
- 126 : 9 : uint256 collateralBalanceLeft = collateralAmount - amountSold;
+ 126 : 3 : uint256 collateralBalanceLeft = collateralAmount - amountSold;
127 : :
128 : : //deposit collateral back in the pool, if left after the swap(buy)
- 129 : 6 : if (collateralBalanceLeft > 0) {
- 130 : 2 : IERC20(collateralAsset).safeApprove(address(POOL), 0);
- 131 : 2 : IERC20(collateralAsset).safeApprove(address(POOL), collateralBalanceLeft);
- 132 : 2 : POOL.deposit(address(collateralAsset), collateralBalanceLeft, msg.sender, 0);
+ 129 : 3 : if (collateralBalanceLeft > 0) {
+ 130 : 1 : IERC20(collateralAsset).safeApprove(address(POOL), collateralBalanceLeft);
+ 131 : 1 : POOL.deposit(address(collateralAsset), collateralBalanceLeft, msg.sender, 0);
+ 132 : 1 : IERC20(collateralAsset).safeApprove(address(POOL), 0);
133 : : }
134 : :
135 : : // Repay debt. Approves 0 first to comply with tokens that implement the anti frontrunning approval fix
- 136 : 6 : IERC20(debtAsset).safeApprove(address(POOL), 0);
- 137 : 6 : IERC20(debtAsset).safeApprove(address(POOL), debtRepayAmount);
- 138 : 6 : POOL.repay(address(debtAsset), debtRepayAmount, debtRateMode, msg.sender);
- 139 : : }
- 140 : :
- 141 : : /**
- 142 : : * @dev Perform the repay of the debt, pulls the initiator collateral and swaps to repay the flash loan
- 143 : : * @param premium Fee of the flash loan
- 144 : : * @param initiator Address of the user
- 145 : : * @param collateralAsset Address of token to be swapped
- 146 : : * @param collateralAmount Amount of the reserve to be swapped(flash loan amount)
- 147 : : */
+ 136 : 3 : IERC20(debtAsset).safeApprove(address(POOL), debtRepayAmount);
+ 137 : 3 : POOL.repay(address(debtAsset), debtRepayAmount, debtRateMode, msg.sender);
+ 138 : 3 : IERC20(debtAsset).safeApprove(address(POOL), 0);
+ 139 : :
+ 140 : : {
+ 141 : : //transfer excess of debtAsset back to the user, if any
+ 142 : 3 : uint256 debtAssetExcess = amountBought - debtRepayAmount;
+ 143 : 3 : if (debtAssetExcess > 0) {
+ 144 : 0 : IERC20(debtAsset).safeTransfer(msg.sender, debtAssetExcess);
+ 145 : : }
+ 146 : : }
+ 147 : : }
148 : :
- 149 : 2 : function _swapAndRepay(
- 150 : : bytes calldata params,
- 151 : : uint256 premium,
- 152 : : address initiator,
- 153 : : IERC20Detailed collateralAsset,
- 154 : : uint256 collateralAmount
- 155 : : ) private {
- 156 : 4 : (
- 157 : : IERC20Detailed debtAsset,
- 158 : : uint256 debtRepayAmount,
- 159 : : uint256 buyAllBalanceOffset,
- 160 : : uint256 rateMode,
- 161 : : bytes memory paraswapData,
- 162 : : PermitSignature memory permitSignature
- 163 : 4 : ) = abi.decode(params, (IERC20Detailed, uint256, uint256, uint256, bytes, PermitSignature));
- 164 : :
- 165 : 4 : debtRepayAmount = getDebtRepayAmount(
- 166 : : debtAsset,
- 167 : : rateMode,
- 168 : : buyAllBalanceOffset,
- 169 : : debtRepayAmount,
- 170 : : initiator
- 171 : : );
+ 149 : : /**
+ 150 : : * @dev Perform the repay of the debt, pulls the initiator collateral and swaps to repay the flash loan
+ 151 : : * @param premium Fee of the flash loan
+ 152 : : * @param initiator Address of the user
+ 153 : : * @param collateralAsset Address of token to be swapped
+ 154 : : * @param collateralAmount Amount of the reserve to be swapped(flash loan amount)
+ 155 : : */
+ 156 : :
+ 157 : : function _swapAndRepay(
+ 158 : : bytes calldata params,
+ 159 : : uint256 premium,
+ 160 : : address initiator,
+ 161 : : IERC20Detailed collateralAsset,
+ 162 : : uint256 collateralAmount
+ 163 : : ) private {
+ 164 : 2 : (
+ 165 : : IERC20Detailed debtAsset,
+ 166 : : uint256 debtRepayAmount,
+ 167 : : uint256 buyAllBalanceOffset,
+ 168 : : uint256 rateMode,
+ 169 : : bytes memory paraswapData,
+ 170 : : PermitSignature memory permitSignature
+ 171 : 2 : ) = abi.decode(params, (IERC20Detailed, uint256, uint256, uint256, bytes, PermitSignature));
172 : :
- 173 : 6 : uint256 amountSold = _buyOnParaSwap(
- 174 : : buyAllBalanceOffset,
- 175 : : paraswapData,
- 176 : : collateralAsset,
- 177 : : debtAsset,
- 178 : : collateralAmount,
- 179 : : debtRepayAmount
- 180 : : );
- 181 : :
- 182 : : // Repay debt. Approves for 0 first to comply with tokens that implement the anti frontrunning approval fix.
- 183 : 4 : IERC20(debtAsset).safeApprove(address(POOL), 0);
- 184 : 4 : IERC20(debtAsset).safeApprove(address(POOL), debtRepayAmount);
- 185 : 4 : POOL.repay(address(debtAsset), debtRepayAmount, rateMode, initiator);
- 186 : :
- 187 : 6 : uint256 neededForFlashLoanRepay = amountSold.add(premium);
- 188 : :
- 189 : : // Pull aTokens from user
- 190 : 4 : _pullATokenAndWithdraw(
- 191 : : address(collateralAsset),
- 192 : : initiator,
- 193 : : neededForFlashLoanRepay,
- 194 : : permitSignature
- 195 : : );
+ 173 : 2 : debtRepayAmount = getDebtRepayAmount(
+ 174 : : debtAsset,
+ 175 : : rateMode,
+ 176 : : buyAllBalanceOffset,
+ 177 : : debtRepayAmount,
+ 178 : : initiator
+ 179 : : );
+ 180 : :
+ 181 : 2 : (uint256 amountSold, uint256 amountBought) = _buyOnParaSwap(
+ 182 : : buyAllBalanceOffset,
+ 183 : : paraswapData,
+ 184 : : collateralAsset,
+ 185 : : debtAsset,
+ 186 : : collateralAmount,
+ 187 : : debtRepayAmount
+ 188 : : );
+ 189 : :
+ 190 : : // Repay debt. Approves for 0 first to comply with tokens that implement the anti frontrunning approval fix.
+ 191 : 2 : IERC20(debtAsset).safeApprove(address(POOL), debtRepayAmount);
+ 192 : 2 : POOL.repay(address(debtAsset), debtRepayAmount, rateMode, initiator);
+ 193 : 2 : IERC20(debtAsset).safeApprove(address(POOL), 0);
+ 194 : :
+ 195 : 2 : uint256 neededForFlashLoanRepay = amountSold.add(premium);
196 : :
- 197 : : // Repay flashloan. Approves for 0 first to comply with tokens that implement the anti frontrunning approval fix.
- 198 : 4 : IERC20(collateralAsset).safeApprove(address(POOL), 0);
- 199 : 4 : IERC20(collateralAsset).safeApprove(address(POOL), collateralAmount.add(premium));
- 200 : : }
- 201 : :
- 202 : 6 : function getDebtRepayAmount(
- 203 : : IERC20Detailed debtAsset,
- 204 : : uint256 rateMode,
- 205 : : uint256 buyAllBalanceOffset,
- 206 : : uint256 debtRepayAmount,
- 207 : : address initiator
- 208 : : ) private view returns (uint256) {
- 209 : 18 : DataTypes.ReserveDataLegacy memory debtReserveData = _getReserveData(address(debtAsset));
- 210 : :
- 211 : 18 : address debtToken = DataTypes.InterestRateMode(rateMode) == DataTypes.InterestRateMode.STABLE
- 212 : : ? debtReserveData.stableDebtTokenAddress
- 213 : : : debtReserveData.variableDebtTokenAddress;
- 214 : :
- 215 : 18 : uint256 currentDebt = IERC20(debtToken).balanceOf(initiator);
- 216 : :
- 217 : 12 : if (buyAllBalanceOffset != 0) {
- 218 : 2 : require(currentDebt <= debtRepayAmount, 'INSUFFICIENT_AMOUNT_TO_REPAY');
- 219 : 2 : debtRepayAmount = currentDebt;
- 220 : : } else {
- 221 : 10 : require(debtRepayAmount <= currentDebt, 'INVALID_DEBT_REPAY_AMOUNT');
- 222 : : }
- 223 : :
- 224 : 12 : return debtRepayAmount;
- 225 : : }
- 226 : : }
+ 197 : : // Pull aTokens from user
+ 198 : 2 : _pullATokenAndWithdraw(
+ 199 : : address(collateralAsset),
+ 200 : : initiator,
+ 201 : : neededForFlashLoanRepay,
+ 202 : : permitSignature
+ 203 : : );
+ 204 : :
+ 205 : : {
+ 206 : : //transfer excess of debtAsset back to the user, if any
+ 207 : 2 : uint256 debtAssetExcess = amountBought - debtRepayAmount;
+ 208 : 2 : if (debtAssetExcess > 0) {
+ 209 : 0 : IERC20(debtAsset).safeTransfer(initiator, debtAssetExcess);
+ 210 : : }
+ 211 : : }
+ 212 : :
+ 213 : : // Repay flashloan. Approves for 0 first to comply with tokens that implement the anti frontrunning approval fix.
+ 214 : 2 : IERC20(collateralAsset).safeApprove(address(POOL), 0);
+ 215 : 2 : IERC20(collateralAsset).safeApprove(address(POOL), collateralAmount.add(premium));
+ 216 : : }
+ 217 : :
+ 218 : : function getDebtRepayAmount(
+ 219 : : IERC20Detailed debtAsset,
+ 220 : : uint256 rateMode,
+ 221 : : uint256 buyAllBalanceOffset,
+ 222 : : uint256 debtRepayAmount,
+ 223 : : address initiator
+ 224 : : ) private view returns (uint256) {
+ 225 : 6 : require(
+ 226 : : DataTypes.InterestRateMode(rateMode) == DataTypes.InterestRateMode.VARIABLE,
+ 227 : : 'INVALID_RATE_MODE'
+ 228 : : );
+ 229 : 6 : DataTypes.ReserveDataLegacy memory debtReserveData = _getReserveData(address(debtAsset));
+ 230 : :
+ 231 : 6 : uint256 currentDebt = IERC20(debtReserveData.variableDebtTokenAddress).balanceOf(initiator);
+ 232 : :
+ 233 : 6 : if (buyAllBalanceOffset != 0) {
+ 234 : 1 : require(currentDebt <= debtRepayAmount, 'INSUFFICIENT_AMOUNT_TO_REPAY');
+ 235 : 1 : debtRepayAmount = currentDebt;
+ 236 : : } else {
+ 237 : 5 : require(debtRepayAmount <= currentDebt, 'INVALID_DEBT_REPAY_AMOUNT');
+ 238 : : }
+ 239 : :
+ 240 : 6 : return debtRepayAmount;
+ 241 : : }
+ 242 : : }
@@ -302,8 +318,8 @@
diff --git a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapWithdrawSwapAdapter.sol.func-c.html b/report/extensions/paraswap-adapters/ParaSwapWithdrawSwapAdapter.sol.func-c.html
similarity index 62%
rename from report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapWithdrawSwapAdapter.sol.func-c.html
rename to report/extensions/paraswap-adapters/ParaSwapWithdrawSwapAdapter.sol.func-c.html
index df9d9ee1..54ef062d 100644
--- a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapWithdrawSwapAdapter.sol.func-c.html
+++ b/report/extensions/paraswap-adapters/ParaSwapWithdrawSwapAdapter.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapWithdrawSwapAdapter.sol - functions
-
+ LCOV - lcov.info.p - extensions/paraswap-adapters/ParaSwapWithdrawSwapAdapter.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
+
+
-
-
+
|
-
+
+
-
|
@@ -53,30 +53,37 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../glass.png) |
- ParaSwapWithdrawSwapAdapter.executeOperation |
+ ParaSwapWithdrawSwapAdapter. |
0 |
+
+
+ ParaSwapWithdrawSwapAdapter.executeOperation |
+
+ 1 |
+
+
ParaSwapWithdrawSwapAdapter.withdrawAndSwap |
@@ -89,8 +96,8 @@
diff --git a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapWithdrawSwapAdapter.sol.func.html b/report/extensions/paraswap-adapters/ParaSwapWithdrawSwapAdapter.sol.func.html
similarity index 62%
rename from report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapWithdrawSwapAdapter.sol.func.html
rename to report/extensions/paraswap-adapters/ParaSwapWithdrawSwapAdapter.sol.func.html
index 0afef10a..d0cff844 100644
--- a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapWithdrawSwapAdapter.sol.func.html
+++ b/report/extensions/paraswap-adapters/ParaSwapWithdrawSwapAdapter.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapWithdrawSwapAdapter.sol - functions
-
+ LCOV - lcov.info.p - extensions/paraswap-adapters/ParaSwapWithdrawSwapAdapter.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
+
+
-
-
+
|
-
+
+
-
|
@@ -53,30 +53,37 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../updown.png) |
- ParaSwapWithdrawSwapAdapter.executeOperation |
+ ParaSwapWithdrawSwapAdapter. |
0 |
+
+
+ ParaSwapWithdrawSwapAdapter.executeOperation |
+
+ 1 |
+
+
ParaSwapWithdrawSwapAdapter.withdrawAndSwap |
@@ -89,8 +96,8 @@
diff --git a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapWithdrawSwapAdapter.sol.gcov.html b/report/extensions/paraswap-adapters/ParaSwapWithdrawSwapAdapter.sol.gcov.html
similarity index 82%
rename from report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapWithdrawSwapAdapter.sol.gcov.html
rename to report/extensions/paraswap-adapters/ParaSwapWithdrawSwapAdapter.sol.gcov.html
index b6e48189..749fd6ec 100644
--- a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapWithdrawSwapAdapter.sol.gcov.html
+++ b/report/extensions/paraswap-adapters/ParaSwapWithdrawSwapAdapter.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/ParaSwapWithdrawSwapAdapter.sol
-
+ LCOV - lcov.info.p - extensions/paraswap-adapters/ParaSwapWithdrawSwapAdapter.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
+
+
-
-
+
|
-
+
+
-
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -72,12 +72,12 @@
1 : : // SPDX-License-Identifier: AGPL-3.0
2 : : pragma solidity ^0.8.10;
3 : :
- 4 : : import {IERC20Detailed} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol';
- 5 : : import {IERC20WithPermit} from 'aave-v3-core/contracts/interfaces/IERC20WithPermit.sol';
- 6 : : import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
+ 4 : : import {IERC20Detailed} from '../../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
+ 5 : : import {IERC20WithPermit} from '../../interfaces/IERC20WithPermit.sol';
+ 6 : : import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
7 : : import {BaseParaSwapSellAdapter} from './BaseParaSwapSellAdapter.sol';
8 : : import {IParaSwapAugustusRegistry} from './interfaces/IParaSwapAugustusRegistry.sol';
- 9 : : import {SafeERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/SafeERC20.sol';
+ 9 : : import {SafeERC20} from '../../dependencies/openzeppelin/contracts/SafeERC20.sol';
10 : : import {IParaSwapAugustus} from './interfaces/IParaSwapAugustus.sol';
11 : : import {ReentrancyGuard} from '../../dependencies/openzeppelin/ReentrancyGuard.sol';
12 : :
@@ -89,17 +89,17 @@
18 : : IParaSwapAugustusRegistry augustusRegistry,
19 : : address owner
20 : : ) BaseParaSwapSellAdapter(addressesProvider, augustusRegistry) {
- 21 : : transferOwnership(owner);
+ 21 : 0 : transferOwnership(owner);
22 : : }
23 : :
- 24 : 0 : function executeOperation(
+ 24 : : function executeOperation(
25 : : address,
26 : : uint256,
27 : : uint256,
28 : : address,
29 : : bytes calldata
30 : : ) external override nonReentrant returns (bool) {
- 31 : 0 : revert('NOT_SUPPORTED');
+ 31 : 1 : revert('NOT_SUPPORTED');
32 : : }
33 : :
34 : : /**
@@ -114,7 +114,7 @@
43 : : * @param augustus Address of ParaSwap's AugustusSwapper contract
44 : : * @param permitParams Struct containing the permit signatures, set to all zeroes if not used
45 : : */
- 46 : 3 : function withdrawAndSwap(
+ 46 : : function withdrawAndSwap(
47 : : IERC20Detailed assetToSwapFrom,
48 : : IERC20Detailed assetToSwapTo,
49 : : uint256 amountToSwap,
@@ -124,17 +124,17 @@
53 : : IParaSwapAugustus augustus,
54 : : PermitSignature calldata permitParams
55 : : ) external nonReentrant {
- 56 : 9 : IERC20WithPermit aToken = IERC20WithPermit(
+ 56 : 3 : IERC20WithPermit aToken = IERC20WithPermit(
57 : : _getReserveData(address(assetToSwapFrom)).aTokenAddress
58 : : );
59 : :
- 60 : 6 : if (swapAllBalanceOffset != 0) {
- 61 : 3 : uint256 balance = aToken.balanceOf(msg.sender);
- 62 : 2 : require(balance <= amountToSwap, 'INSUFFICIENT_AMOUNT_TO_SWAP');
- 63 : 2 : amountToSwap = balance;
+ 60 : 3 : if (swapAllBalanceOffset != 0) {
+ 61 : 1 : uint256 balance = aToken.balanceOf(msg.sender);
+ 62 : 1 : require(balance <= amountToSwap, 'INSUFFICIENT_AMOUNT_TO_SWAP');
+ 63 : 1 : amountToSwap = balance;
64 : : }
65 : :
- 66 : 6 : _pullATokenAndWithdraw(
+ 66 : 3 : _pullATokenAndWithdraw(
67 : : address(assetToSwapFrom),
68 : : aToken,
69 : : msg.sender,
@@ -142,7 +142,7 @@
71 : : permitParams
72 : : );
73 : :
- 74 : 9 : uint256 amountReceived = _sellOnParaSwap(
+ 74 : 3 : uint256 amountReceived = _sellOnParaSwap(
75 : : swapAllBalanceOffset,
76 : : swapCalldata,
77 : : augustus,
@@ -152,7 +152,7 @@
81 : : minAmountToReceive
82 : : );
83 : :
- 84 : 4 : assetToSwapTo.safeTransfer(msg.sender, amountReceived);
+ 84 : 2 : assetToSwapTo.safeTransfer(msg.sender, amountReceived);
85 : : }
86 : : }
@@ -162,8 +162,8 @@
diff --git a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/index-sort-b.html b/report/extensions/paraswap-adapters/index-sort-b.html
similarity index 53%
rename from report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/index-sort-b.html
rename to report/extensions/paraswap-adapters/index-sort-b.html
index 7cb4d794..6b861fa6 100644
--- a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/index-sort-b.html
+++ b/report/extensions/paraswap-adapters/index-sort-b.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap
-
+ LCOV - lcov.info.p - extensions/paraswap-adapters
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
+
+
-
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../glass.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../glass.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../updown.png) |
Rate |
@@ -96,117 +96,117 @@
Hit |
- AaveParaSwapFeeClaimer.sol |
+ AaveParaSwapFeeClaimer.sol |
-
+
|
- 100.0 % |
- 4 |
+ 50.0 % |
+ 8 |
4 |
- |
|
|
- 100.0 % |
- 4 |
+ 80.0 % |
+ 5 |
4 |
- BaseParaSwapAdapter.sol |
+ BaseParaSwapAdapter.sol |
-
+
|
- 100.0 % |
- 12 |
+ 92.3 % |
+ 13 |
12 |
- |
|
|
- 100.0 % |
- 5 |
+ 83.3 % |
+ 6 |
5 |
- BaseParaSwapBuyAdapter.sol |
+ BaseParaSwapBuyAdapter.sol |
-
+
|
- 100.0 % |
- 24 |
+ 82.8 % |
+ 29 |
24 |
- |
|
|
- 100.0 % |
- 1 |
+ 50.0 % |
+ 2 |
1 |
- BaseParaSwapSellAdapter.sol |
+ BaseParaSwapSellAdapter.sol |
-
+
|
- 100.0 % |
- 21 |
+ 80.8 % |
+ 26 |
21 |
- |
|
|
- 100.0 % |
- 1 |
+ 50.0 % |
+ 2 |
1 |
- ParaSwapLiquiditySwapAdapter.sol |
+ ParaSwapLiquiditySwapAdapter.sol |
-
+
|
- 100.0 % |
- 34 |
+ 97.1 % |
+ 35 |
34 |
- |
|
|
- 100.0 % |
- 3 |
+ 75.0 % |
+ 4 |
3 |
- ParaSwapRepayAdapter.sol |
+ ParaSwapRepayAdapter.sol |
-
+
|
- 100.0 % |
- 36 |
- 36 |
+ 93.0 % |
+ 43 |
+ 40 |
- |
|
|
- 100.0 % |
- 4 |
+ 80.0 % |
+ 5 |
4 |
- ParaSwapWithdrawSwapAdapter.sol |
+ ParaSwapWithdrawSwapAdapter.sol |
-
+
|
- 88.9 % |
+ 90.0 % |
+ 10 |
9 |
- 8 |
- |
|
|
- 50.0 % |
+ 66.7 % |
+ 3 |
2 |
- 1 |
diff --git a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/index-sort-f.html b/report/extensions/paraswap-adapters/index-sort-f.html
similarity index 53%
rename from report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/index-sort-f.html
rename to report/extensions/paraswap-adapters/index-sort-f.html
index b5b7b613..ff9f0d9f 100644
--- a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/index-sort-f.html
+++ b/report/extensions/paraswap-adapters/index-sort-f.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap
-
+ LCOV - lcov.info.p - extensions/paraswap-adapters
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
+
+
-
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../glass.png) |
+ File ![Click to sort table by file name Sort by file name](../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../glass.png) |
Rate |
@@ -96,13 +96,13 @@
Hit |
- ParaSwapWithdrawSwapAdapter.sol |
+ BaseParaSwapBuyAdapter.sol |
-
+
|
- 88.9 % |
- 9 |
- 8 |
+ 82.8 % |
+ 29 |
+ 24 |
- |
|
|
@@ -111,93 +111,93 @@
1 |
- BaseParaSwapBuyAdapter.sol |
+ BaseParaSwapSellAdapter.sol |
-
+
|
- 100.0 % |
- 24 |
- 24 |
+ 80.8 % |
+ 26 |
+ 21 |
- |
|
|
- 100.0 % |
- 1 |
+ 50.0 % |
+ 2 |
1 |
- BaseParaSwapSellAdapter.sol |
+ ParaSwapWithdrawSwapAdapter.sol |
-
+
|
- 100.0 % |
- 21 |
- 21 |
+ 90.0 % |
+ 10 |
+ 9 |
- |
|
|
- 100.0 % |
- 1 |
- 1 |
+ 66.7 % |
+ 3 |
+ 2 |
- ParaSwapLiquiditySwapAdapter.sol |
+ ParaSwapLiquiditySwapAdapter.sol |
-
+
|
- 100.0 % |
- 34 |
+ 97.1 % |
+ 35 |
34 |
- |
|
|
- 100.0 % |
- 3 |
+ 75.0 % |
+ 4 |
3 |
- AaveParaSwapFeeClaimer.sol |
+ AaveParaSwapFeeClaimer.sol |
-
+
|
- 100.0 % |
- 4 |
+ 50.0 % |
+ 8 |
4 |
- |
|
|
- 100.0 % |
- 4 |
+ 80.0 % |
+ 5 |
4 |
- ParaSwapRepayAdapter.sol |
+ ParaSwapRepayAdapter.sol |
-
+
|
- 100.0 % |
- 36 |
- 36 |
+ 93.0 % |
+ 43 |
+ 40 |
- |
|
|
- 100.0 % |
- 4 |
+ 80.0 % |
+ 5 |
4 |
- BaseParaSwapAdapter.sol |
+ BaseParaSwapAdapter.sol |
-
+
|
- 100.0 % |
- 12 |
+ 92.3 % |
+ 13 |
12 |
- |
|
|
- 100.0 % |
- 5 |
+ 83.3 % |
+ 6 |
5 |
@@ -205,8 +205,8 @@
diff --git a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/index-sort-l.html b/report/extensions/paraswap-adapters/index-sort-l.html
similarity index 53%
rename from report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/index-sort-l.html
rename to report/extensions/paraswap-adapters/index-sort-l.html
index 2f902766..810ddf3c 100644
--- a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/index-sort-l.html
+++ b/report/extensions/paraswap-adapters/index-sort-l.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap
-
+ LCOV - lcov.info.p - extensions/paraswap-adapters
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
+
+
-
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../glass.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../glass.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../updown.png) |
Rate |
@@ -96,117 +96,117 @@
Hit |
- ParaSwapWithdrawSwapAdapter.sol |
+ AaveParaSwapFeeClaimer.sol |
-
+
|
- 88.9 % |
- 9 |
+ 50.0 % |
8 |
+ 4 |
- |
|
|
- 50.0 % |
- 2 |
- 1 |
+ 80.0 % |
+ 5 |
+ 4 |
- AaveParaSwapFeeClaimer.sol |
+ BaseParaSwapSellAdapter.sol |
-
+
|
- 100.0 % |
- 4 |
- 4 |
+ 80.8 % |
+ 26 |
+ 21 |
- |
|
|
- 100.0 % |
- 4 |
- 4 |
+ 50.0 % |
+ 2 |
+ 1 |
- BaseParaSwapAdapter.sol |
+ BaseParaSwapBuyAdapter.sol |
-
+
|
- 100.0 % |
- 12 |
- 12 |
+ 82.8 % |
+ 29 |
+ 24 |
- |
|
|
- 100.0 % |
- 5 |
- 5 |
+ 50.0 % |
+ 2 |
+ 1 |
- BaseParaSwapSellAdapter.sol |
+ ParaSwapWithdrawSwapAdapter.sol |
-
+
|
- 100.0 % |
- 21 |
- 21 |
+ 90.0 % |
+ 10 |
+ 9 |
- |
|
|
- 100.0 % |
- 1 |
- 1 |
+ 66.7 % |
+ 3 |
+ 2 |
- BaseParaSwapBuyAdapter.sol |
+ BaseParaSwapAdapter.sol |
-
+
|
- 100.0 % |
- 24 |
- 24 |
+ 92.3 % |
+ 13 |
+ 12 |
- |
|
|
- 100.0 % |
- 1 |
- 1 |
+ 83.3 % |
+ 6 |
+ 5 |
- ParaSwapLiquiditySwapAdapter.sol |
+ ParaSwapRepayAdapter.sol |
-
+
|
- 100.0 % |
- 34 |
- 34 |
+ 93.0 % |
+ 43 |
+ 40 |
- |
|
|
- 100.0 % |
- 3 |
- 3 |
+ 80.0 % |
+ 5 |
+ 4 |
- ParaSwapRepayAdapter.sol |
+ ParaSwapLiquiditySwapAdapter.sol |
-
+
|
- 100.0 % |
- 36 |
- 36 |
+ 97.1 % |
+ 35 |
+ 34 |
- |
|
|
- 100.0 % |
- 4 |
+ 75.0 % |
4 |
+ 3 |
diff --git a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/index.html b/report/extensions/paraswap-adapters/index.html
similarity index 53%
rename from report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/index.html
rename to report/extensions/paraswap-adapters/index.html
index 37ddb722..28ebe49c 100644
--- a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/index.html
+++ b/report/extensions/paraswap-adapters/index.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap
-
+ LCOV - lcov.info.p - extensions/paraswap-adapters
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
+
+
-
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../glass.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../../glass.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../updown.png) |
Rate |
@@ -96,117 +96,117 @@
Hit |
- AaveParaSwapFeeClaimer.sol |
+ AaveParaSwapFeeClaimer.sol |
-
+
|
- 100.0 % |
- 4 |
+ 50.0 % |
+ 8 |
4 |
- |
|
|
- 100.0 % |
- 4 |
+ 80.0 % |
+ 5 |
4 |
- BaseParaSwapAdapter.sol |
+ BaseParaSwapAdapter.sol |
-
+
|
- 100.0 % |
- 12 |
+ 92.3 % |
+ 13 |
12 |
- |
|
|
- 100.0 % |
- 5 |
+ 83.3 % |
+ 6 |
5 |
- BaseParaSwapBuyAdapter.sol |
+ BaseParaSwapBuyAdapter.sol |
-
+
|
- 100.0 % |
- 24 |
+ 82.8 % |
+ 29 |
24 |
- |
|
|
- 100.0 % |
- 1 |
+ 50.0 % |
+ 2 |
1 |
- BaseParaSwapSellAdapter.sol |
+ BaseParaSwapSellAdapter.sol |
-
+
|
- 100.0 % |
- 21 |
+ 80.8 % |
+ 26 |
21 |
- |
|
|
- 100.0 % |
- 1 |
+ 50.0 % |
+ 2 |
1 |
- ParaSwapLiquiditySwapAdapter.sol |
+ ParaSwapLiquiditySwapAdapter.sol |
-
+
|
- 100.0 % |
- 34 |
+ 97.1 % |
+ 35 |
34 |
- |
|
|
- 100.0 % |
- 3 |
+ 75.0 % |
+ 4 |
3 |
- ParaSwapRepayAdapter.sol |
+ ParaSwapRepayAdapter.sol |
-
+
|
- 100.0 % |
- 36 |
- 36 |
+ 93.0 % |
+ 43 |
+ 40 |
- |
|
|
- 100.0 % |
- 4 |
+ 80.0 % |
+ 5 |
4 |
- ParaSwapWithdrawSwapAdapter.sol |
+ ParaSwapWithdrawSwapAdapter.sol |
-
+
|
- 88.9 % |
+ 90.0 % |
+ 10 |
9 |
- 8 |
- |
|
|
- 50.0 % |
+ 66.7 % |
+ 3 |
2 |
- 1 |
diff --git a/report/extensions/static-a-token/ERC20AaveLMUpgradeable.sol.func-c.html b/report/extensions/static-a-token/ERC20AaveLMUpgradeable.sol.func-c.html
new file mode 100644
index 00000000..78256aa9
--- /dev/null
+++ b/report/extensions/static-a-token/ERC20AaveLMUpgradeable.sol.func-c.html
@@ -0,0 +1,238 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - extensions/static-a-token/ERC20AaveLMUpgradeable.sol - functions
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../glass.png) |
+
+ |
+
+
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+
+
+
+
diff --git a/report/extensions/static-a-token/ERC20AaveLMUpgradeable.sol.func.html b/report/extensions/static-a-token/ERC20AaveLMUpgradeable.sol.func.html
new file mode 100644
index 00000000..f908498b
--- /dev/null
+++ b/report/extensions/static-a-token/ERC20AaveLMUpgradeable.sol.func.html
@@ -0,0 +1,238 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - extensions/static-a-token/ERC20AaveLMUpgradeable.sol - functions
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../glass.png) |
+
+ |
+
+
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+
+
+
+
diff --git a/report/extensions/static-a-token/ERC20AaveLMUpgradeable.sol.gcov.html b/report/extensions/static-a-token/ERC20AaveLMUpgradeable.sol.gcov.html
new file mode 100644
index 00000000..2cf34616
--- /dev/null
+++ b/report/extensions/static-a-token/ERC20AaveLMUpgradeable.sol.gcov.html
@@ -0,0 +1,391 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - extensions/static-a-token/ERC20AaveLMUpgradeable.sol
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../glass.png) |
+
+ |
+
+
+ ![](../../glass.png) |
+
+
+
+
+
|
+
+
+
+ Branch data Line data Source code
+
+ 1 : : // SPDX-License-Identifier: BUSL-1.1
+ 2 : : pragma solidity ^0.8.17;
+ 3 : :
+ 4 : : import {ERC20Upgradeable} from 'openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol';
+ 5 : : import {IERC20} from 'openzeppelin-contracts/contracts/interfaces/IERC20.sol';
+ 6 : : import {SafeERC20} from 'openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol';
+ 7 : : import {SafeCast} from 'solidity-utils/contracts/oz-common/SafeCast.sol';
+ 8 : :
+ 9 : : import {IRewardsController} from '../../rewards/interfaces/IRewardsController.sol';
+ 10 : : import {IERC20AaveLM} from './interfaces/IERC20AaveLM.sol';
+ 11 : :
+ 12 : : /**
+ 13 : : * @title ERC20AaveLMUpgradeable.sol
+ 14 : : * @notice Wrapper smart contract that supports tracking and claiming liquidity mining rewards from the Aave system
+ 15 : : * @dev ERC20 extension, so ERC20 initialization should be done by the children contract/s
+ 16 : : * @author BGD labs
+ 17 : : */
+ 18 : : abstract contract ERC20AaveLMUpgradeable is ERC20Upgradeable, IERC20AaveLM {
+ 19 : : using SafeCast for uint256;
+ 20 : :
+ 21 : : /// @custom:storage-location erc7201:aave-dao.storage.ERC20AaveLM
+ 22 : : struct ERC20AaveLMStorage {
+ 23 : : address _referenceAsset; // a/v token to track rewards on INCENTIVES_CONTROLLER
+ 24 : : address[] _rewardTokens;
+ 25 : : mapping(address user => RewardIndexCache cache) _startIndex;
+ 26 : : mapping(address user => mapping(address reward => UserRewardsData cache)) _userRewardsData;
+ 27 : : }
+ 28 : :
+ 29 : : // keccak256(abi.encode(uint256(keccak256("aave-dao.storage.ERC20AaveLM")) - 1)) & ~bytes32(uint256(0xff))
+ 30 : : bytes32 private constant ERC20AaveLMStorageLocation =
+ 31 : : 0x4fad66563f105be0bff96185c9058c4934b504d3ba15ca31e86294f0b01fd200;
+ 32 : :
+ 33 : : function _getERC20AaveLMStorage() private pure returns (ERC20AaveLMStorage storage $) {
+ 34 : : assembly {
+ 35 : 119662 : $.slot := ERC20AaveLMStorageLocation
+ 36 : : }
+ 37 : : }
+ 38 : :
+ 39 : : IRewardsController public immutable INCENTIVES_CONTROLLER;
+ 40 : :
+ 41 : : constructor(IRewardsController rewardsController) {
+ 42 : 0 : INCENTIVES_CONTROLLER = rewardsController;
+ 43 : : }
+ 44 : :
+ 45 : : function __ERC20AaveLM_init(address referenceAsset_) internal onlyInitializing {
+ 46 : 85 : __ERC20AaveLM_init_unchained(referenceAsset_);
+ 47 : : }
+ 48 : :
+ 49 : : function __ERC20AaveLM_init_unchained(address referenceAsset_) internal onlyInitializing {
+ 50 : 85 : ERC20AaveLMStorage storage $ = _getERC20AaveLMStorage();
+ 51 : 85 : $._referenceAsset = referenceAsset_;
+ 52 : :
+ 53 : 85 : if (INCENTIVES_CONTROLLER != IRewardsController(address(0))) {
+ 54 : 85 : refreshRewardTokens();
+ 55 : : }
+ 56 : : }
+ 57 : :
+ 58 : : ///@inheritdoc IERC20AaveLM
+ 59 : : function claimRewardsOnBehalf(
+ 60 : : address onBehalfOf,
+ 61 : : address receiver,
+ 62 : : address[] memory rewards
+ 63 : : ) external {
+ 64 : 3000 : address msgSender = _msgSender();
+ 65 : 3000 : if (msgSender != onBehalfOf && msgSender != INCENTIVES_CONTROLLER.getClaimer(onBehalfOf)) {
+ 66 : 1000 : revert InvalidClaimer(msgSender);
+ 67 : : }
+ 68 : :
+ 69 : 2000 : _claimRewardsOnBehalf(onBehalfOf, receiver, rewards);
+ 70 : : }
+ 71 : :
+ 72 : : ///@inheritdoc IERC20AaveLM
+ 73 : : function claimRewards(address receiver, address[] memory rewards) external {
+ 74 : 1000 : _claimRewardsOnBehalf(_msgSender(), receiver, rewards);
+ 75 : : }
+ 76 : :
+ 77 : : ///@inheritdoc IERC20AaveLM
+ 78 : : function claimRewardsToSelf(address[] memory rewards) external {
+ 79 : 1001 : _claimRewardsOnBehalf(_msgSender(), _msgSender(), rewards);
+ 80 : : }
+ 81 : :
+ 82 : : ///@inheritdoc IERC20AaveLM
+ 83 : : function refreshRewardTokens() public override {
+ 84 : 9088 : ERC20AaveLMStorage storage $ = _getERC20AaveLMStorage();
+ 85 : 9088 : address[] memory rewards = INCENTIVES_CONTROLLER.getRewardsByAsset($._referenceAsset);
+ 86 : 9088 : for (uint256 i = 0; i < rewards.length; i++) {
+ 87 : 9003 : _registerRewardToken(rewards[i]);
+ 88 : : }
+ 89 : : }
+ 90 : :
+ 91 : : ///@inheritdoc IERC20AaveLM
+ 92 : : function collectAndUpdateRewards(address reward) public returns (uint256) {
+ 93 : 2517 : if (reward == address(0)) {
+ 94 : 0 : return 0;
+ 95 : : }
+ 96 : :
+ 97 : 2517 : ERC20AaveLMStorage storage $ = _getERC20AaveLMStorage();
+ 98 : 2517 : address[] memory assets = new address[](1);
+ 99 : 2517 : assets[0] = address($._referenceAsset);
+ 100 : :
+ 101 : 2517 : return INCENTIVES_CONTROLLER.claimRewards(assets, type(uint256).max, address(this), reward);
+ 102 : : }
+ 103 : :
+ 104 : : ///@inheritdoc IERC20AaveLM
+ 105 : : function isRegisteredRewardToken(address reward) public view override returns (bool) {
+ 106 : 9006 : ERC20AaveLMStorage storage $ = _getERC20AaveLMStorage();
+ 107 : 9006 : return $._startIndex[reward].isRegistered;
+ 108 : : }
+ 109 : :
+ 110 : : ///@inheritdoc IERC20AaveLM
+ 111 : : function getCurrentRewardsIndex(address reward) public view returns (uint256) {
+ 112 : 37953 : if (address(reward) == address(0)) {
+ 113 : 0 : return 0;
+ 114 : : }
+ 115 : 37953 : ERC20AaveLMStorage storage $ = _getERC20AaveLMStorage();
+ 116 : 37953 : (, uint256 nextIndex) = INCENTIVES_CONTROLLER.getAssetIndex($._referenceAsset, reward);
+ 117 : 37953 : return nextIndex;
+ 118 : : }
+ 119 : :
+ 120 : : ///@inheritdoc IERC20AaveLM
+ 121 : : function getTotalClaimableRewards(address reward) external view returns (uint256) {
+ 122 : 1001 : if (reward == address(0)) {
+ 123 : 0 : return 0;
+ 124 : : }
+ 125 : :
+ 126 : 1001 : ERC20AaveLMStorage storage $ = _getERC20AaveLMStorage();
+ 127 : 1001 : address[] memory assets = new address[](1);
+ 128 : 1001 : assets[0] = $._referenceAsset;
+ 129 : 1001 : uint256 freshRewards = INCENTIVES_CONTROLLER.getUserRewards(assets, address(this), reward);
+ 130 : 1001 : return IERC20(reward).balanceOf(address(this)) + freshRewards;
+ 131 : : }
+ 132 : :
+ 133 : : ///@inheritdoc IERC20AaveLM
+ 134 : : function getClaimableRewards(address user, address reward) external view returns (uint256) {
+ 135 : 13361 : return _getClaimableRewards(user, reward, balanceOf(user), getCurrentRewardsIndex(reward));
+ 136 : : }
+ 137 : :
+ 138 : : ///@inheritdoc IERC20AaveLM
+ 139 : : function getUnclaimedRewards(address user, address reward) external view returns (uint256) {
+ 140 : 4356 : ERC20AaveLMStorage storage $ = _getERC20AaveLMStorage();
+ 141 : 4356 : return $._userRewardsData[user][reward].unclaimedRewards;
+ 142 : : }
+ 143 : :
+ 144 : : ///@inheritdoc IERC20AaveLM
+ 145 : : function getReferenceAsset() external view returns (address) {
+ 146 : 2 : ERC20AaveLMStorage storage $ = _getERC20AaveLMStorage();
+ 147 : 2 : return $._referenceAsset;
+ 148 : : }
+ 149 : :
+ 150 : : ///@inheritdoc IERC20AaveLM
+ 151 : : function rewardTokens() external view returns (address[] memory) {
+ 152 : 1 : ERC20AaveLMStorage storage $ = _getERC20AaveLMStorage();
+ 153 : 1 : return $._rewardTokens;
+ 154 : : }
+ 155 : :
+ 156 : : /**
+ 157 : : * @notice Updates rewards for senders and receiver in a transfer (not updating rewards for address(0))
+ 158 : : * @param from The address of the sender of tokens
+ 159 : : * @param to The address of the receiver of tokens
+ 160 : : */
+ 161 : : function _update(address from, address to, uint256 amount) internal virtual override {
+ 162 : 12595 : ERC20AaveLMStorage storage $ = _getERC20AaveLMStorage();
+ 163 : 12595 : for (uint256 i = 0; i < $._rewardTokens.length; i++) {
+ 164 : 11589 : address rewardToken = address($._rewardTokens[i]);
+ 165 : 11589 : uint256 rewardsIndex = getCurrentRewardsIndex(rewardToken);
+ 166 : 11589 : if (from != address(0)) {
+ 167 : 2000 : _updateUser(from, rewardsIndex, rewardToken);
+ 168 : : }
+ 169 : 11589 : if (to != address(0) && from != to) {
+ 170 : 10589 : _updateUser(to, rewardsIndex, rewardToken);
+ 171 : : }
+ 172 : : }
+ 173 : 12595 : super._update(from, to, amount);
+ 174 : : }
+ 175 : :
+ 176 : : /**
+ 177 : : * @notice Adding the pending rewards to the unclaimed for specific user and updating user index
+ 178 : : * @param user The address of the user to update
+ 179 : : * @param currentRewardsIndex The current rewardIndex
+ 180 : : * @param rewardToken The address of the reward token
+ 181 : : */
+ 182 : : function _updateUser(address user, uint256 currentRewardsIndex, address rewardToken) internal {
+ 183 : 12589 : ERC20AaveLMStorage storage $ = _getERC20AaveLMStorage();
+ 184 : 12589 : uint256 balance = balanceOf(user);
+ 185 : 12589 : if (balance > 0) {
+ 186 : 2589 : $._userRewardsData[user][rewardToken].unclaimedRewards = _getClaimableRewards(
+ 187 : : user,
+ 188 : : rewardToken,
+ 189 : : balance,
+ 190 : : currentRewardsIndex
+ 191 : : ).toUint128();
+ 192 : : }
+ 193 : 12589 : $._userRewardsData[user][rewardToken].rewardsIndexOnLastInteraction = currentRewardsIndex
+ 194 : : .toUint128();
+ 195 : : }
+ 196 : :
+ 197 : : /**
+ 198 : : * @notice Compute the pending in WAD. Pending is the amount to add (not yet unclaimed) rewards in WAD.
+ 199 : : * @param balance The balance of the user
+ 200 : : * @param rewardsIndexOnLastInteraction The index which was on the last interaction of the user
+ 201 : : * @param currentRewardsIndex The current rewards index in the system
+ 202 : : * @return The amount of pending rewards in WAD
+ 203 : : */
+ 204 : : function _getPendingRewards(
+ 205 : : uint256 balance,
+ 206 : : uint256 rewardsIndexOnLastInteraction,
+ 207 : : uint256 currentRewardsIndex
+ 208 : : ) internal view returns (uint256) {
+ 209 : 19949 : if (balance == 0) {
+ 210 : 0 : return 0;
+ 211 : : }
+ 212 : 19949 : return (balance * (currentRewardsIndex - rewardsIndexOnLastInteraction)) / 10 ** decimals();
+ 213 : : }
+ 214 : :
+ 215 : : /**
+ 216 : : * @notice Compute the claimable rewards for a user
+ 217 : : * @param user The address of the user
+ 218 : : * @param reward The address of the reward
+ 219 : : * @param balance The balance of the user in WAD
+ 220 : : * @param currentRewardsIndex The current rewards index
+ 221 : : * @return The total rewards that can be claimed by the user (if `fresh` flag true, after updating rewards)
+ 222 : : */
+ 223 : : function _getClaimableRewards(
+ 224 : : address user,
+ 225 : : address reward,
+ 226 : : uint256 balance,
+ 227 : : uint256 currentRewardsIndex
+ 228 : : ) internal view returns (uint256) {
+ 229 : 19950 : ERC20AaveLMStorage storage $ = _getERC20AaveLMStorage();
+ 230 : 19950 : RewardIndexCache memory rewardsIndexCache = $._startIndex[reward];
+ 231 : 19950 : if (!rewardsIndexCache.isRegistered) {
+ 232 : 1 : revert RewardNotInitialized(reward);
+ 233 : : }
+ 234 : :
+ 235 : 19949 : UserRewardsData memory currentUserRewardsData = $._userRewardsData[user][reward];
+ 236 : 19949 : return
+ 237 : 19949 : currentUserRewardsData.unclaimedRewards +
+ 238 : 19949 : _getPendingRewards(
+ 239 : : balance,
+ 240 : : currentUserRewardsData.rewardsIndexOnLastInteraction == 0
+ 241 : : ? rewardsIndexCache.lastUpdatedIndex
+ 242 : : : currentUserRewardsData.rewardsIndexOnLastInteraction,
+ 243 : : currentRewardsIndex
+ 244 : : );
+ 245 : : }
+ 246 : :
+ 247 : : /**
+ 248 : : * @notice Claim rewards on behalf of a user and send them to a receiver
+ 249 : : * @param onBehalfOf The address to claim on behalf of
+ 250 : : * @param rewards The addresses of the rewards
+ 251 : : * @param receiver The address to receive the rewards
+ 252 : : */
+ 253 : : function _claimRewardsOnBehalf(
+ 254 : : address onBehalfOf,
+ 255 : : address receiver,
+ 256 : : address[] memory rewards
+ 257 : : ) internal virtual {
+ 258 : 4000 : for (uint256 i = 0; i < rewards.length; i++) {
+ 259 : 4000 : if (address(rewards[i]) == address(0)) {
+ 260 : 4000 : continue;
+ 261 : : }
+ 262 : 4000 : uint256 currentRewardsIndex = getCurrentRewardsIndex(rewards[i]);
+ 263 : 4000 : uint256 balance = balanceOf(onBehalfOf);
+ 264 : 4000 : uint256 userReward = _getClaimableRewards(
+ 265 : : onBehalfOf,
+ 266 : : rewards[i],
+ 267 : : balance,
+ 268 : : currentRewardsIndex
+ 269 : : );
+ 270 : 4000 : uint256 totalRewardTokenBalance = IERC20(rewards[i]).balanceOf(address(this));
+ 271 : 4000 : uint256 unclaimedReward = 0;
+ 272 : :
+ 273 : 4000 : if (userReward > totalRewardTokenBalance) {
+ 274 : 1516 : totalRewardTokenBalance += collectAndUpdateRewards(address(rewards[i]));
+ 275 : : }
+ 276 : :
+ 277 : 4000 : if (userReward > totalRewardTokenBalance) {
+ 278 : 0 : unclaimedReward = userReward - totalRewardTokenBalance;
+ 279 : 0 : userReward = totalRewardTokenBalance;
+ 280 : : }
+ 281 : 4000 : if (userReward > 0) {
+ 282 : 1516 : ERC20AaveLMStorage storage $ = _getERC20AaveLMStorage();
+ 283 : 1516 : $._userRewardsData[onBehalfOf][rewards[i]].unclaimedRewards = unclaimedReward.toUint128();
+ 284 : 1516 : $
+ 285 : : ._userRewardsData[onBehalfOf][rewards[i]]
+ 286 : : .rewardsIndexOnLastInteraction = currentRewardsIndex.toUint128();
+ 287 : 1516 : SafeERC20.safeTransfer(IERC20(rewards[i]), receiver, userReward);
+ 288 : : }
+ 289 : : }
+ 290 : : }
+ 291 : :
+ 292 : : /**
+ 293 : : * @notice Initializes a new rewardToken
+ 294 : : * @param reward The reward token to be registered
+ 295 : : */
+ 296 : : function _registerRewardToken(address reward) internal {
+ 297 : 9003 : if (isRegisteredRewardToken(reward)) return;
+ 298 : 9003 : uint256 startIndex = getCurrentRewardsIndex(reward);
+ 299 : :
+ 300 : 9003 : ERC20AaveLMStorage storage $ = _getERC20AaveLMStorage();
+ 301 : 9003 : $._rewardTokens.push(reward);
+ 302 : 9003 : $._startIndex[reward] = RewardIndexCache(true, startIndex.toUint240());
+ 303 : :
+ 304 : 9003 : emit RewardTokenRegistered(reward, startIndex);
+ 305 : : }
+ 306 : : }
+
+ |
+
+
+
+
+
+
+
+
+
diff --git a/report/extensions/static-a-token/ERC4626StataTokenUpgradeable.sol.func-c.html b/report/extensions/static-a-token/ERC4626StataTokenUpgradeable.sol.func-c.html
new file mode 100644
index 00000000..4565cd95
--- /dev/null
+++ b/report/extensions/static-a-token/ERC4626StataTokenUpgradeable.sol.func-c.html
@@ -0,0 +1,217 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - extensions/static-a-token/ERC4626StataTokenUpgradeable.sol - functions
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../glass.png) |
+
+ |
+
+
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+
+
+
+
diff --git a/report/extensions/static-a-token/ERC4626StataTokenUpgradeable.sol.func.html b/report/extensions/static-a-token/ERC4626StataTokenUpgradeable.sol.func.html
new file mode 100644
index 00000000..07cfdf4a
--- /dev/null
+++ b/report/extensions/static-a-token/ERC4626StataTokenUpgradeable.sol.func.html
@@ -0,0 +1,217 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - extensions/static-a-token/ERC4626StataTokenUpgradeable.sol - functions
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../glass.png) |
+
+ |
+
+
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+
+
+
+
diff --git a/report/extensions/static-a-token/ERC4626StataTokenUpgradeable.sol.gcov.html b/report/extensions/static-a-token/ERC4626StataTokenUpgradeable.sol.gcov.html
new file mode 100644
index 00000000..15185fe5
--- /dev/null
+++ b/report/extensions/static-a-token/ERC4626StataTokenUpgradeable.sol.gcov.html
@@ -0,0 +1,376 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - extensions/static-a-token/ERC4626StataTokenUpgradeable.sol
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../glass.png) |
+
+ |
+
+
+ ![](../../glass.png) |
+
+
+
+
+
|
+
+
+
+ Branch data Line data Source code
+
+ 1 : : // SPDX-License-Identifier: BUSL-1.1
+ 2 : : pragma solidity ^0.8.17;
+ 3 : :
+ 4 : : import {ERC4626Upgradeable, Math, IERC4626} from 'openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/ERC4626Upgradeable.sol';
+ 5 : : import {SafeERC20, IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol';
+ 6 : : import {IERC20Permit} from 'openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol';
+ 7 : :
+ 8 : : import {IPool, IPoolAddressesProvider} from '../../interfaces/IPool.sol';
+ 9 : : import {IAaveOracle} from '../../interfaces/IAaveOracle.sol';
+ 10 : : import {DataTypes, ReserveConfiguration} from '../../protocol/libraries/configuration/ReserveConfiguration.sol';
+ 11 : :
+ 12 : : import {IAToken} from './interfaces/IAToken.sol';
+ 13 : : import {IERC4626StataToken} from './interfaces/IERC4626StataToken.sol';
+ 14 : :
+ 15 : : /**
+ 16 : : * @title ERC4626StataTokenUpgradeable
+ 17 : : * @notice Wrapper smart contract that allows to deposit tokens on the Aave protocol and receive
+ 18 : : * a token which balance doesn't increase automatically, but uses an ever-increasing exchange rate.
+ 19 : : * @dev ERC20 extension, so ERC20 initialization should be done by the children contract/s
+ 20 : : * @author BGD labs
+ 21 : : */
+ 22 : : abstract contract ERC4626StataTokenUpgradeable is ERC4626Upgradeable, IERC4626StataToken {
+ 23 : : using Math for uint256;
+ 24 : :
+ 25 : : /// @custom:storage-location erc7201:aave-dao.storage.ERC4626StataToken
+ 26 : : struct ERC4626StataTokenStorage {
+ 27 : : IERC20 _aToken;
+ 28 : : }
+ 29 : :
+ 30 : : // keccak256(abi.encode(uint256(keccak256("aave-dao.storage.ERC4626StataToken")) - 1)) & ~bytes32(uint256(0xff))
+ 31 : : bytes32 private constant ERC4626StataTokenStorageLocation =
+ 32 : : 0x55029d3f54709e547ed74b2fc842d93107ab1490ab7555dd9dd0bf6451101900;
+ 33 : :
+ 34 : : function _getERC4626StataTokenStorage()
+ 35 : : private
+ 36 : : pure
+ 37 : : returns (ERC4626StataTokenStorage storage $)
+ 38 : : {
+ 39 : : assembly {
+ 40 : 21104 : $.slot := ERC4626StataTokenStorageLocation
+ 41 : : }
+ 42 : : }
+ 43 : :
+ 44 : : uint256 public constant RAY = 1e27;
+ 45 : :
+ 46 : : IPool public immutable POOL;
+ 47 : : IPoolAddressesProvider public immutable POOL_ADDRESSES_PROVIDER;
+ 48 : :
+ 49 : : constructor(IPool pool) {
+ 50 : 0 : POOL = pool;
+ 51 : 0 : POOL_ADDRESSES_PROVIDER = pool.ADDRESSES_PROVIDER();
+ 52 : : }
+ 53 : :
+ 54 : : function __ERC4626StataToken_init(address newAToken) internal onlyInitializing {
+ 55 : 97 : IERC20 aTokenUnderlying = __ERC4626StataToken_init_unchained(newAToken);
+ 56 : 97 : __ERC4626_init_unchained(aTokenUnderlying);
+ 57 : : }
+ 58 : :
+ 59 : : function __ERC4626StataToken_init_unchained(
+ 60 : : address newAToken
+ 61 : : ) internal onlyInitializing returns (IERC20) {
+ 62 : : // sanity check, to be sure that we support that version of the aToken
+ 63 : 97 : address poolOfAToken = IAToken(newAToken).POOL();
+ 64 : 97 : if (poolOfAToken != address(POOL)) revert PoolAddressMismatch(poolOfAToken);
+ 65 : :
+ 66 : 97 : IERC20 aTokenUnderlying = IERC20(IAToken(newAToken).UNDERLYING_ASSET_ADDRESS());
+ 67 : :
+ 68 : 97 : ERC4626StataTokenStorage storage $ = _getERC4626StataTokenStorage();
+ 69 : 97 : $._aToken = IERC20(newAToken);
+ 70 : :
+ 71 : 97 : SafeERC20.forceApprove(aTokenUnderlying, address(POOL), type(uint256).max);
+ 72 : :
+ 73 : 97 : return aTokenUnderlying;
+ 74 : : }
+ 75 : :
+ 76 : : ///@inheritdoc IERC4626StataToken
+ 77 : : function depositATokens(uint256 assets, address receiver) external returns (uint256) {
+ 78 : 12005 : uint256 shares = previewDeposit(assets);
+ 79 : 12005 : _deposit(_msgSender(), receiver, assets, shares, false);
+ 80 : :
+ 81 : 11005 : return shares;
+ 82 : : }
+ 83 : :
+ 84 : : ///@inheritdoc IERC4626StataToken
+ 85 : : function depositWithPermit(
+ 86 : : uint256 assets,
+ 87 : : address receiver,
+ 88 : : uint256 deadline,
+ 89 : : SignatureParams memory sig,
+ 90 : : bool depositToAave
+ 91 : : ) external returns (uint256) {
+ 92 : 5000 : IERC20Permit assetToDeposit = IERC20Permit(
+ 93 : : depositToAave ? asset() : address(_getERC4626StataTokenStorage()._aToken)
+ 94 : : );
+ 95 : :
+ 96 : : try
+ 97 : 5000 : assetToDeposit.permit(_msgSender(), address(this), assets, deadline, sig.v, sig.r, sig.s)
+ 98 : 0 : {} catch {}
+ 99 : :
+ 100 : 5000 : uint256 shares = previewDeposit(assets);
+ 101 : 5000 : _deposit(_msgSender(), receiver, assets, shares, depositToAave);
+ 102 : 4000 : return shares;
+ 103 : : }
+ 104 : :
+ 105 : : ///@inheritdoc IERC4626StataToken
+ 106 : : function redeemATokens(
+ 107 : : uint256 shares,
+ 108 : : address receiver,
+ 109 : : address owner
+ 110 : : ) external returns (uint256) {
+ 111 : 3000 : uint256 assets = previewRedeem(shares);
+ 112 : 3000 : _withdraw(_msgSender(), receiver, owner, assets, shares, false);
+ 113 : :
+ 114 : 2000 : return assets;
+ 115 : : }
+ 116 : :
+ 117 : : ///@inheritdoc IERC4626StataToken
+ 118 : : function aToken() public view returns (IERC20) {
+ 119 : 1002 : ERC4626StataTokenStorage storage $ = _getERC4626StataTokenStorage();
+ 120 : 1002 : return $._aToken;
+ 121 : : }
+ 122 : :
+ 123 : : ///@inheritdoc IERC4626
+ 124 : : function maxMint(address) public view override returns (uint256) {
+ 125 : 2002 : uint256 assets = maxDeposit(address(0));
+ 126 : 2002 : if (assets == type(uint256).max) return type(uint256).max;
+ 127 : 0 : return convertToShares(assets);
+ 128 : : }
+ 129 : :
+ 130 : : ///@inheritdoc IERC4626
+ 131 : : function maxWithdraw(address owner) public view override returns (uint256) {
+ 132 : 2002 : return convertToAssets(maxRedeem(owner));
+ 133 : : }
+ 134 : :
+ 135 : : ///@inheritdoc IERC4626
+ 136 : : function totalAssets() public view override returns (uint256) {
+ 137 : 1002 : return _convertToAssets(totalSupply(), Math.Rounding.Floor);
+ 138 : : }
+ 139 : :
+ 140 : : ///@inheritdoc IERC4626
+ 141 : : function maxRedeem(address owner) public view override returns (uint256) {
+ 142 : 6005 : DataTypes.ReserveData memory reserveData = POOL.getReserveDataExtended(asset());
+ 143 : :
+ 144 : : // if paused or inactive users cannot withdraw underlying
+ 145 : : if (
+ 146 : 6005 : !ReserveConfiguration.getActive(reserveData.configuration) ||
+ 147 : 6005 : ReserveConfiguration.getPaused(reserveData.configuration)
+ 148 : : ) {
+ 149 : 1000 : return 0;
+ 150 : : }
+ 151 : :
+ 152 : : // otherwise users can withdraw up to the available amount
+ 153 : 5005 : uint256 underlyingTokenBalanceInShares = convertToShares(reserveData.virtualUnderlyingBalance);
+ 154 : 5005 : uint256 cachedUserBalance = balanceOf(owner);
+ 155 : 5005 : return
+ 156 : 5005 : underlyingTokenBalanceInShares >= cachedUserBalance
+ 157 : : ? cachedUserBalance
+ 158 : : : underlyingTokenBalanceInShares;
+ 159 : : }
+ 160 : :
+ 161 : : ///@inheritdoc IERC4626
+ 162 : : function maxDeposit(address) public view override returns (uint256) {
+ 163 : 3006 : DataTypes.ReserveDataLegacy memory reserveData = POOL.getReserveData(asset());
+ 164 : :
+ 165 : : // if inactive, paused or frozen users cannot deposit underlying
+ 166 : : if (
+ 167 : 3006 : !ReserveConfiguration.getActive(reserveData.configuration) ||
+ 168 : 3006 : ReserveConfiguration.getPaused(reserveData.configuration) ||
+ 169 : 3005 : ReserveConfiguration.getFrozen(reserveData.configuration)
+ 170 : : ) {
+ 171 : 2 : return 0;
+ 172 : : }
+ 173 : :
+ 174 : 3004 : uint256 supplyCap = ReserveConfiguration.getSupplyCap(reserveData.configuration) *
+ 175 : : (10 ** ReserveConfiguration.getDecimals(reserveData.configuration));
+ 176 : : // if no supply cap deposit is unlimited
+ 177 : 3004 : if (supplyCap == 0) return type(uint256).max;
+ 178 : :
+ 179 : : // return remaining supply cap margin
+ 180 : 1000 : uint256 currentSupply = (IAToken(reserveData.aTokenAddress).scaledTotalSupply() +
+ 181 : : reserveData.accruedToTreasury).mulDiv(_rate(), RAY, Math.Rounding.Ceil);
+ 182 : 1000 : return currentSupply > supplyCap ? 0 : supplyCap - currentSupply;
+ 183 : : }
+ 184 : :
+ 185 : : ///@inheritdoc IERC4626StataToken
+ 186 : : function latestAnswer() external view returns (int256) {
+ 187 : 1001 : uint256 aTokenUnderlyingAssetPrice = IAaveOracle(POOL_ADDRESSES_PROVIDER.getPriceOracle())
+ 188 : : .getAssetPrice(asset());
+ 189 : : // @notice aTokenUnderlyingAssetPrice * rate / RAY
+ 190 : 1001 : return int256(aTokenUnderlyingAssetPrice.mulDiv(_rate(), RAY, Math.Rounding.Floor));
+ 191 : : }
+ 192 : :
+ 193 : : function _deposit(
+ 194 : : address caller,
+ 195 : : address receiver,
+ 196 : : uint256 assets,
+ 197 : : uint256 shares,
+ 198 : : bool depositToAave
+ 199 : : ) internal virtual {
+ 200 : 19007 : if (shares == 0) {
+ 201 : 0 : revert StaticATokenInvalidZeroShares();
+ 202 : : }
+ 203 : : // If _asset is ERC777, `transferFrom` can trigger a reentrancy BEFORE the transfer happens through the
+ 204 : : // `tokensToSend` hook. On the other hand, the `tokenReceived` hook, that is triggered after the transfer,
+ 205 : : // calls the vault, which is assumed not malicious.
+ 206 : : //
+ 207 : : // Conclusion: we need to do the transfer before we mint so that any reentrancy would happen before the
+ 208 : : // assets are transferred and before the shares are minted, which is a valid state.
+ 209 : : // slither-disable-next-line reentrancy-no-eth
+ 210 : :
+ 211 : 19007 : if (depositToAave) {
+ 212 : 4002 : address cachedAsset = asset();
+ 213 : 4002 : SafeERC20.safeTransferFrom(IERC20(cachedAsset), caller, address(this), assets);
+ 214 : 3002 : POOL.deposit(cachedAsset, assets, address(this), 0);
+ 215 : : } else {
+ 216 : 15005 : ERC4626StataTokenStorage storage $ = _getERC4626StataTokenStorage();
+ 217 : 15005 : SafeERC20.safeTransferFrom($._aToken, caller, address(this), assets);
+ 218 : : }
+ 219 : 16007 : _mint(receiver, shares);
+ 220 : :
+ 221 : 16005 : emit Deposit(caller, receiver, assets, shares);
+ 222 : : }
+ 223 : :
+ 224 : : function _deposit(
+ 225 : : address caller,
+ 226 : : address receiver,
+ 227 : : uint256 assets,
+ 228 : : uint256 shares
+ 229 : : ) internal virtual override {
+ 230 : 2002 : _deposit(caller, receiver, assets, shares, true);
+ 231 : : }
+ 232 : :
+ 233 : : function _withdraw(
+ 234 : : address caller,
+ 235 : : address receiver,
+ 236 : : address owner,
+ 237 : : uint256 assets,
+ 238 : : uint256 shares,
+ 239 : : bool withdrawFromAave
+ 240 : : ) internal virtual {
+ 241 : 5002 : if (caller != owner) {
+ 242 : 2000 : _spendAllowance(owner, caller, shares);
+ 243 : : }
+ 244 : :
+ 245 : : // If _asset is ERC777, `transfer` can trigger a reentrancy AFTER the transfer happens through the
+ 246 : : // `tokensReceived` hook. On the other hand, the `tokensToSend` hook, that is triggered before the transfer,
+ 247 : : // calls the vault, which is assumed not malicious.
+ 248 : : //
+ 249 : : // Conclusion: we need to do the transfer after the burn so that any reentrancy would happen after the
+ 250 : : // shares are burned and after the assets are transferred, which is a valid state.
+ 251 : 4002 : _burn(owner, shares);
+ 252 : 4000 : if (withdrawFromAave) {
+ 253 : 2000 : POOL.withdraw(asset(), assets, receiver);
+ 254 : : } else {
+ 255 : 2000 : ERC4626StataTokenStorage storage $ = _getERC4626StataTokenStorage();
+ 256 : 2000 : SafeERC20.safeTransfer($._aToken, receiver, assets);
+ 257 : : }
+ 258 : :
+ 259 : 4000 : emit Withdraw(caller, receiver, owner, assets, shares);
+ 260 : : }
+ 261 : :
+ 262 : : function _withdraw(
+ 263 : : address caller,
+ 264 : : address receiver,
+ 265 : : address owner,
+ 266 : : uint256 assets,
+ 267 : : uint256 shares
+ 268 : : ) internal virtual override {
+ 269 : 2002 : _withdraw(caller, receiver, owner, assets, shares, true);
+ 270 : : }
+ 271 : :
+ 272 : : function _convertToShares(
+ 273 : : uint256 assets,
+ 274 : : Math.Rounding rounding
+ 275 : : ) internal view virtual override returns (uint256) {
+ 276 : : // * @notice assets * RAY / exchangeRate
+ 277 : 28013 : return assets.mulDiv(RAY, _rate(), rounding);
+ 278 : : }
+ 279 : :
+ 280 : : function _convertToAssets(
+ 281 : : uint256 shares,
+ 282 : : Math.Rounding rounding
+ 283 : : ) internal view virtual override returns (uint256) {
+ 284 : : // * @notice share * exchangeRate / RAY
+ 285 : 14007 : return shares.mulDiv(_rate(), RAY, rounding);
+ 286 : : }
+ 287 : :
+ 288 : : function _rate() internal view returns (uint256) {
+ 289 : 44021 : return POOL.getReserveNormalizedIncome(asset());
+ 290 : : }
+ 291 : : }
+
+ |
+
+
+
+
+
+
+
+
+
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/BorrowLogic.sol.func-c.html b/report/extensions/static-a-token/StataTokenFactory.sol.func-c.html
similarity index 50%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/BorrowLogic.sol.func-c.html
rename to report/extensions/static-a-token/StataTokenFactory.sol.func-c.html
index b8d88ccc..e70d06ee 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/BorrowLogic.sol.func-c.html
+++ b/report/extensions/static-a-token/StataTokenFactory.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/BorrowLogic.sol - functions
-
+ LCOV - lcov.info.p - extensions/static-a-token/StataTokenFactory.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,49 +53,56 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../glass.png) |
- BorrowLogic.executeRebalanceStableBorrowRate |
+ StataTokenFactory. |
- 5 |
+ 0 |
- BorrowLogic.executeSwapBorrowRateMode |
+ StataTokenFactory.getStataTokens |
- 8 |
+ 0 |
- BorrowLogic.executeRepay |
+ StataTokenFactory.createStataTokens |
- 5029 |
+ 23 |
- BorrowLogic.executeBorrow |
+ StataTokenFactory.getStataToken |
- 9117 |
+ 23 |
+
+
+
+
+ StataTokenFactory.initialize |
+
+ 655 |
@@ -103,8 +110,8 @@
diff --git a/report/extensions/static-a-token/StataTokenFactory.sol.func.html b/report/extensions/static-a-token/StataTokenFactory.sol.func.html
new file mode 100644
index 00000000..a0807d2d
--- /dev/null
+++ b/report/extensions/static-a-token/StataTokenFactory.sol.func.html
@@ -0,0 +1,119 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - extensions/static-a-token/StataTokenFactory.sol - functions
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../glass.png) |
+
+ |
+
+
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+
+
+
+
diff --git a/report/extensions/static-a-token/StataTokenFactory.sol.gcov.html b/report/extensions/static-a-token/StataTokenFactory.sol.gcov.html
new file mode 100644
index 00000000..d2463089
--- /dev/null
+++ b/report/extensions/static-a-token/StataTokenFactory.sol.gcov.html
@@ -0,0 +1,176 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - extensions/static-a-token/StataTokenFactory.sol
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../glass.png) |
+
+ |
+
+
+ ![](../../glass.png) |
+
+
+
+
+
|
+
+
+
+ Branch data Line data Source code
+
+ 1 : : // SPDX-License-Identifier: BUSL-1.1
+ 2 : : pragma solidity ^0.8.10;
+ 3 : :
+ 4 : : import {IERC20Metadata} from 'solidity-utils/contracts/oz-common/interfaces/IERC20Metadata.sol';
+ 5 : : import {ITransparentProxyFactory} from 'solidity-utils/contracts/transparent-proxy/interfaces/ITransparentProxyFactory.sol';
+ 6 : : import {Initializable} from 'solidity-utils/contracts/transparent-proxy/Initializable.sol';
+ 7 : : import {IPool, DataTypes} from '../../../contracts/interfaces/IPool.sol';
+ 8 : : import {StataTokenV2} from './StataTokenV2.sol';
+ 9 : : import {IStataTokenFactory} from './interfaces/IStataTokenFactory.sol';
+ 10 : :
+ 11 : : /**
+ 12 : : * @title StataTokenFactory
+ 13 : : * @notice Factory contract that keeps track of all deployed StataTokens for a specified pool.
+ 14 : : * This registry also acts as a factory, allowing to deploy new StataTokens on demand.
+ 15 : : * There can only be one StataToken per underlying on the registry at any time.
+ 16 : : * @author BGD labs
+ 17 : : */
+ 18 : : contract StataTokenFactory is Initializable, IStataTokenFactory {
+ 19 : : IPool public immutable POOL;
+ 20 : : address public immutable PROXY_ADMIN;
+ 21 : : ITransparentProxyFactory public immutable TRANSPARENT_PROXY_FACTORY;
+ 22 : : address public immutable STATA_TOKEN_IMPL;
+ 23 : :
+ 24 : : mapping(address => address) internal _underlyingToStataToken;
+ 25 : : address[] internal _stataTokens;
+ 26 : :
+ 27 : : event StataTokenCreated(address indexed stataToken, address indexed underlying);
+ 28 : :
+ 29 : : constructor(
+ 30 : : IPool pool,
+ 31 : : address proxyAdmin,
+ 32 : : ITransparentProxyFactory transparentProxyFactory,
+ 33 : : address stataTokenImpl
+ 34 : : ) {
+ 35 : 0 : POOL = pool;
+ 36 : 0 : PROXY_ADMIN = proxyAdmin;
+ 37 : 0 : TRANSPARENT_PROXY_FACTORY = transparentProxyFactory;
+ 38 : 0 : STATA_TOKEN_IMPL = stataTokenImpl;
+ 39 : : }
+ 40 : :
+ 41 : : function initialize() external initializer {}
+ 42 : :
+ 43 : : ///@inheritdoc IStataTokenFactory
+ 44 : : function createStataTokens(address[] memory underlyings) external returns (address[] memory) {
+ 45 : 23 : address[] memory stataTokens = new address[](underlyings.length);
+ 46 : 23 : for (uint256 i = 0; i < underlyings.length; i++) {
+ 47 : 69 : address cachedStataToken = _underlyingToStataToken[underlyings[i]];
+ 48 : 69 : if (cachedStataToken == address(0)) {
+ 49 : 69 : DataTypes.ReserveDataLegacy memory reserveData = POOL.getReserveData(underlyings[i]);
+ 50 : 69 : if (reserveData.aTokenAddress == address(0))
+ 51 : 0 : revert NotListedUnderlying(reserveData.aTokenAddress);
+ 52 : 69 : bytes memory symbol = abi.encodePacked(
+ 53 : : 'stat',
+ 54 : : IERC20Metadata(reserveData.aTokenAddress).symbol(),
+ 55 : : 'v2'
+ 56 : : );
+ 57 : 69 : address stataToken = TRANSPARENT_PROXY_FACTORY.createDeterministic(
+ 58 : : STATA_TOKEN_IMPL,
+ 59 : : PROXY_ADMIN,
+ 60 : : abi.encodeWithSelector(
+ 61 : : StataTokenV2.initialize.selector,
+ 62 : : reserveData.aTokenAddress,
+ 63 : : string(
+ 64 : : abi.encodePacked('Static ', IERC20Metadata(reserveData.aTokenAddress).name(), ' v2')
+ 65 : : ),
+ 66 : : string(symbol)
+ 67 : : ),
+ 68 : : bytes32(uint256(uint160(underlyings[i])))
+ 69 : : );
+ 70 : :
+ 71 : 69 : _underlyingToStataToken[underlyings[i]] = stataToken;
+ 72 : 69 : stataTokens[i] = stataToken;
+ 73 : 69 : _stataTokens.push(stataToken);
+ 74 : 69 : emit StataTokenCreated(stataToken, underlyings[i]);
+ 75 : : } else {
+ 76 : 0 : stataTokens[i] = cachedStataToken;
+ 77 : : }
+ 78 : : }
+ 79 : 23 : return stataTokens;
+ 80 : : }
+ 81 : :
+ 82 : : ///@inheritdoc IStataTokenFactory
+ 83 : : function getStataTokens() external view returns (address[] memory) {
+ 84 : 0 : return _stataTokens;
+ 85 : : }
+ 86 : :
+ 87 : : ///@inheritdoc IStataTokenFactory
+ 88 : : function getStataToken(address underlying) external view returns (address) {
+ 89 : 23 : return _underlyingToStataToken[underlying];
+ 90 : : }
+ 91 : : }
+
+ |
+
+
+
+
+
+
+
+
+
diff --git a/report/extensions/static-a-token/StataTokenV2.sol.func-c.html b/report/extensions/static-a-token/StataTokenV2.sol.func-c.html
new file mode 100644
index 00000000..86b8663e
--- /dev/null
+++ b/report/extensions/static-a-token/StataTokenV2.sol.func-c.html
@@ -0,0 +1,161 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - extensions/static-a-token/StataTokenV2.sol - functions
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../glass.png) |
+
+ |
+
+
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+
+
+
+
diff --git a/report/extensions/static-a-token/StataTokenV2.sol.func.html b/report/extensions/static-a-token/StataTokenV2.sol.func.html
new file mode 100644
index 00000000..c1164e33
--- /dev/null
+++ b/report/extensions/static-a-token/StataTokenV2.sol.func.html
@@ -0,0 +1,161 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - extensions/static-a-token/StataTokenV2.sol - functions
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../glass.png) |
+
+ |
+
+
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+
+
+
+
diff --git a/report/extensions/static-a-token/StataTokenV2.sol.gcov.html b/report/extensions/static-a-token/StataTokenV2.sol.gcov.html
new file mode 100644
index 00000000..1acc806f
--- /dev/null
+++ b/report/extensions/static-a-token/StataTokenV2.sol.gcov.html
@@ -0,0 +1,206 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - extensions/static-a-token/StataTokenV2.sol
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../glass.png) |
+
+ |
+
+
+ ![](../../glass.png) |
+
+
+
+
+
|
+
+
+
+ Branch data Line data Source code
+
+ 1 : : // SPDX-License-Identifier: BUSL-1.1
+ 2 : : pragma solidity ^0.8.0;
+ 3 : :
+ 4 : : import {ERC20Upgradeable, ERC20PermitUpgradeable} from 'openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/ERC20PermitUpgradeable.sol';
+ 5 : : import {IERC20Metadata} from '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';
+ 6 : : import {PausableUpgradeable} from 'openzeppelin-contracts-upgradeable/contracts/utils/PausableUpgradeable.sol';
+ 7 : : import {IRescuable, Rescuable} from 'solidity-utils/contracts/utils/Rescuable.sol';
+ 8 : : import {IRescuableBase, RescuableBase} from 'solidity-utils/contracts/utils/RescuableBase.sol';
+ 9 : : import {IERC20Permit} from '@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol';
+ 10 : :
+ 11 : : import {IACLManager} from '../../../contracts/interfaces/IACLManager.sol';
+ 12 : : import {ERC4626Upgradeable, ERC4626StataTokenUpgradeable, IPool, Math, IERC20} from './ERC4626StataTokenUpgradeable.sol';
+ 13 : : import {ERC20AaveLMUpgradeable, IRewardsController} from './ERC20AaveLMUpgradeable.sol';
+ 14 : : import {IStataTokenV2} from './interfaces/IStataTokenV2.sol';
+ 15 : : import {IAToken} from './interfaces/IAToken.sol';
+ 16 : :
+ 17 : : /**
+ 18 : : * @title StataTokenV2
+ 19 : : * @notice A 4626 Vault which wrapps aTokens in order to translate the rebasing nature of yield accrual into a non-rebasing value accrual.
+ 20 : : * @author BGD labs
+ 21 : : */
+ 22 : : contract StataTokenV2 is
+ 23 : : ERC20PermitUpgradeable,
+ 24 : : ERC20AaveLMUpgradeable,
+ 25 : : ERC4626StataTokenUpgradeable,
+ 26 : : PausableUpgradeable,
+ 27 : : Rescuable,
+ 28 : : IStataTokenV2
+ 29 : : {
+ 30 : : using Math for uint256;
+ 31 : :
+ 32 : : constructor(
+ 33 : : IPool pool,
+ 34 : : IRewardsController rewardsController
+ 35 : : ) ERC20AaveLMUpgradeable(rewardsController) ERC4626StataTokenUpgradeable(pool) {
+ 36 : 0 : _disableInitializers();
+ 37 : : }
+ 38 : :
+ 39 : : modifier onlyPauseGuardian() {
+ 40 : 1007 : if (!canPause(_msgSender())) revert OnlyPauseGuardian(_msgSender());
+ 41 : : _;
+ 42 : : }
+ 43 : :
+ 44 : : function initialize(
+ 45 : : address aToken,
+ 46 : : string calldata staticATokenName,
+ 47 : : string calldata staticATokenSymbol
+ 48 : : ) external initializer {
+ 49 : 69 : __ERC20_init(staticATokenName, staticATokenSymbol);
+ 50 : 69 : __ERC20Permit_init(staticATokenName);
+ 51 : 69 : __ERC20AaveLM_init(aToken);
+ 52 : 69 : __ERC4626StataToken_init(aToken);
+ 53 : 69 : __Pausable_init();
+ 54 : : }
+ 55 : :
+ 56 : : ///@inheritdoc IStataTokenV2
+ 57 : : function setPaused(bool paused) external onlyPauseGuardian {
+ 58 : 7 : if (paused) _pause();
+ 59 : 0 : else _unpause();
+ 60 : : }
+ 61 : :
+ 62 : : /// @inheritdoc IRescuable
+ 63 : : function whoCanRescue() public view override returns (address) {
+ 64 : 1003 : return POOL_ADDRESSES_PROVIDER.getACLAdmin();
+ 65 : : }
+ 66 : :
+ 67 : : /// @inheritdoc IRescuableBase
+ 68 : : function maxRescue(
+ 69 : : address asset
+ 70 : : ) public view override(IRescuableBase, RescuableBase) returns (uint256) {
+ 71 : 1002 : IERC20 cachedAToken = aToken();
+ 72 : 1002 : if (asset == address(cachedAToken)) {
+ 73 : 1001 : uint256 requiredBacking = _convertToAssets(totalSupply(), Math.Rounding.Ceil);
+ 74 : 1001 : uint256 balance = cachedAToken.balanceOf(address(this));
+ 75 : 1001 : return balance > requiredBacking ? balance - requiredBacking : 0;
+ 76 : : }
+ 77 : 1 : return type(uint256).max;
+ 78 : : }
+ 79 : :
+ 80 : : ///@inheritdoc IStataTokenV2
+ 81 : : function canPause(address actor) public view returns (bool) {
+ 82 : 2008 : return IACLManager(POOL_ADDRESSES_PROVIDER.getACLManager()).isEmergencyAdmin(actor);
+ 83 : : }
+ 84 : :
+ 85 : : ///@inheritdoc IERC20Permit
+ 86 : : function nonces(
+ 87 : : address owner
+ 88 : : ) public view virtual override(ERC20PermitUpgradeable, IERC20Permit) returns (uint256) {
+ 89 : 3 : return super.nonces(owner);
+ 90 : : }
+ 91 : :
+ 92 : : ///@inheritdoc IERC20Metadata
+ 93 : : function decimals()
+ 94 : : public
+ 95 : : view
+ 96 : : override(IERC20Metadata, ERC20Upgradeable, ERC4626Upgradeable)
+ 97 : : returns (uint8)
+ 98 : : {
+ 99 : : /// @notice The initialization of ERC4626Upgradeable already assures that decimal are
+ 100 : : /// the same as the underlying asset of the StataTokenV2, e.g. decimals of WETH for stataWETH
+ 101 : 1 : return ERC4626Upgradeable.decimals();
+ 102 : : }
+ 103 : :
+ 104 : : function _claimRewardsOnBehalf(
+ 105 : : address onBehalfOf,
+ 106 : : address receiver,
+ 107 : : address[] memory rewards
+ 108 : : ) internal virtual override whenNotPaused {
+ 109 : 0 : super._claimRewardsOnBehalf(onBehalfOf, receiver, rewards);
+ 110 : : }
+ 111 : :
+ 112 : : // @notice to merge inheritance with ERC20AaveLMUpgradeable.sol properly we put
+ 113 : : // `whenNotPaused` here instead of using ERC20PausableUpgradeable
+ 114 : : function _update(
+ 115 : : address from,
+ 116 : : address to,
+ 117 : : uint256 amount
+ 118 : : ) internal virtual override(ERC20AaveLMUpgradeable, ERC20Upgradeable) whenNotPaused {
+ 119 : 1004 : ERC20AaveLMUpgradeable._update(from, to, amount);
+ 120 : : }
+ 121 : : }
+
+ |
+
+
+
+
+
+
+
+
+
diff --git a/report/extensions/static-a-token/index-sort-b.html b/report/extensions/static-a-token/index-sort-b.html
new file mode 100644
index 00000000..ee99753c
--- /dev/null
+++ b/report/extensions/static-a-token/index-sort-b.html
@@ -0,0 +1,169 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - extensions/static-a-token
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../glass.png) |
+
+ |
+
+
+ ![](../../glass.png) |
+
+
+
+
+
+
+
|
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+ File ![Click to sort table by file name Sort by file name](../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../glass.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../updown.png) |
+
+
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+
+
+ ERC20AaveLMUpgradeable.sol |
+
+
+ |
+ 92.5 % |
+ 93 |
+ 86 |
+ - |
+ |
+ |
+ 90.9 % |
+ 22 |
+ 20 |
+
+
+ ERC4626StataTokenUpgradeable.sol |
+
+
+ |
+ 93.2 % |
+ 73 |
+ 68 |
+ - |
+ |
+ |
+ 89.5 % |
+ 19 |
+ 17 |
+
+
+ StataTokenFactory.sol |
+
+
+ |
+ 66.7 % |
+ 21 |
+ 14 |
+ - |
+ |
+ |
+ 60.0 % |
+ 5 |
+ 3 |
+
+
+ StataTokenV2.sol |
+
+
+ |
+ 85.7 % |
+ 21 |
+ 18 |
+ - |
+ |
+ |
+ 72.7 % |
+ 11 |
+ 8 |
+
+
+
+
+
+
+
+
+
+
diff --git a/report/extensions/static-a-token/index-sort-f.html b/report/extensions/static-a-token/index-sort-f.html
new file mode 100644
index 00000000..1ddeabca
--- /dev/null
+++ b/report/extensions/static-a-token/index-sort-f.html
@@ -0,0 +1,169 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - extensions/static-a-token
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../glass.png) |
+
+ |
+
+
+ ![](../../glass.png) |
+
+
+
+
+
+
+
|
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+ File ![Click to sort table by file name Sort by file name](../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../glass.png) |
+
+
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+
+
+ StataTokenFactory.sol |
+
+
+ |
+ 66.7 % |
+ 21 |
+ 14 |
+ - |
+ |
+ |
+ 60.0 % |
+ 5 |
+ 3 |
+
+
+ StataTokenV2.sol |
+
+
+ |
+ 85.7 % |
+ 21 |
+ 18 |
+ - |
+ |
+ |
+ 72.7 % |
+ 11 |
+ 8 |
+
+
+ ERC4626StataTokenUpgradeable.sol |
+
+
+ |
+ 93.2 % |
+ 73 |
+ 68 |
+ - |
+ |
+ |
+ 89.5 % |
+ 19 |
+ 17 |
+
+
+ ERC20AaveLMUpgradeable.sol |
+
+
+ |
+ 92.5 % |
+ 93 |
+ 86 |
+ - |
+ |
+ |
+ 90.9 % |
+ 22 |
+ 20 |
+
+
+
+
+
+
+
+
+
+
diff --git a/report/extensions/static-a-token/index-sort-l.html b/report/extensions/static-a-token/index-sort-l.html
new file mode 100644
index 00000000..40e641b5
--- /dev/null
+++ b/report/extensions/static-a-token/index-sort-l.html
@@ -0,0 +1,169 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - extensions/static-a-token
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../glass.png) |
+
+ |
+
+
+ ![](../../glass.png) |
+
+
+
+
+
+
+
|
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+ File ![Click to sort table by file name Sort by file name](../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../glass.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../updown.png) |
+
+
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+
+
+ StataTokenFactory.sol |
+
+
+ |
+ 66.7 % |
+ 21 |
+ 14 |
+ - |
+ |
+ |
+ 60.0 % |
+ 5 |
+ 3 |
+
+
+ StataTokenV2.sol |
+
+
+ |
+ 85.7 % |
+ 21 |
+ 18 |
+ - |
+ |
+ |
+ 72.7 % |
+ 11 |
+ 8 |
+
+
+ ERC20AaveLMUpgradeable.sol |
+
+
+ |
+ 92.5 % |
+ 93 |
+ 86 |
+ - |
+ |
+ |
+ 90.9 % |
+ 22 |
+ 20 |
+
+
+ ERC4626StataTokenUpgradeable.sol |
+
+
+ |
+ 93.2 % |
+ 73 |
+ 68 |
+ - |
+ |
+ |
+ 89.5 % |
+ 19 |
+ 17 |
+
+
+
+
+
+
+
+
+
+
diff --git a/report/extensions/static-a-token/index.html b/report/extensions/static-a-token/index.html
new file mode 100644
index 00000000..d190267e
--- /dev/null
+++ b/report/extensions/static-a-token/index.html
@@ -0,0 +1,169 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - extensions/static-a-token
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../glass.png) |
+
+ |
+
+
+ ![](../../glass.png) |
+
+
+
+
+
+
+
|
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+ File ![Click to sort table by file name Sort by file name](../../glass.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../updown.png) |
+
+
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+
+
+ ERC20AaveLMUpgradeable.sol |
+
+
+ |
+ 92.5 % |
+ 93 |
+ 86 |
+ - |
+ |
+ |
+ 90.9 % |
+ 22 |
+ 20 |
+
+
+ ERC4626StataTokenUpgradeable.sol |
+
+
+ |
+ 93.2 % |
+ 73 |
+ 68 |
+ - |
+ |
+ |
+ 89.5 % |
+ 19 |
+ 17 |
+
+
+ StataTokenFactory.sol |
+
+
+ |
+ 66.7 % |
+ 21 |
+ 14 |
+ - |
+ |
+ |
+ 60.0 % |
+ 5 |
+ 3 |
+
+
+ StataTokenV2.sol |
+
+
+ |
+ 85.7 % |
+ 21 |
+ 18 |
+ - |
+ |
+ |
+ 72.7 % |
+ 11 |
+ 8 |
+
+
+
+
+
+
+
+
+
+
diff --git a/report/gcov.css b/report/gcov.css
index f3290428..6c23ba93 100644
--- a/report/gcov.css
+++ b/report/gcov.css
@@ -187,6 +187,17 @@ td.coverFile
font-family: monospace;
}
+/* Directory view/File view (all): directory name entry format */
+td.coverDirectory
+{
+ text-align: left;
+ padding-left: 10px;
+ padding-right: 20px;
+ color: #284fa8;
+ background-color: #b8d0ff;
+ font-family: monospace;
+}
+
/* Directory view/File view (all): filename entry format */
td.overallOwner
{
@@ -528,12 +539,29 @@ pre.source
margin-top: 2px;
}
+/* elided/removed code */
+span.elidedSource
+{
+ font-family: sans-serif;
+ /*font-size: 8pt; */
+ font-style: italic;
+ background-color: lightgrey;
+}
+
/* Source code view: line number format */
span.lineNum
{
background-color: #efe383;
}
+/* Source code view: line number format when there are deleted
+ lines in the corresponding location */
+span.lineNumWithDelete
+{
+ foreground-color: #efe383;
+ background-color: lightgrey;
+}
+
/* Source code view: format for Cov legend */
span.coverLegendCov
{
@@ -634,7 +662,7 @@ a.branchTla:visited
color: #000000;
}
-/* Source code view/table entry backround: format for lines classified as "Uncovered New Code (+ => 0):
+/* Source code view/table entry background: format for lines classified as "Uncovered New Code (+ => 0):
Newly added code is not tested" */
td.tlaUNC
{
@@ -645,7 +673,7 @@ td.tlaBgUNC {
background-color: #FF6230;
}
-/* Source code view/table entry backround: format for lines classified as "Uncovered New Code (+ => 0):
+/* Source code view/table entry background: format for lines classified as "Uncovered New Code (+ => 0):
Newly added code is not tested" */
span.tlaUNC
{
@@ -670,7 +698,7 @@ td.headerCovTableHeadUNC {
background-color: #FF6230;
}
-/* Source code view/table entry backround: format for lines classified as "Lost Baseline Coverage (1 => 0):
+/* Source code view/table entry background: format for lines classified as "Lost Baseline Coverage (1 => 0):
Unchanged code is no longer tested" */
td.tlaLBC
{
@@ -681,7 +709,7 @@ td.tlaBgLBC {
background-color: #FF6230;
}
-/* Source code view/table entry backround: format for lines classified as "Lost Baseline Coverage (1 => 0):
+/* Source code view/table entry background: format for lines classified as "Lost Baseline Coverage (1 => 0):
Unchanged code is no longer tested" */
span.tlaLBC
{
@@ -706,7 +734,7 @@ td.headerCovTableHeadLBC {
background-color: #FF6230;
}
-/* Source code view/table entry backround: format for lines classified as "Uncovered Included Code (# => 0):
+/* Source code view/table entry background: format for lines classified as "Uncovered Included Code (# => 0):
Previously unused code is untested" */
td.tlaUIC
{
@@ -717,7 +745,7 @@ td.tlaBgUIC {
background-color: #FF6230;
}
-/* Source code view/table entry backround: format for lines classified as "Uncovered Included Code (# => 0):
+/* Source code view/table entry background: format for lines classified as "Uncovered Included Code (# => 0):
Previously unused code is untested" */
span.tlaUIC
{
@@ -742,7 +770,7 @@ td.headerCovTableHeadUIC {
background-color: #FF6230;
}
-/* Source code view/table entry backround: format for lines classified as "Uncovered Baseline Code (0 => 0):
+/* Source code view/table entry background: format for lines classified as "Uncovered Baseline Code (0 => 0):
Unchanged code was untested before, is untested now" */
td.tlaUBC
{
@@ -753,7 +781,7 @@ td.tlaBgUBC {
background-color: #FF6230;
}
-/* Source code view/table entry backround: format for lines classified as "Uncovered Baseline Code (0 => 0):
+/* Source code view/table entry background: format for lines classified as "Uncovered Baseline Code (0 => 0):
Unchanged code was untested before, is untested now" */
span.tlaUBC
{
@@ -778,7 +806,7 @@ td.headerCovTableHeadUBC {
background-color: #FF6230;
}
-/* Source code view/table entry backround: format for lines classified as "Gained Baseline Coverage (0 => 1):
+/* Source code view/table entry background: format for lines classified as "Gained Baseline Coverage (0 => 1):
Unchanged code is tested now" */
td.tlaGBC
{
@@ -789,7 +817,7 @@ td.tlaBgGBC {
background-color: #CAD7FE;
}
-/* Source code view/table entry backround: format for lines classified as "Gained Baseline Coverage (0 => 1):
+/* Source code view/table entry background: format for lines classified as "Gained Baseline Coverage (0 => 1):
Unchanged code is tested now" */
span.tlaGBC
{
@@ -814,7 +842,7 @@ td.headerCovTableHeadGBC {
background-color: #CAD7FE;
}
-/* Source code view/table entry backround: format for lines classified as "Gained Included Coverage (# => 1):
+/* Source code view/table entry background: format for lines classified as "Gained Included Coverage (# => 1):
Previously unused code is tested now" */
td.tlaGIC
{
@@ -825,7 +853,7 @@ td.tlaBgGIC {
background-color: #CAD7FE;
}
-/* Source code view/table entry backround: format for lines classified as "Gained Included Coverage (# => 1):
+/* Source code view/table entry background: format for lines classified as "Gained Included Coverage (# => 1):
Previously unused code is tested now" */
span.tlaGIC
{
@@ -850,7 +878,7 @@ td.headerCovTableHeadGIC {
background-color: #CAD7FE;
}
-/* Source code view/table entry backround: format for lines classified as "Gained New Coverage (+ => 1):
+/* Source code view/table entry background: format for lines classified as "Gained New Coverage (+ => 1):
Newly added code is tested" */
td.tlaGNC
{
@@ -861,7 +889,7 @@ td.tlaBgGNC {
background-color: #CAD7FE;
}
-/* Source code view/table entry backround: format for lines classified as "Gained New Coverage (+ => 1):
+/* Source code view/table entry background: format for lines classified as "Gained New Coverage (+ => 1):
Newly added code is tested" */
span.tlaGNC
{
@@ -886,7 +914,7 @@ td.headerCovTableHeadGNC {
background-color: #CAD7FE;
}
-/* Source code view/table entry backround: format for lines classified as "Covered Baseline Code (1 => 1):
+/* Source code view/table entry background: format for lines classified as "Covered Baseline Code (1 => 1):
Unchanged code was tested before and is still tested" */
td.tlaCBC
{
@@ -897,7 +925,7 @@ td.tlaBgCBC {
background-color: #CAD7FE;
}
-/* Source code view/table entry backround: format for lines classified as "Covered Baseline Code (1 => 1):
+/* Source code view/table entry background: format for lines classified as "Covered Baseline Code (1 => 1):
Unchanged code was tested before and is still tested" */
span.tlaCBC
{
@@ -922,7 +950,7 @@ td.headerCovTableHeadCBC {
background-color: #CAD7FE;
}
-/* Source code view/table entry backround: format for lines classified as "Excluded Uncovered Baseline (0 => #):
+/* Source code view/table entry background: format for lines classified as "Excluded Uncovered Baseline (0 => #):
Previously untested code is unused now" */
td.tlaEUB
{
@@ -933,7 +961,7 @@ td.tlaBgEUB {
background-color: #FFFFFF;
}
-/* Source code view/table entry backround: format for lines classified as "Excluded Uncovered Baseline (0 => #):
+/* Source code view/table entry background: format for lines classified as "Excluded Uncovered Baseline (0 => #):
Previously untested code is unused now" */
span.tlaEUB
{
@@ -958,7 +986,7 @@ td.headerCovTableHeadEUB {
background-color: #FFFFFF;
}
-/* Source code view/table entry backround: format for lines classified as "Excluded Covered Baseline (1 => #):
+/* Source code view/table entry background: format for lines classified as "Excluded Covered Baseline (1 => #):
Previously tested code is unused now" */
td.tlaECB
{
@@ -969,7 +997,7 @@ td.tlaBgECB {
background-color: #FFFFFF;
}
-/* Source code view/table entry backround: format for lines classified as "Excluded Covered Baseline (1 => #):
+/* Source code view/table entry background: format for lines classified as "Excluded Covered Baseline (1 => #):
Previously tested code is unused now" */
span.tlaECB
{
@@ -994,7 +1022,7 @@ td.headerCovTableHeadECB {
background-color: #FFFFFF;
}
-/* Source code view/table entry backround: format for lines classified as "Deleted Uncovered Baseline (0 => -):
+/* Source code view/table entry background: format for lines classified as "Deleted Uncovered Baseline (0 => -):
Previously untested code has been deleted" */
td.tlaDUB
{
@@ -1005,7 +1033,7 @@ td.tlaBgDUB {
background-color: #FFFFFF;
}
-/* Source code view/table entry backround: format for lines classified as "Deleted Uncovered Baseline (0 => -):
+/* Source code view/table entry background: format for lines classified as "Deleted Uncovered Baseline (0 => -):
Previously untested code has been deleted" */
span.tlaDUB
{
@@ -1030,7 +1058,7 @@ td.headerCovTableHeadDUB {
background-color: #FFFFFF;
}
-/* Source code view/table entry backround: format for lines classified as "Deleted Covered Baseline (1 => -):
+/* Source code view/table entry background: format for lines classified as "Deleted Covered Baseline (1 => -):
Previously tested code has been deleted" */
td.tlaDCB
{
@@ -1041,7 +1069,7 @@ td.tlaBgDCB {
background-color: #FFFFFF;
}
-/* Source code view/table entry backround: format for lines classified as "Deleted Covered Baseline (1 => -):
+/* Source code view/table entry background: format for lines classified as "Deleted Covered Baseline (1 => -):
Previously tested code has been deleted" */
span.tlaDCB
{
diff --git a/report/core/contracts/misc/src/core/contracts/misc/L2Encoder.sol.func-c.html b/report/helpers/L2Encoder.sol.func-c.html
similarity index 67%
rename from report/core/contracts/misc/src/core/contracts/misc/L2Encoder.sol.func-c.html
rename to report/helpers/L2Encoder.sol.func-c.html
index 5ef0d0b6..5a58c656 100644
--- a/report/core/contracts/misc/src/core/contracts/misc/L2Encoder.sol.func-c.html
+++ b/report/helpers/L2Encoder.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/misc/src/core/contracts/misc/L2Encoder.sol - functions
-
+ LCOV - lcov.info.p - helpers/L2Encoder.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,33 +53,33 @@
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../glass.png) |
- L2Encoder.encodeLiquidationCall |
+ L2Encoder. |
- 1 |
+ 0 |
- L2Encoder.encodeRebalanceStableBorrowRate |
+ L2Encoder.encodeLiquidationCall |
1 |
@@ -100,14 +100,7 @@
- L2Encoder.encodeSetUserUseReserveAsCollateral |
-
- 1 |
-
-
-
-
- L2Encoder.encodeSwapBorrowRateMode |
+ L2Encoder.encodeSetUserUseReserveAsCollateral |
1 |
@@ -152,8 +145,8 @@
diff --git a/report/core/contracts/misc/src/core/contracts/misc/L2Encoder.sol.func.html b/report/helpers/L2Encoder.sol.func.html
similarity index 67%
rename from report/core/contracts/misc/src/core/contracts/misc/L2Encoder.sol.func.html
rename to report/helpers/L2Encoder.sol.func.html
index 6a118e88..09697cc0 100644
--- a/report/core/contracts/misc/src/core/contracts/misc/L2Encoder.sol.func.html
+++ b/report/helpers/L2Encoder.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/misc/src/core/contracts/misc/L2Encoder.sol - functions
-
+ LCOV - lcov.info.p - helpers/L2Encoder.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,40 +53,40 @@
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../updown.png) |
- L2Encoder.encodeBorrowParams |
+ L2Encoder. |
- 3 |
+ 0 |
- L2Encoder.encodeLiquidationCall |
+ L2Encoder.encodeBorrowParams |
- 1 |
+ 3 |
- L2Encoder.encodeRebalanceStableBorrowRate |
+ L2Encoder.encodeLiquidationCall |
1 |
@@ -114,7 +114,7 @@
- L2Encoder.encodeSetUserUseReserveAsCollateral |
+ L2Encoder.encodeSetUserUseReserveAsCollateral |
1 |
@@ -133,13 +133,6 @@
1000 |
-
-
- L2Encoder.encodeSwapBorrowRateMode |
-
- 1 |
-
-
L2Encoder.encodeWithdrawParams |
@@ -152,8 +145,8 @@
diff --git a/report/core/contracts/misc/src/core/contracts/misc/L2Encoder.sol.gcov.html b/report/helpers/L2Encoder.sol.gcov.html
similarity index 77%
rename from report/core/contracts/misc/src/core/contracts/misc/L2Encoder.sol.gcov.html
rename to report/helpers/L2Encoder.sol.gcov.html
index 37fa7d60..5ae42100 100644
--- a/report/core/contracts/misc/src/core/contracts/misc/L2Encoder.sol.gcov.html
+++ b/report/helpers/L2Encoder.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/misc/src/core/contracts/misc/L2Encoder.sol
-
+ LCOV - lcov.info.p - helpers/L2Encoder.sol
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
@@ -91,7 +91,7 @@
20 : : * @param pool The address of the Pool contract
21 : : */
22 : : constructor(IPool pool) {
- 23 : : POOL = pool;
+ 23 : 0 : POOL = pool;
24 : : }
25 : :
26 : : /**
@@ -103,21 +103,21 @@
32 : : * 0 if the action is executed directly by the user, without any middle-man
33 : : * @return compact representation of supply parameters
34 : : */
- 35 : 7 : function encodeSupplyParams(
+ 35 : : function encodeSupplyParams(
36 : : address asset,
37 : : uint256 amount,
38 : : uint16 referralCode
39 : : ) external view returns (bytes32) {
- 40 : 21 : DataTypes.ReserveDataLegacy memory data = POOL.getReserveData(asset);
+ 40 : 7 : DataTypes.ReserveDataLegacy memory data = POOL.getReserveData(asset);
41 : :
- 42 : 14 : uint16 assetId = data.id;
- 43 : 21 : uint128 shortenedAmount = amount.toUint128();
- 44 : 14 : bytes32 res;
+ 42 : 7 : uint16 assetId = data.id;
+ 43 : 7 : uint128 shortenedAmount = amount.toUint128();
+ 44 : 7 : bytes32 res;
45 : :
46 : : assembly {
- 47 : 14 : res := add(assetId, add(shl(16, shortenedAmount), shl(144, referralCode)))
+ 47 : 7 : res := add(assetId, add(shl(16, shortenedAmount), shl(144, referralCode)))
48 : : }
- 49 : 14 : return res;
+ 49 : 7 : return res;
50 : : }
51 : :
52 : : /**
@@ -135,7 +135,7 @@
64 : : * @return The R parameter of ERC712 permit sig
65 : : * @return The S parameter of ERC712 permit sig
66 : : */
- 67 : 1000 : function encodeSupplyWithPermitParams(
+ 67 : : function encodeSupplyWithPermitParams(
68 : : address asset,
69 : : uint256 amount,
70 : : uint16 referralCode,
@@ -144,15 +144,15 @@
73 : : bytes32 permitR,
74 : : bytes32 permitS
75 : : ) external view returns (bytes32, bytes32, bytes32) {
- 76 : 3000 : DataTypes.ReserveDataLegacy memory data = POOL.getReserveData(asset);
+ 76 : 1000 : DataTypes.ReserveDataLegacy memory data = POOL.getReserveData(asset);
77 : :
- 78 : 2000 : uint16 assetId = data.id;
- 79 : 3000 : uint128 shortenedAmount = amount.toUint128();
- 80 : 3000 : uint32 shortenedDeadline = deadline.toUint32();
+ 78 : 1000 : uint16 assetId = data.id;
+ 79 : 1000 : uint128 shortenedAmount = amount.toUint128();
+ 80 : 1000 : uint32 shortenedDeadline = deadline.toUint32();
81 : :
- 82 : 2000 : bytes32 res;
+ 82 : 1000 : bytes32 res;
83 : : assembly {
- 84 : 2000 : res := add(
+ 84 : 1000 : res := add(
85 : : assetId,
86 : : add(
87 : : shl(16, shortenedAmount),
@@ -161,7 +161,7 @@
90 : : )
91 : : }
92 : :
- 93 : 2000 : return (res, permitR, permitS);
+ 93 : 1000 : return (res, permitR, permitS);
94 : : }
95 : :
96 : : /**
@@ -171,17 +171,17 @@
100 : : * @param amount The underlying amount to be withdrawn
101 : : * @return compact representation of withdraw parameters
102 : : */
- 103 : 2 : function encodeWithdrawParams(address asset, uint256 amount) external view returns (bytes32) {
- 104 : 6 : DataTypes.ReserveDataLegacy memory data = POOL.getReserveData(asset);
+ 103 : : function encodeWithdrawParams(address asset, uint256 amount) external view returns (bytes32) {
+ 104 : 2 : DataTypes.ReserveDataLegacy memory data = POOL.getReserveData(asset);
105 : :
- 106 : 4 : uint16 assetId = data.id;
- 107 : 6 : uint128 shortenedAmount = amount == type(uint256).max ? type(uint128).max : amount.toUint128();
+ 106 : 2 : uint16 assetId = data.id;
+ 107 : 2 : uint128 shortenedAmount = amount == type(uint256).max ? type(uint128).max : amount.toUint128();
108 : :
- 109 : 4 : bytes32 res;
+ 109 : 2 : bytes32 res;
110 : : assembly {
- 111 : 4 : res := add(assetId, shl(16, shortenedAmount))
+ 111 : 2 : res := add(assetId, shl(16, shortenedAmount))
112 : : }
- 113 : 4 : return res;
+ 113 : 2 : return res;
114 : : }
115 : :
116 : : /**
@@ -189,25 +189,25 @@
118 : : * @dev Without an onBehalfOf parameter as the compact calls to L2Pool will use msg.sender as onBehalfOf
119 : : * @param asset The address of the underlying asset to borrow
120 : : * @param amount The amount to be borrowed
- 121 : : * @param interestRateMode The interest rate mode at which the user wants to borrow: 1 for Stable, 2 for Variable
+ 121 : : * @param interestRateMode The interest rate mode at which the user wants to borrow: 2 for Variable, 1 is deprecated (changed on v3.2.0)
122 : : * @param referralCode The code used to register the integrator originating the operation, for potential rewards.
123 : : * 0 if the action is executed directly by the user, without any middle-man
124 : : * @return compact representation of withdraw parameters
125 : : */
- 126 : 3 : function encodeBorrowParams(
+ 126 : : function encodeBorrowParams(
127 : : address asset,
128 : : uint256 amount,
129 : : uint256 interestRateMode,
130 : : uint16 referralCode
131 : : ) external view returns (bytes32) {
- 132 : 9 : DataTypes.ReserveDataLegacy memory data = POOL.getReserveData(asset);
+ 132 : 3 : DataTypes.ReserveDataLegacy memory data = POOL.getReserveData(asset);
133 : :
- 134 : 6 : uint16 assetId = data.id;
- 135 : 9 : uint128 shortenedAmount = amount.toUint128();
- 136 : 9 : uint8 shortenedInterestRateMode = interestRateMode.toUint8();
- 137 : 6 : bytes32 res;
+ 134 : 3 : uint16 assetId = data.id;
+ 135 : 3 : uint128 shortenedAmount = amount.toUint128();
+ 136 : 3 : uint8 shortenedInterestRateMode = interestRateMode.toUint8();
+ 137 : 3 : bytes32 res;
138 : : assembly {
- 139 : 6 : res := add(
+ 139 : 3 : res := add(
140 : : assetId,
141 : : add(
142 : : shl(16, shortenedAmount),
@@ -215,7 +215,7 @@
144 : : )
145 : : )
146 : : }
- 147 : 6 : return res;
+ 147 : 3 : return res;
148 : : }
149 : :
150 : : /**
@@ -224,25 +224,25 @@
153 : : * @param asset The address of the borrowed underlying asset previously borrowed
154 : : * @param amount The amount to repay
155 : : * - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `interestRateMode`
- 156 : : * @param interestRateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable
+ 156 : : * @param interestRateMode The interest rate mode at of the debt the user wants to repay: 2 for Variable, 1 is deprecated (changed on v3.2.0)
157 : : * @return compact representation of repay parameters
158 : : */
- 159 : 1 : function encodeRepayParams(
+ 159 : : function encodeRepayParams(
160 : : address asset,
161 : : uint256 amount,
162 : : uint256 interestRateMode
163 : : ) public view returns (bytes32) {
- 164 : 6 : DataTypes.ReserveDataLegacy memory data = POOL.getReserveData(asset);
+ 164 : 2 : DataTypes.ReserveDataLegacy memory data = POOL.getReserveData(asset);
165 : :
- 166 : 4 : uint16 assetId = data.id;
- 167 : 6 : uint128 shortenedAmount = amount == type(uint256).max ? type(uint128).max : amount.toUint128();
- 168 : 6 : uint8 shortenedInterestRateMode = interestRateMode.toUint8();
+ 166 : 2 : uint16 assetId = data.id;
+ 167 : 2 : uint128 shortenedAmount = amount == type(uint256).max ? type(uint128).max : amount.toUint128();
+ 168 : 2 : uint8 shortenedInterestRateMode = interestRateMode.toUint8();
169 : :
- 170 : 4 : bytes32 res;
+ 170 : 2 : bytes32 res;
171 : : assembly {
- 172 : 4 : res := add(assetId, add(shl(16, shortenedAmount), shl(144, shortenedInterestRateMode)))
+ 172 : 2 : res := add(assetId, add(shl(16, shortenedAmount), shl(144, shortenedInterestRateMode)))
173 : : }
- 174 : 4 : return res;
+ 174 : 2 : return res;
175 : : }
176 : :
177 : : /**
@@ -251,7 +251,7 @@
180 : : * @param asset The address of the borrowed underlying asset previously borrowed
181 : : * @param amount The amount to repay
182 : : * - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `debtMode`
- 183 : : * @param interestRateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable
+ 183 : : * @param interestRateMode The interest rate mode at of the debt the user wants to repay: 2 for Variable, 1 is deprecated (changed on v3.2.0)
184 : : * @param deadline The deadline timestamp that the permit is valid
185 : : * @param permitV The V parameter of ERC712 permit sig
186 : : * @param permitR The R parameter of ERC712 permit sig
@@ -260,7 +260,7 @@
189 : : * @return The R parameter of ERC712 permit sig
190 : : * @return The S parameter of ERC712 permit sig
191 : : */
- 192 : 1000 : function encodeRepayWithPermitParams(
+ 192 : : function encodeRepayWithPermitParams(
193 : : address asset,
194 : : uint256 amount,
195 : : uint256 interestRateMode,
@@ -269,16 +269,16 @@
198 : : bytes32 permitR,
199 : : bytes32 permitS
200 : : ) external view returns (bytes32, bytes32, bytes32) {
- 201 : 3000 : DataTypes.ReserveDataLegacy memory data = POOL.getReserveData(asset);
+ 201 : 1000 : DataTypes.ReserveDataLegacy memory data = POOL.getReserveData(asset);
202 : :
- 203 : 2000 : uint16 assetId = data.id;
- 204 : 3000 : uint128 shortenedAmount = amount == type(uint256).max ? type(uint128).max : amount.toUint128();
- 205 : 3000 : uint8 shortenedInterestRateMode = interestRateMode.toUint8();
- 206 : 3000 : uint32 shortenedDeadline = deadline.toUint32();
+ 203 : 1000 : uint16 assetId = data.id;
+ 204 : 1000 : uint128 shortenedAmount = amount == type(uint256).max ? type(uint128).max : amount.toUint128();
+ 205 : 1000 : uint8 shortenedInterestRateMode = interestRateMode.toUint8();
+ 206 : 1000 : uint32 shortenedDeadline = deadline.toUint32();
207 : :
- 208 : 2000 : bytes32 res;
+ 208 : 1000 : bytes32 res;
209 : : assembly {
- 210 : 2000 : res := add(
+ 210 : 1000 : res := add(
211 : : assetId,
212 : : add(
213 : : shl(16, shortenedAmount),
@@ -289,7 +289,7 @@
218 : : )
219 : : )
220 : : }
- 221 : 2000 : return (res, permitR, permitS);
+ 221 : 1000 : return (res, permitR, permitS);
222 : : }
223 : :
224 : : /**
@@ -297,114 +297,74 @@
226 : : * @param asset The address of the borrowed underlying asset previously borrowed
227 : : * @param amount The amount to repay
228 : : * - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `debtMode`
- 229 : : * @param interestRateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable
+ 229 : : * @param interestRateMode The interest rate mode at of the debt the user wants to repay: 2 for Variable, 1 is deprecated (changed on v3.2.0)
230 : : * @return compact representation of repay with aToken parameters
231 : : */
- 232 : 1 : function encodeRepayWithATokensParams(
+ 232 : : function encodeRepayWithATokensParams(
233 : : address asset,
234 : : uint256 amount,
235 : : uint256 interestRateMode
236 : : ) external view returns (bytes32) {
- 237 : 3 : return encodeRepayParams(asset, amount, interestRateMode);
+ 237 : 1 : return encodeRepayParams(asset, amount, interestRateMode);
238 : : }
239 : :
240 : : /**
- 241 : : * @notice Encodes swap borrow rate mode parameters from standard input to compact representation of 1 bytes32
+ 241 : : * @notice Encodes set user use reserve as collateral parameters from standard input to compact representation of 1 bytes32
242 : : * @param asset The address of the underlying asset borrowed
- 243 : : * @param interestRateMode The current interest rate mode of the position being swapped: 1 for Stable, 2 for Variable
- 244 : : * @return compact representation of swap borrow rate mode parameters
+ 243 : : * @param useAsCollateral True if the user wants to use the supply as collateral, false otherwise
+ 244 : : * @return compact representation of set user use reserve as collateral parameters
245 : : */
- 246 : 1 : function encodeSwapBorrowRateMode(
+ 246 : : function encodeSetUserUseReserveAsCollateral(
247 : : address asset,
- 248 : : uint256 interestRateMode
+ 248 : : bool useAsCollateral
249 : : ) external view returns (bytes32) {
- 250 : 3 : DataTypes.ReserveDataLegacy memory data = POOL.getReserveData(asset);
- 251 : 2 : uint16 assetId = data.id;
- 252 : 3 : uint8 shortenedInterestRateMode = interestRateMode.toUint8();
- 253 : 2 : bytes32 res;
- 254 : : assembly {
- 255 : 2 : res := add(assetId, shl(16, shortenedInterestRateMode))
- 256 : : }
- 257 : 2 : return res;
- 258 : : }
- 259 : :
- 260 : : /**
- 261 : : * @notice Encodes rebalance stable borrow rate parameters from standard input to compact representation of 1 bytes32
- 262 : : * @param asset The address of the underlying asset borrowed
- 263 : : * @param user The address of the user to be rebalanced
- 264 : : * @return compact representation of rebalance stable borrow rate parameters
- 265 : : */
- 266 : 1 : function encodeRebalanceStableBorrowRate(
- 267 : : address asset,
- 268 : : address user
- 269 : : ) external view returns (bytes32) {
- 270 : 3 : DataTypes.ReserveDataLegacy memory data = POOL.getReserveData(asset);
- 271 : 2 : uint16 assetId = data.id;
- 272 : :
- 273 : 2 : bytes32 res;
- 274 : : assembly {
- 275 : 2 : res := add(assetId, shl(16, user))
- 276 : : }
- 277 : 2 : return res;
- 278 : : }
+ 250 : 1 : DataTypes.ReserveDataLegacy memory data = POOL.getReserveData(asset);
+ 251 : 1 : uint16 assetId = data.id;
+ 252 : 1 : bytes32 res;
+ 253 : : assembly {
+ 254 : 1 : res := add(assetId, shl(16, useAsCollateral))
+ 255 : : }
+ 256 : 1 : return res;
+ 257 : : }
+ 258 : :
+ 259 : : /**
+ 260 : : * @notice Encodes liquidation call parameters from standard input to compact representation of 2 bytes32
+ 261 : : * @param collateralAsset The address of the underlying asset used as collateral, to receive as result of the liquidation
+ 262 : : * @param debtAsset The address of the underlying borrowed asset to be repaid with the liquidation
+ 263 : : * @param user The address of the borrower getting liquidated
+ 264 : : * @param debtToCover The debt amount of borrowed `asset` the liquidator wants to cover
+ 265 : : * @param receiveAToken True if the liquidators wants to receive the collateral aTokens, `false` if he wants
+ 266 : : * to receive the underlying collateral asset directly
+ 267 : : * @return First half ot compact representation of liquidation call parameters
+ 268 : : * @return Second half ot compact representation of liquidation call parameters
+ 269 : : */
+ 270 : : function encodeLiquidationCall(
+ 271 : : address collateralAsset,
+ 272 : : address debtAsset,
+ 273 : : address user,
+ 274 : : uint256 debtToCover,
+ 275 : : bool receiveAToken
+ 276 : : ) external view returns (bytes32, bytes32) {
+ 277 : 1 : DataTypes.ReserveDataLegacy memory collateralData = POOL.getReserveData(collateralAsset);
+ 278 : 1 : uint16 collateralAssetId = collateralData.id;
279 : :
- 280 : : /**
- 281 : : * @notice Encodes set user use reserve as collateral parameters from standard input to compact representation of 1 bytes32
- 282 : : * @param asset The address of the underlying asset borrowed
- 283 : : * @param useAsCollateral True if the user wants to use the supply as collateral, false otherwise
- 284 : : * @return compact representation of set user use reserve as collateral parameters
- 285 : : */
- 286 : 1 : function encodeSetUserUseReserveAsCollateral(
- 287 : : address asset,
- 288 : : bool useAsCollateral
- 289 : : ) external view returns (bytes32) {
- 290 : 3 : DataTypes.ReserveDataLegacy memory data = POOL.getReserveData(asset);
- 291 : 2 : uint16 assetId = data.id;
- 292 : 2 : bytes32 res;
- 293 : : assembly {
- 294 : 2 : res := add(assetId, shl(16, useAsCollateral))
- 295 : : }
- 296 : 2 : return res;
- 297 : : }
- 298 : :
- 299 : : /**
- 300 : : * @notice Encodes liquidation call parameters from standard input to compact representation of 2 bytes32
- 301 : : * @param collateralAsset The address of the underlying asset used as collateral, to receive as result of the liquidation
- 302 : : * @param debtAsset The address of the underlying borrowed asset to be repaid with the liquidation
- 303 : : * @param user The address of the borrower getting liquidated
- 304 : : * @param debtToCover The debt amount of borrowed `asset` the liquidator wants to cover
- 305 : : * @param receiveAToken True if the liquidators wants to receive the collateral aTokens, `false` if he wants
- 306 : : * to receive the underlying collateral asset directly
- 307 : : * @return First half ot compact representation of liquidation call parameters
- 308 : : * @return Second half ot compact representation of liquidation call parameters
- 309 : : */
- 310 : 1 : function encodeLiquidationCall(
- 311 : : address collateralAsset,
- 312 : : address debtAsset,
- 313 : : address user,
- 314 : : uint256 debtToCover,
- 315 : : bool receiveAToken
- 316 : : ) external view returns (bytes32, bytes32) {
- 317 : 3 : DataTypes.ReserveDataLegacy memory collateralData = POOL.getReserveData(collateralAsset);
- 318 : 2 : uint16 collateralAssetId = collateralData.id;
- 319 : :
- 320 : 3 : DataTypes.ReserveDataLegacy memory debtData = POOL.getReserveData(debtAsset);
- 321 : 2 : uint16 debtAssetId = debtData.id;
- 322 : :
- 323 : 3 : uint128 shortenedDebtToCover = debtToCover == type(uint256).max
- 324 : : ? type(uint128).max
- 325 : : : debtToCover.toUint128();
- 326 : :
- 327 : 2 : bytes32 res1;
- 328 : 2 : bytes32 res2;
- 329 : :
- 330 : : assembly {
- 331 : 2 : res1 := add(add(collateralAssetId, shl(16, debtAssetId)), shl(32, user))
- 332 : 2 : res2 := add(shortenedDebtToCover, shl(128, receiveAToken))
- 333 : : }
- 334 : 2 : return (res1, res2);
- 335 : : }
- 336 : : }
+ 280 : 1 : DataTypes.ReserveDataLegacy memory debtData = POOL.getReserveData(debtAsset);
+ 281 : 1 : uint16 debtAssetId = debtData.id;
+ 282 : :
+ 283 : 1 : uint128 shortenedDebtToCover = debtToCover == type(uint256).max
+ 284 : : ? type(uint128).max
+ 285 : : : debtToCover.toUint128();
+ 286 : :
+ 287 : 1 : bytes32 res1;
+ 288 : 1 : bytes32 res2;
+ 289 : :
+ 290 : : assembly {
+ 291 : 1 : res1 := add(add(collateralAssetId, shl(16, debtAssetId)), shl(32, user))
+ 292 : 1 : res2 := add(shortenedDebtToCover, shl(128, receiveAToken))
+ 293 : : }
+ 294 : 1 : return (res1, res2);
+ 295 : : }
+ 296 : : }
@@ -412,8 +372,8 @@
diff --git a/report/periphery/contracts/misc/src/periphery/contracts/misc/WrappedTokenGatewayV3.sol.func-c.html b/report/helpers/WrappedTokenGatewayV3.sol.func-c.html
similarity index 66%
rename from report/periphery/contracts/misc/src/periphery/contracts/misc/WrappedTokenGatewayV3.sol.func-c.html
rename to report/helpers/WrappedTokenGatewayV3.sol.func-c.html
index 839810f6..a0c3b246 100644
--- a/report/periphery/contracts/misc/src/periphery/contracts/misc/WrappedTokenGatewayV3.sol.func-c.html
+++ b/report/helpers/WrappedTokenGatewayV3.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/misc/src/periphery/contracts/misc/WrappedTokenGatewayV3.sol - functions
-
+ LCOV - lcov.info.p - helpers/WrappedTokenGatewayV3.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -31,13 +31,13 @@
|
-
-
-
+
+
+
-
+
|
@@ -53,89 +53,89 @@
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../glass.png) |
- WrappedTokenGatewayV3.borrowETH |
+ WrappedTokenGatewayV3.borrowETH |
1 |
- WrappedTokenGatewayV3.emergencyEtherTransfer |
+ WrappedTokenGatewayV3.emergencyEtherTransfer |
1 |
- WrappedTokenGatewayV3.emergencyTokenTransfer |
+ WrappedTokenGatewayV3.emergencyTokenTransfer |
1 |
- WrappedTokenGatewayV3.getWETHAddress |
+ WrappedTokenGatewayV3.getWETHAddress |
1 |
- WrappedTokenGatewayV3. |
+ WrappedTokenGatewayV3. |
2 |
- WrappedTokenGatewayV3.withdrawETH |
+ WrappedTokenGatewayV3.withdrawETH |
2 |
- WrappedTokenGatewayV3.withdrawETHWithPermit |
+ WrappedTokenGatewayV3.withdrawETHWithPermit |
2 |
- WrappedTokenGatewayV3.repayETH |
+ WrappedTokenGatewayV3.repayETH |
5 |
- WrappedTokenGatewayV3._safeTransferETH |
+ WrappedTokenGatewayV3._safeTransferETH |
7 |
- WrappedTokenGatewayV3.depositETH |
+ WrappedTokenGatewayV3.depositETH |
8 |
@@ -145,8 +145,8 @@
diff --git a/report/periphery/contracts/misc/src/periphery/contracts/misc/WrappedTokenGatewayV3.sol.func.html b/report/helpers/WrappedTokenGatewayV3.sol.func.html
similarity index 66%
rename from report/periphery/contracts/misc/src/periphery/contracts/misc/WrappedTokenGatewayV3.sol.func.html
rename to report/helpers/WrappedTokenGatewayV3.sol.func.html
index 8970b385..7ee3be56 100644
--- a/report/periphery/contracts/misc/src/periphery/contracts/misc/WrappedTokenGatewayV3.sol.func.html
+++ b/report/helpers/WrappedTokenGatewayV3.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/misc/src/periphery/contracts/misc/WrappedTokenGatewayV3.sol - functions
-
+ LCOV - lcov.info.p - helpers/WrappedTokenGatewayV3.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -31,13 +31,13 @@
|
-
-
-
+
+
+
-
+
|
@@ -53,89 +53,89 @@
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../updown.png) |
- WrappedTokenGatewayV3. |
+ WrappedTokenGatewayV3. |
2 |
- WrappedTokenGatewayV3._safeTransferETH |
+ WrappedTokenGatewayV3._safeTransferETH |
7 |
- WrappedTokenGatewayV3.borrowETH |
+ WrappedTokenGatewayV3.borrowETH |
1 |
- WrappedTokenGatewayV3.depositETH |
+ WrappedTokenGatewayV3.depositETH |
8 |
- WrappedTokenGatewayV3.emergencyEtherTransfer |
+ WrappedTokenGatewayV3.emergencyEtherTransfer |
1 |
- WrappedTokenGatewayV3.emergencyTokenTransfer |
+ WrappedTokenGatewayV3.emergencyTokenTransfer |
1 |
- WrappedTokenGatewayV3.getWETHAddress |
+ WrappedTokenGatewayV3.getWETHAddress |
1 |
- WrappedTokenGatewayV3.repayETH |
+ WrappedTokenGatewayV3.repayETH |
5 |
- WrappedTokenGatewayV3.withdrawETH |
+ WrappedTokenGatewayV3.withdrawETH |
2 |
- WrappedTokenGatewayV3.withdrawETHWithPermit |
+ WrappedTokenGatewayV3.withdrawETHWithPermit |
2 |
@@ -145,8 +145,8 @@
diff --git a/report/periphery/contracts/misc/src/periphery/contracts/misc/WrappedTokenGatewayV3.sol.gcov.html b/report/helpers/WrappedTokenGatewayV3.sol.gcov.html
similarity index 73%
rename from report/periphery/contracts/misc/src/periphery/contracts/misc/WrappedTokenGatewayV3.sol.gcov.html
rename to report/helpers/WrappedTokenGatewayV3.sol.gcov.html
index 9e54be92..dd54419f 100644
--- a/report/periphery/contracts/misc/src/periphery/contracts/misc/WrappedTokenGatewayV3.sol.gcov.html
+++ b/report/helpers/WrappedTokenGatewayV3.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/misc/src/periphery/contracts/misc/WrappedTokenGatewayV3.sol
-
+ LCOV - lcov.info.p - helpers/WrappedTokenGatewayV3.sol
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -31,13 +31,13 @@
|
-
-
-
+
+
+
-
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
@@ -72,209 +72,200 @@
1 : : // SPDX-License-Identifier: BUSL-1.1
2 : : pragma solidity ^0.8.10;
3 : :
- 4 : : import {Ownable} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/Ownable.sol';
- 5 : : import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
- 6 : : import {GPv2SafeERC20} from 'aave-v3-core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol';
- 7 : : import {IWETH} from 'aave-v3-core/contracts/misc/interfaces/IWETH.sol';
- 8 : : import {IPool} from 'aave-v3-core/contracts/interfaces/IPool.sol';
- 9 : : import {IAToken} from 'aave-v3-core/contracts/interfaces/IAToken.sol';
- 10 : : import {ReserveConfiguration} from 'aave-v3-core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
- 11 : : import {UserConfiguration} from 'aave-v3-core/contracts/protocol/libraries/configuration/UserConfiguration.sol';
- 12 : : import {DataTypes} from 'aave-v3-core/contracts/protocol/libraries/types/DataTypes.sol';
+ 4 : : import {Ownable} from '../dependencies/openzeppelin/contracts/Ownable.sol';
+ 5 : : import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.sol';
+ 6 : : import {GPv2SafeERC20} from '../dependencies/gnosis/contracts/GPv2SafeERC20.sol';
+ 7 : : import {IWETH} from './interfaces/IWETH.sol';
+ 8 : : import {IPool} from '../interfaces/IPool.sol';
+ 9 : : import {IAToken} from '../interfaces/IAToken.sol';
+ 10 : : import {ReserveConfiguration} from '../protocol/libraries/configuration/ReserveConfiguration.sol';
+ 11 : : import {UserConfiguration} from '../protocol/libraries/configuration/UserConfiguration.sol';
+ 12 : : import {DataTypes} from '../protocol/libraries/types/DataTypes.sol';
13 : : import {IWrappedTokenGatewayV3} from './interfaces/IWrappedTokenGatewayV3.sol';
- 14 : : import {DataTypesHelper} from '../libraries/DataTypesHelper.sol';
- 15 : :
- 16 : : /**
- 17 : : * @dev This contract is an upgrade of the WrappedTokenGatewayV3 contract, with immutable pool address.
- 18 : : * This contract keeps the same interface of the deprecated WrappedTokenGatewayV3 contract.
- 19 : : */
- 20 : : contract WrappedTokenGatewayV3 is IWrappedTokenGatewayV3, Ownable {
- 21 : : using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
- 22 : : using UserConfiguration for DataTypes.UserConfigurationMap;
- 23 : : using GPv2SafeERC20 for IERC20;
- 24 : :
- 25 : : IWETH internal immutable WETH;
- 26 : : IPool internal immutable POOL;
- 27 : :
- 28 : : /**
- 29 : : * @dev Sets the WETH address and the PoolAddressesProvider address. Infinite approves pool.
- 30 : : * @param weth Address of the Wrapped Ether contract
- 31 : : * @param owner Address of the owner of this contract
- 32 : : **/
- 33 : : constructor(address weth, address owner, IPool pool) {
- 34 : : WETH = IWETH(weth);
- 35 : : POOL = pool;
- 36 : : transferOwnership(owner);
- 37 : : IWETH(weth).approve(address(pool), type(uint256).max);
- 38 : : }
- 39 : :
- 40 : : /**
- 41 : : * @dev deposits WETH into the reserve, using native ETH. A corresponding amount of the overlying asset (aTokens)
- 42 : : * is minted.
- 43 : : * @param onBehalfOf address of the user who will receive the aTokens representing the deposit
- 44 : : * @param referralCode integrators are assigned a referral code and can potentially receive rewards.
- 45 : : **/
- 46 : 8 : function depositETH(address, address onBehalfOf, uint16 referralCode) external payable override {
- 47 : 16 : WETH.deposit{value: msg.value}();
- 48 : 16 : POOL.deposit(address(WETH), msg.value, onBehalfOf, referralCode);
- 49 : : }
- 50 : :
- 51 : : /**
- 52 : : * @dev withdraws the WETH _reserves of msg.sender.
- 53 : : * @param amount amount of aWETH to withdraw and receive native ETH
- 54 : : * @param to address of the user who will receive native ETH
- 55 : : */
- 56 : 2 : function withdrawETH(address, uint256 amount, address to) external override {
- 57 : 6 : IAToken aWETH = IAToken(POOL.getReserveData(address(WETH)).aTokenAddress);
- 58 : 6 : uint256 userBalance = aWETH.balanceOf(msg.sender);
- 59 : 4 : uint256 amountToWithdraw = amount;
- 60 : :
- 61 : : // if amount is equal to uint(-1), the user wants to redeem everything
- 62 : 4 : if (amount == type(uint256).max) {
- 63 : 2 : amountToWithdraw = userBalance;
- 64 : : }
- 65 : 4 : aWETH.transferFrom(msg.sender, address(this), amountToWithdraw);
- 66 : 4 : POOL.withdraw(address(WETH), amountToWithdraw, address(this));
- 67 : 4 : WETH.withdraw(amountToWithdraw);
- 68 : 4 : _safeTransferETH(to, amountToWithdraw);
- 69 : : }
- 70 : :
- 71 : : /**
- 72 : : * @dev repays a borrow on the WETH reserve, for the specified amount (or for the whole amount, if uint256(-1) is specified).
- 73 : : * @param amount the amount to repay, or uint256(-1) if the user wants to repay everything
- 74 : : * @param rateMode the rate mode to repay
- 75 : : * @param onBehalfOf the address for which msg.sender is repaying
- 76 : : */
- 77 : 5 : function repayETH(
- 78 : : address,
- 79 : : uint256 amount,
- 80 : : uint256 rateMode,
- 81 : : address onBehalfOf
- 82 : : ) external payable override {
- 83 : 15 : (uint256 stableDebt, uint256 variableDebt) = DataTypesHelper.getUserCurrentDebt(
- 84 : : onBehalfOf,
- 85 : : POOL.getReserveData(address(WETH))
- 86 : : );
- 87 : :
- 88 : 15 : uint256 paybackAmount = DataTypes.InterestRateMode(rateMode) ==
- 89 : : DataTypes.InterestRateMode.STABLE
- 90 : : ? stableDebt
- 91 : : : variableDebt;
- 92 : :
- 93 : 10 : if (amount < paybackAmount) {
- 94 : 4 : paybackAmount = amount;
- 95 : : }
- 96 : 10 : require(msg.value >= paybackAmount, 'msg.value is less than repayment amount');
- 97 : 10 : WETH.deposit{value: paybackAmount}();
- 98 : 10 : POOL.repay(address(WETH), paybackAmount, rateMode, onBehalfOf);
- 99 : :
- 100 : : // refund remaining dust eth
- 101 : 11 : if (msg.value > paybackAmount) _safeTransferETH(msg.sender, msg.value - paybackAmount);
- 102 : : }
- 103 : :
- 104 : : /**
- 105 : : * @dev borrow WETH, unwraps to ETH and send both the ETH and DebtTokens to msg.sender, via `approveDelegation` and onBehalf argument in `Pool.borrow`.
- 106 : : * @param amount the amount of ETH to borrow
- 107 : : * @param interestRateMode the interest rate mode
- 108 : : * @param referralCode integrators are assigned a referral code and can potentially receive rewards
- 109 : : */
- 110 : 1 : function borrowETH(
- 111 : : address,
- 112 : : uint256 amount,
- 113 : : uint256 interestRateMode,
- 114 : : uint16 referralCode
- 115 : : ) external override {
- 116 : 2 : POOL.borrow(address(WETH), amount, interestRateMode, referralCode, msg.sender);
- 117 : 2 : WETH.withdraw(amount);
- 118 : 2 : _safeTransferETH(msg.sender, amount);
- 119 : : }
- 120 : :
- 121 : : /**
- 122 : : * @dev withdraws the WETH _reserves of msg.sender.
- 123 : : * @param amount amount of aWETH to withdraw and receive native ETH
- 124 : : * @param to address of the user who will receive native ETH
- 125 : : * @param deadline validity deadline of permit and so depositWithPermit signature
- 126 : : * @param permitV V parameter of ERC712 permit sig
- 127 : : * @param permitR R parameter of ERC712 permit sig
- 128 : : * @param permitS S parameter of ERC712 permit sig
- 129 : : */
- 130 : 2 : function withdrawETHWithPermit(
- 131 : : address,
- 132 : : uint256 amount,
- 133 : : address to,
- 134 : : uint256 deadline,
- 135 : : uint8 permitV,
- 136 : : bytes32 permitR,
- 137 : : bytes32 permitS
- 138 : : ) external override {
- 139 : 6 : IAToken aWETH = IAToken(POOL.getReserveData(address(WETH)).aTokenAddress);
- 140 : 6 : uint256 userBalance = aWETH.balanceOf(msg.sender);
- 141 : 4 : uint256 amountToWithdraw = amount;
- 142 : :
- 143 : : // if amount is equal to type(uint256).max, the user wants to redeem everything
- 144 : 4 : if (amount == type(uint256).max) {
- 145 : 2 : amountToWithdraw = userBalance;
- 146 : : }
- 147 : : // permit `amount` rather than `amountToWithdraw` to make it easier for front-ends and integrators
- 148 : 4 : aWETH.permit(msg.sender, address(this), amount, deadline, permitV, permitR, permitS);
- 149 : 4 : aWETH.transferFrom(msg.sender, address(this), amountToWithdraw);
- 150 : 4 : POOL.withdraw(address(WETH), amountToWithdraw, address(this));
- 151 : 4 : WETH.withdraw(amountToWithdraw);
- 152 : 4 : _safeTransferETH(to, amountToWithdraw);
- 153 : : }
- 154 : :
- 155 : : /**
- 156 : : * @dev transfer ETH to an address, revert if it fails.
- 157 : : * @param to recipient of the transfer
- 158 : : * @param value the amount to send
- 159 : : */
- 160 : 7 : function _safeTransferETH(address to, uint256 value) internal {
- 161 : 21 : (bool success, ) = to.call{value: value}(new bytes(0));
- 162 : 14 : require(success, 'ETH_TRANSFER_FAILED');
- 163 : : }
- 164 : :
- 165 : : /**
- 166 : : * @dev transfer ERC20 from the utility contract, for ERC20 recovery in case of stuck tokens due
- 167 : : * direct transfers to the contract address.
- 168 : : * @param token token to transfer
- 169 : : * @param to recipient of the transfer
- 170 : : * @param amount amount to send
- 171 : : */
- 172 : 1 : function emergencyTokenTransfer(address token, address to, uint256 amount) external onlyOwner {
- 173 : 2 : IERC20(token).safeTransfer(to, amount);
- 174 : : }
- 175 : :
- 176 : : /**
- 177 : : * @dev transfer native Ether from the utility contract, for native Ether recovery in case of stuck Ether
- 178 : : * due to selfdestructs or ether transfers to the pre-computed contract address before deployment.
- 179 : : * @param to recipient of the transfer
- 180 : : * @param amount amount to send
- 181 : : */
- 182 : 1 : function emergencyEtherTransfer(address to, uint256 amount) external onlyOwner {
- 183 : 2 : _safeTransferETH(to, amount);
- 184 : : }
- 185 : :
- 186 : : /**
- 187 : : * @dev Get WETH address used by WrappedTokenGatewayV3
- 188 : : */
- 189 : 1 : function getWETHAddress() external view returns (address) {
- 190 : 3 : return address(WETH);
- 191 : : }
- 192 : :
- 193 : : /**
- 194 : : * @dev Only WETH contract is allowed to transfer ETH here. Prevent other addresses to send Ether to this contract.
- 195 : : */
- 196 : : receive() external payable {
- 197 : : require(msg.sender == address(WETH), 'Receive not allowed');
- 198 : : }
- 199 : :
- 200 : : /**
- 201 : : * @dev Revert fallback calls
- 202 : : */
- 203 : 2 : fallback() external payable {
- 204 : 4 : revert('Fallback not allowed');
- 205 : : }
- 206 : : }
+ 14 : :
+ 15 : : /**
+ 16 : : * @dev This contract is an upgrade of the WrappedTokenGatewayV3 contract, with immutable pool address.
+ 17 : : * This contract keeps the same interface of the deprecated WrappedTokenGatewayV3 contract.
+ 18 : : */
+ 19 : : contract WrappedTokenGatewayV3 is IWrappedTokenGatewayV3, Ownable {
+ 20 : : using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
+ 21 : : using UserConfiguration for DataTypes.UserConfigurationMap;
+ 22 : : using GPv2SafeERC20 for IERC20;
+ 23 : :
+ 24 : : IWETH internal immutable WETH;
+ 25 : : IPool internal immutable POOL;
+ 26 : :
+ 27 : : /**
+ 28 : : * @dev Sets the WETH address and the PoolAddressesProvider address. Infinite approves pool.
+ 29 : : * @param weth Address of the Wrapped Ether contract
+ 30 : : * @param owner Address of the owner of this contract
+ 31 : : **/
+ 32 : : constructor(address weth, address owner, IPool pool) {
+ 33 : 0 : WETH = IWETH(weth);
+ 34 : 0 : POOL = pool;
+ 35 : 0 : transferOwnership(owner);
+ 36 : 0 : IWETH(weth).approve(address(pool), type(uint256).max);
+ 37 : : }
+ 38 : :
+ 39 : : /**
+ 40 : : * @dev deposits WETH into the reserve, using native ETH. A corresponding amount of the overlying asset (aTokens)
+ 41 : : * is minted.
+ 42 : : * @param onBehalfOf address of the user who will receive the aTokens representing the deposit
+ 43 : : * @param referralCode integrators are assigned a referral code and can potentially receive rewards.
+ 44 : : **/
+ 45 : : function depositETH(address, address onBehalfOf, uint16 referralCode) external payable override {
+ 46 : 8 : WETH.deposit{value: msg.value}();
+ 47 : 8 : POOL.deposit(address(WETH), msg.value, onBehalfOf, referralCode);
+ 48 : : }
+ 49 : :
+ 50 : : /**
+ 51 : : * @dev withdraws the WETH _reserves of msg.sender.
+ 52 : : * @param amount amount of aWETH to withdraw and receive native ETH
+ 53 : : * @param to address of the user who will receive native ETH
+ 54 : : */
+ 55 : : function withdrawETH(address, uint256 amount, address to) external override {
+ 56 : 2 : IAToken aWETH = IAToken(POOL.getReserveData(address(WETH)).aTokenAddress);
+ 57 : 2 : uint256 userBalance = aWETH.balanceOf(msg.sender);
+ 58 : 2 : uint256 amountToWithdraw = amount;
+ 59 : :
+ 60 : : // if amount is equal to uint(-1), the user wants to redeem everything
+ 61 : 2 : if (amount == type(uint256).max) {
+ 62 : 1 : amountToWithdraw = userBalance;
+ 63 : : }
+ 64 : 2 : aWETH.transferFrom(msg.sender, address(this), amountToWithdraw);
+ 65 : 2 : POOL.withdraw(address(WETH), amountToWithdraw, address(this));
+ 66 : 2 : WETH.withdraw(amountToWithdraw);
+ 67 : 2 : _safeTransferETH(to, amountToWithdraw);
+ 68 : : }
+ 69 : :
+ 70 : : /**
+ 71 : : * @dev repays a borrow on the WETH reserve, for the specified amount (or for the whole amount, if uint256(-1) is specified).
+ 72 : : * @param amount the amount to repay, or uint256(-1) if the user wants to repay everything
+ 73 : : * @param onBehalfOf the address for which msg.sender is repaying
+ 74 : : */
+ 75 : : function repayETH(address, uint256 amount, address onBehalfOf) external payable override {
+ 76 : 5 : uint256 paybackAmount = IERC20((POOL.getReserveData(address(WETH))).variableDebtTokenAddress)
+ 77 : : .balanceOf(onBehalfOf);
+ 78 : :
+ 79 : 5 : if (amount < paybackAmount) {
+ 80 : 2 : paybackAmount = amount;
+ 81 : : }
+ 82 : 5 : require(msg.value >= paybackAmount, 'msg.value is less than repayment amount');
+ 83 : 5 : WETH.deposit{value: paybackAmount}();
+ 84 : 5 : POOL.repay(
+ 85 : : address(WETH),
+ 86 : : paybackAmount,
+ 87 : : uint256(DataTypes.InterestRateMode.VARIABLE),
+ 88 : : onBehalfOf
+ 89 : : );
+ 90 : :
+ 91 : : // refund remaining dust eth
+ 92 : 5 : if (msg.value > paybackAmount) _safeTransferETH(msg.sender, msg.value - paybackAmount);
+ 93 : : }
+ 94 : :
+ 95 : : /**
+ 96 : : * @dev borrow WETH, unwraps to ETH and send both the ETH and DebtTokens to msg.sender, via `approveDelegation` and onBehalf argument in `Pool.borrow`.
+ 97 : : * @param amount the amount of ETH to borrow
+ 98 : : * @param referralCode integrators are assigned a referral code and can potentially receive rewards
+ 99 : : */
+ 100 : : function borrowETH(address, uint256 amount, uint16 referralCode) external override {
+ 101 : 1 : POOL.borrow(
+ 102 : : address(WETH),
+ 103 : : amount,
+ 104 : : uint256(DataTypes.InterestRateMode.VARIABLE),
+ 105 : : referralCode,
+ 106 : : msg.sender
+ 107 : : );
+ 108 : 1 : WETH.withdraw(amount);
+ 109 : 1 : _safeTransferETH(msg.sender, amount);
+ 110 : : }
+ 111 : :
+ 112 : : /**
+ 113 : : * @dev withdraws the WETH _reserves of msg.sender.
+ 114 : : * @param amount amount of aWETH to withdraw and receive native ETH
+ 115 : : * @param to address of the user who will receive native ETH
+ 116 : : * @param deadline validity deadline of permit and so depositWithPermit signature
+ 117 : : * @param permitV V parameter of ERC712 permit sig
+ 118 : : * @param permitR R parameter of ERC712 permit sig
+ 119 : : * @param permitS S parameter of ERC712 permit sig
+ 120 : : */
+ 121 : : function withdrawETHWithPermit(
+ 122 : : address,
+ 123 : : uint256 amount,
+ 124 : : address to,
+ 125 : : uint256 deadline,
+ 126 : : uint8 permitV,
+ 127 : : bytes32 permitR,
+ 128 : : bytes32 permitS
+ 129 : : ) external override {
+ 130 : 2 : IAToken aWETH = IAToken(POOL.getReserveData(address(WETH)).aTokenAddress);
+ 131 : 2 : uint256 userBalance = aWETH.balanceOf(msg.sender);
+ 132 : 2 : uint256 amountToWithdraw = amount;
+ 133 : :
+ 134 : : // if amount is equal to type(uint256).max, the user wants to redeem everything
+ 135 : 2 : if (amount == type(uint256).max) {
+ 136 : 1 : amountToWithdraw = userBalance;
+ 137 : : }
+ 138 : : // permit `amount` rather than `amountToWithdraw` to make it easier for front-ends and integrators
+ 139 : 2 : aWETH.permit(msg.sender, address(this), amount, deadline, permitV, permitR, permitS);
+ 140 : 2 : aWETH.transferFrom(msg.sender, address(this), amountToWithdraw);
+ 141 : 2 : POOL.withdraw(address(WETH), amountToWithdraw, address(this));
+ 142 : 2 : WETH.withdraw(amountToWithdraw);
+ 143 : 2 : _safeTransferETH(to, amountToWithdraw);
+ 144 : : }
+ 145 : :
+ 146 : : /**
+ 147 : : * @dev transfer ETH to an address, revert if it fails.
+ 148 : : * @param to recipient of the transfer
+ 149 : : * @param value the amount to send
+ 150 : : */
+ 151 : : function _safeTransferETH(address to, uint256 value) internal {
+ 152 : 7 : (bool success, ) = to.call{value: value}(new bytes(0));
+ 153 : 7 : require(success, 'ETH_TRANSFER_FAILED');
+ 154 : : }
+ 155 : :
+ 156 : : /**
+ 157 : : * @dev transfer ERC20 from the utility contract, for ERC20 recovery in case of stuck tokens due
+ 158 : : * direct transfers to the contract address.
+ 159 : : * @param token token to transfer
+ 160 : : * @param to recipient of the transfer
+ 161 : : * @param amount amount to send
+ 162 : : */
+ 163 : : function emergencyTokenTransfer(address token, address to, uint256 amount) external onlyOwner {
+ 164 : 1 : IERC20(token).safeTransfer(to, amount);
+ 165 : : }
+ 166 : :
+ 167 : : /**
+ 168 : : * @dev transfer native Ether from the utility contract, for native Ether recovery in case of stuck Ether
+ 169 : : * due to selfdestructs or ether transfers to the pre-computed contract address before deployment.
+ 170 : : * @param to recipient of the transfer
+ 171 : : * @param amount amount to send
+ 172 : : */
+ 173 : : function emergencyEtherTransfer(address to, uint256 amount) external onlyOwner {
+ 174 : 1 : _safeTransferETH(to, amount);
+ 175 : : }
+ 176 : :
+ 177 : : /**
+ 178 : : * @dev Get WETH address used by WrappedTokenGatewayV3
+ 179 : : */
+ 180 : : function getWETHAddress() external view returns (address) {
+ 181 : 1 : return address(WETH);
+ 182 : : }
+ 183 : :
+ 184 : : /**
+ 185 : : * @dev Only WETH contract is allowed to transfer ETH here. Prevent other addresses to send Ether to this contract.
+ 186 : : */
+ 187 : : receive() external payable {
+ 188 : : require(msg.sender == address(WETH), 'Receive not allowed');
+ 189 : : }
+ 190 : :
+ 191 : : /**
+ 192 : : * @dev Revert fallback calls
+ 193 : : */
+ 194 : : fallback() external payable {
+ 195 : 2 : revert('Fallback not allowed');
+ 196 : : }
+ 197 : : }
@@ -282,8 +273,8 @@
diff --git a/report/helpers/index-sort-b.html b/report/helpers/index-sort-b.html
new file mode 100644
index 00000000..913d2408
--- /dev/null
+++ b/report/helpers/index-sort-b.html
@@ -0,0 +1,139 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - helpers
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../glass.png) |
+
+ |
+
+
+ ![](../glass.png) |
+
+
+
+
+
+
+
|
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+ File ![Click to sort table by file name Sort by file name](../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../glass.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../updown.png) |
+
+
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+
+
+ L2Encoder.sol |
+
+
+ |
+ 98.3 % |
+ 58 |
+ 57 |
+ - |
+ |
+ |
+ 90.0 % |
+ 10 |
+ 9 |
+
+
+ WrappedTokenGatewayV3.sol |
+
+
+ |
+ 90.2 % |
+ 41 |
+ 37 |
+ - |
+ |
+ |
+ 100.0 % |
+ 10 |
+ 10 |
+
+
+
+
+
+
+
+
+
+
diff --git a/report/helpers/index-sort-f.html b/report/helpers/index-sort-f.html
new file mode 100644
index 00000000..9a72208b
--- /dev/null
+++ b/report/helpers/index-sort-f.html
@@ -0,0 +1,139 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - helpers
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../glass.png) |
+
+ |
+
+
+ ![](../glass.png) |
+
+
+
+
+
+
+
|
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+ File ![Click to sort table by file name Sort by file name](../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../glass.png) |
+
+
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+
+
+ L2Encoder.sol |
+
+
+ |
+ 98.3 % |
+ 58 |
+ 57 |
+ - |
+ |
+ |
+ 90.0 % |
+ 10 |
+ 9 |
+
+
+ WrappedTokenGatewayV3.sol |
+
+
+ |
+ 90.2 % |
+ 41 |
+ 37 |
+ - |
+ |
+ |
+ 100.0 % |
+ 10 |
+ 10 |
+
+
+
+
+
+
+
+
+
+
diff --git a/report/helpers/index-sort-l.html b/report/helpers/index-sort-l.html
new file mode 100644
index 00000000..61f2165b
--- /dev/null
+++ b/report/helpers/index-sort-l.html
@@ -0,0 +1,139 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - helpers
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../glass.png) |
+
+ |
+
+
+ ![](../glass.png) |
+
+
+
+
+
+
+
|
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+ File ![Click to sort table by file name Sort by file name](../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../glass.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../updown.png) |
+
+
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+
+
+ WrappedTokenGatewayV3.sol |
+
+
+ |
+ 90.2 % |
+ 41 |
+ 37 |
+ - |
+ |
+ |
+ 100.0 % |
+ 10 |
+ 10 |
+
+
+ L2Encoder.sol |
+
+
+ |
+ 98.3 % |
+ 58 |
+ 57 |
+ - |
+ |
+ |
+ 90.0 % |
+ 10 |
+ 9 |
+
+
+
+
+
+
+
+
+
+
diff --git a/report/helpers/index.html b/report/helpers/index.html
new file mode 100644
index 00000000..f94d5a6d
--- /dev/null
+++ b/report/helpers/index.html
@@ -0,0 +1,139 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - helpers
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../glass.png) |
+
+ |
+
+
+ ![](../glass.png) |
+
+
+
+
+
+
+
|
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+ File ![Click to sort table by file name Sort by file name](../glass.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../updown.png) |
+
+
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+
+
+ L2Encoder.sol |
+
+
+ |
+ 98.3 % |
+ 58 |
+ 57 |
+ - |
+ |
+ |
+ 90.0 % |
+ 10 |
+ 9 |
+
+
+ WrappedTokenGatewayV3.sol |
+
+
+ |
+ 90.2 % |
+ 41 |
+ 37 |
+ - |
+ |
+ |
+ 100.0 % |
+ 10 |
+ 10 |
+
+
+
+
+
+
+
+
+
+
diff --git a/report/index-sort-b.html b/report/index-sort-b.html
index 5f1a2742..cd0fba43 100644
--- a/report/index-sort-b.html
+++ b/report/index-sort-b.html
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -96,229 +96,229 @@
Hit |
- core/contracts/misc/src/core/contracts/misc |
+ extensions/paraswap-adapters/ |
-
+
|
- 100.0 % |
- 93 |
- 93 |
+ 87.8 % |
+ 164 |
+ 144 |
- |
|
|
- 100.0 % |
- 20 |
+ 74.1 % |
+ 27 |
20 |
- core/contracts/protocol/configuration/src/core/contracts/protocol/configuration |
+ extensions/static-a-token/ |
-
+
|
- 100.0 % |
- 111 |
- 111 |
+ 89.4 % |
+ 208 |
+ 186 |
- |
|
|
- 100.0 % |
- 55 |
- 55 |
+ 84.2 % |
+ 57 |
+ 48 |
- core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability |
+ helpers/ |
-
+
|
- 100.0 % |
- 12 |
- 12 |
+ 94.9 % |
+ 99 |
+ 94 |
- |
|
|
- 100.0 % |
- 7 |
- 7 |
+ 95.0 % |
+ 20 |
+ 19 |
- core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers |
+ instances/ |
|
100.0 % |
- 1 |
- 1 |
+ 24 |
+ 24 |
- |
|
|
100.0 % |
- 1 |
- 1 |
+ 11 |
+ 11 |
- core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic |
+ misc/ |
-
+
|
- 97.9 % |
- 576 |
- 564 |
+ 93.2 % |
+ 88 |
+ 82 |
- |
|
|
- 100.0 % |
- 64 |
- 64 |
+ 97.1 % |
+ 35 |
+ 34 |
- core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math |
+ misc/aave-upgradeability/ |
|
100.0 % |
- 37 |
- 37 |
+ 23 |
+ 23 |
- |
|
|
100.0 % |
- 10 |
- 10 |
+ 11 |
+ 11 |
- core/contracts/protocol/pool/src/core/contracts/protocol/pool |
+ misc/flashloan/base/ |
-
+
|
- 98.1 % |
- 365 |
- 358 |
+ 50.0 % |
+ 4 |
+ 2 |
- |
|
|
- 97.6 % |
- 124 |
- 121 |
+ 50.0 % |
+ 2 |
+ 1 |
- core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base |
+ protocol/configuration/ |
-
+
|
- 100.0 % |
- 115 |
- 115 |
+ 95.4 % |
+ 108 |
+ 103 |
- |
|
|
- 100.0 % |
- 35 |
- 35 |
+ 96.1 % |
+ 51 |
+ 49 |
- core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization |
+ protocol/libraries/logic/ |
-
+
|
- 90.5 % |
- 74 |
- 67 |
+ 99.8 % |
+ 493 |
+ 492 |
- |
|
|
100.0 % |
- 47 |
- 47 |
+ 54 |
+ 54 |
- core/instances/src/core/instances |
+ protocol/libraries/math/ |
-
+
|
- 94.1 % |
- 34 |
- 32 |
+ 95.6 % |
+ 45 |
+ 43 |
- |
|
|
- 80.0 % |
+ 100.0 % |
+ 10 |
10 |
- 8 |
- periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap |
+ protocol/pool/ |
-
+
|
- 99.3 % |
- 140 |
- 139 |
+ 99.4 % |
+ 331 |
+ 329 |
- |
|
|
- 95.0 % |
- 20 |
- 19 |
+ 100.0 % |
+ 119 |
+ 119 |
- periphery/contracts/libraries/src/periphery/contracts/libraries |
+ protocol/tokenization/ |
|
100.0 % |
- 1 |
- 1 |
+ 55 |
+ 55 |
- |
|
|
100.0 % |
- 1 |
- 1 |
+ 30 |
+ 30 |
- periphery/contracts/misc/src/periphery/contracts/misc |
+ protocol/tokenization/base/ |
|
100.0 % |
- 38 |
- 38 |
+ 124 |
+ 124 |
- |
|
|
- 100.0 % |
- 10 |
- 10 |
+ 97.6 % |
+ 42 |
+ 41 |
- periphery/contracts/rewards/src/periphery/contracts/rewards |
+ rewards/ |
-
+
|
- 99.1 % |
- 214 |
- 212 |
+ 98.6 % |
+ 219 |
+ 216 |
- |
|
|
- 100.0 % |
- 55 |
- 55 |
+ 96.7 % |
+ 61 |
+ 59 |
- periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies |
+ rewards/transfer-strategies/ |
-
+
|
- 100.0 % |
- 15 |
- 15 |
+ 83.3 % |
+ 24 |
+ 20 |
- |
|
|
- 100.0 % |
- 10 |
- 10 |
+ 93.3 % |
+ 15 |
+ 14 |
@@ -326,7 +326,7 @@
diff --git a/report/index-sort-f.html b/report/index-sort-f.html
index 0c255fb4..1f749f29 100644
--- a/report/index-sort-f.html
+++ b/report/index-sort-f.html
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -96,229 +96,229 @@
Hit |
- core/instances/src/core/instances |
+ misc/flashloan/base/ |
-
+
|
- 94.1 % |
- 34 |
- 32 |
+ 50.0 % |
+ 4 |
+ 2 |
- |
|
|
- 80.0 % |
- 10 |
- 8 |
+ 50.0 % |
+ 2 |
+ 1 |
- periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap |
+ extensions/paraswap-adapters/ |
-
+
|
- 99.3 % |
- 140 |
- 139 |
+ 87.8 % |
+ 164 |
+ 144 |
- |
|
|
- 95.0 % |
+ 74.1 % |
+ 27 |
20 |
- 19 |
- core/contracts/protocol/pool/src/core/contracts/protocol/pool |
+ extensions/static-a-token/ |
-
+
|
- 98.1 % |
- 365 |
- 358 |
+ 89.4 % |
+ 208 |
+ 186 |
- |
|
|
- 97.6 % |
- 124 |
- 121 |
+ 84.2 % |
+ 57 |
+ 48 |
- core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers |
+ rewards/transfer-strategies/ |
-
+
|
- 100.0 % |
- 1 |
- 1 |
+ 83.3 % |
+ 24 |
+ 20 |
- |
|
|
- 100.0 % |
- 1 |
- 1 |
+ 93.3 % |
+ 15 |
+ 14 |
- periphery/contracts/libraries/src/periphery/contracts/libraries |
+ helpers/ |
-
+
|
- 100.0 % |
- 1 |
- 1 |
+ 94.9 % |
+ 99 |
+ 94 |
- |
|
|
- 100.0 % |
- 1 |
- 1 |
+ 95.0 % |
+ 20 |
+ 19 |
- core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability |
+ protocol/configuration/ |
-
+
|
- 100.0 % |
- 12 |
- 12 |
+ 95.4 % |
+ 108 |
+ 103 |
- |
|
|
- 100.0 % |
- 7 |
- 7 |
+ 96.1 % |
+ 51 |
+ 49 |
- core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math |
+ rewards/ |
-
+
|
- 100.0 % |
- 37 |
- 37 |
+ 98.6 % |
+ 219 |
+ 216 |
- |
|
|
- 100.0 % |
- 10 |
- 10 |
+ 96.7 % |
+ 61 |
+ 59 |
- periphery/contracts/misc/src/periphery/contracts/misc |
+ misc/ |
-
+
|
- 100.0 % |
- 38 |
- 38 |
+ 93.2 % |
+ 88 |
+ 82 |
- |
|
|
- 100.0 % |
- 10 |
- 10 |
+ 97.1 % |
+ 35 |
+ 34 |
- periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies |
+ protocol/tokenization/base/ |
|
100.0 % |
- 15 |
- 15 |
+ 124 |
+ 124 |
- |
|
|
- 100.0 % |
- 10 |
- 10 |
+ 97.6 % |
+ 42 |
+ 41 |
- core/contracts/misc/src/core/contracts/misc |
+ protocol/libraries/math/ |
-
+
|
- 100.0 % |
- 93 |
- 93 |
+ 95.6 % |
+ 45 |
+ 43 |
- |
|
|
100.0 % |
- 20 |
- 20 |
+ 10 |
+ 10 |
- core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base |
+ instances/ |
|
100.0 % |
- 115 |
- 115 |
+ 24 |
+ 24 |
- |
|
|
100.0 % |
- 35 |
- 35 |
+ 11 |
+ 11 |
- core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization |
+ misc/aave-upgradeability/ |
-
+
|
- 90.5 % |
- 74 |
- 67 |
+ 100.0 % |
+ 23 |
+ 23 |
- |
|
|
100.0 % |
- 47 |
- 47 |
+ 11 |
+ 11 |
- core/contracts/protocol/configuration/src/core/contracts/protocol/configuration |
+ protocol/tokenization/ |
|
100.0 % |
- 111 |
- 111 |
+ 55 |
+ 55 |
- |
|
|
100.0 % |
- 55 |
- 55 |
+ 30 |
+ 30 |
- periphery/contracts/rewards/src/periphery/contracts/rewards |
+ protocol/libraries/logic/ |
-
+
|
- 99.1 % |
- 214 |
- 212 |
+ 99.8 % |
+ 493 |
+ 492 |
- |
|
|
100.0 % |
- 55 |
- 55 |
+ 54 |
+ 54 |
- core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic |
+ protocol/pool/ |
-
+
|
- 97.9 % |
- 576 |
- 564 |
+ 99.4 % |
+ 331 |
+ 329 |
- |
|
|
100.0 % |
- 64 |
- 64 |
+ 119 |
+ 119 |
@@ -326,7 +326,7 @@
diff --git a/report/index-sort-l.html b/report/index-sort-l.html
index fdb18d18..780d900a 100644
--- a/report/index-sort-l.html
+++ b/report/index-sort-l.html
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -96,88 +96,88 @@
Hit |
- core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization |
+ misc/flashloan/base/ |
-
+
|
- 90.5 % |
- 74 |
- 67 |
+ 50.0 % |
+ 4 |
+ 2 |
- |
|
|
- 100.0 % |
- 47 |
- 47 |
+ 50.0 % |
+ 2 |
+ 1 |
- core/instances/src/core/instances |
+ rewards/transfer-strategies/ |
-
+
|
- 94.1 % |
- 34 |
- 32 |
+ 83.3 % |
+ 24 |
+ 20 |
- |
|
|
- 80.0 % |
- 10 |
- 8 |
+ 93.3 % |
+ 15 |
+ 14 |
- core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic |
+ extensions/paraswap-adapters/ |
-
+
|
- 97.9 % |
- 576 |
- 564 |
+ 87.8 % |
+ 164 |
+ 144 |
- |
|
|
- 100.0 % |
- 64 |
- 64 |
+ 74.1 % |
+ 27 |
+ 20 |
- core/contracts/protocol/pool/src/core/contracts/protocol/pool |
+ extensions/static-a-token/ |
-
+
|
- 98.1 % |
- 365 |
- 358 |
+ 89.4 % |
+ 208 |
+ 186 |
- |
|
|
- 97.6 % |
- 124 |
- 121 |
+ 84.2 % |
+ 57 |
+ 48 |
- periphery/contracts/rewards/src/periphery/contracts/rewards |
+ misc/ |
-
+
|
- 99.1 % |
- 214 |
- 212 |
+ 93.2 % |
+ 88 |
+ 82 |
- |
|
|
- 100.0 % |
- 55 |
- 55 |
+ 97.1 % |
+ 35 |
+ 34 |
- periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap |
+ helpers/ |
-
+
|
- 99.3 % |
- 140 |
- 139 |
+ 94.9 % |
+ 99 |
+ 94 |
- |
|
|
@@ -186,139 +186,139 @@
19 |
- core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers |
+ protocol/configuration/ |
-
+
|
- 100.0 % |
- 1 |
- 1 |
+ 95.4 % |
+ 108 |
+ 103 |
- |
|
|
- 100.0 % |
- 1 |
- 1 |
+ 96.1 % |
+ 51 |
+ 49 |
- periphery/contracts/libraries/src/periphery/contracts/libraries |
+ protocol/libraries/math/ |
-
+
|
- 100.0 % |
- 1 |
- 1 |
+ 95.6 % |
+ 45 |
+ 43 |
- |
|
|
100.0 % |
- 1 |
- 1 |
+ 10 |
+ 10 |
- core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability |
+ rewards/ |
-
+
|
- 100.0 % |
- 12 |
- 12 |
+ 98.6 % |
+ 219 |
+ 216 |
- |
|
|
- 100.0 % |
- 7 |
- 7 |
+ 96.7 % |
+ 61 |
+ 59 |
- periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies |
+ protocol/pool/ |
-
+
|
- 100.0 % |
- 15 |
- 15 |
+ 99.4 % |
+ 331 |
+ 329 |
- |
|
|
100.0 % |
- 10 |
- 10 |
+ 119 |
+ 119 |
- core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math |
+ protocol/libraries/logic/ |
-
+
|
- 100.0 % |
- 37 |
- 37 |
+ 99.8 % |
+ 493 |
+ 492 |
- |
|
|
100.0 % |
- 10 |
- 10 |
+ 54 |
+ 54 |
- periphery/contracts/misc/src/periphery/contracts/misc |
+ misc/aave-upgradeability/ |
|
100.0 % |
- 38 |
- 38 |
+ 23 |
+ 23 |
- |
|
|
100.0 % |
- 10 |
- 10 |
+ 11 |
+ 11 |
- core/contracts/misc/src/core/contracts/misc |
+ instances/ |
|
100.0 % |
- 93 |
- 93 |
+ 24 |
+ 24 |
- |
|
|
100.0 % |
- 20 |
- 20 |
+ 11 |
+ 11 |
- core/contracts/protocol/configuration/src/core/contracts/protocol/configuration |
+ protocol/tokenization/ |
|
100.0 % |
- 111 |
- 111 |
+ 55 |
+ 55 |
- |
|
|
100.0 % |
- 55 |
- 55 |
+ 30 |
+ 30 |
- core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base |
+ protocol/tokenization/base/ |
|
100.0 % |
- 115 |
- 115 |
+ 124 |
+ 124 |
- |
|
|
- 100.0 % |
- 35 |
- 35 |
+ 97.6 % |
+ 42 |
+ 41 |
@@ -326,7 +326,7 @@
diff --git a/report/index.html b/report/index.html
index c4ee4cdb..1a8e5fc2 100644
--- a/report/index.html
+++ b/report/index.html
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -96,229 +96,229 @@
Hit |
- core/contracts/misc/src/core/contracts/misc |
+ extensions/paraswap-adapters/ |
-
+
|
- 100.0 % |
- 93 |
- 93 |
+ 87.8 % |
+ 164 |
+ 144 |
- |
|
|
- 100.0 % |
- 20 |
+ 74.1 % |
+ 27 |
20 |
- core/contracts/protocol/configuration/src/core/contracts/protocol/configuration |
+ extensions/static-a-token/ |
-
+
|
- 100.0 % |
- 111 |
- 111 |
+ 89.4 % |
+ 208 |
+ 186 |
- |
|
|
- 100.0 % |
- 55 |
- 55 |
+ 84.2 % |
+ 57 |
+ 48 |
- core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability |
+ helpers/ |
-
+
|
- 100.0 % |
- 12 |
- 12 |
+ 94.9 % |
+ 99 |
+ 94 |
- |
|
|
- 100.0 % |
- 7 |
- 7 |
+ 95.0 % |
+ 20 |
+ 19 |
- core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers |
+ instances/ |
|
100.0 % |
- 1 |
- 1 |
+ 24 |
+ 24 |
- |
|
|
100.0 % |
- 1 |
- 1 |
+ 11 |
+ 11 |
- core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic |
+ misc/ |
-
+
|
- 97.9 % |
- 576 |
- 564 |
+ 93.2 % |
+ 88 |
+ 82 |
- |
|
|
- 100.0 % |
- 64 |
- 64 |
+ 97.1 % |
+ 35 |
+ 34 |
- core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math |
+ misc/aave-upgradeability/ |
|
100.0 % |
- 37 |
- 37 |
+ 23 |
+ 23 |
- |
|
|
100.0 % |
- 10 |
- 10 |
+ 11 |
+ 11 |
- core/contracts/protocol/pool/src/core/contracts/protocol/pool |
+ misc/flashloan/base/ |
-
+
|
- 98.1 % |
- 365 |
- 358 |
+ 50.0 % |
+ 4 |
+ 2 |
- |
|
|
- 97.6 % |
- 124 |
- 121 |
+ 50.0 % |
+ 2 |
+ 1 |
- core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base |
+ protocol/configuration/ |
-
+
|
- 100.0 % |
- 115 |
- 115 |
+ 95.4 % |
+ 108 |
+ 103 |
- |
|
|
- 100.0 % |
- 35 |
- 35 |
+ 96.1 % |
+ 51 |
+ 49 |
- core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization |
+ protocol/libraries/logic/ |
-
+
|
- 90.5 % |
- 74 |
- 67 |
+ 99.8 % |
+ 493 |
+ 492 |
- |
|
|
100.0 % |
- 47 |
- 47 |
+ 54 |
+ 54 |
- core/instances/src/core/instances |
+ protocol/libraries/math/ |
-
+
|
- 94.1 % |
- 34 |
- 32 |
+ 95.6 % |
+ 45 |
+ 43 |
- |
|
|
- 80.0 % |
+ 100.0 % |
+ 10 |
10 |
- 8 |
- periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap |
+ protocol/pool/ |
-
+
|
- 99.3 % |
- 140 |
- 139 |
+ 99.4 % |
+ 331 |
+ 329 |
- |
|
|
- 95.0 % |
- 20 |
- 19 |
+ 100.0 % |
+ 119 |
+ 119 |
- periphery/contracts/libraries/src/periphery/contracts/libraries |
+ protocol/tokenization/ |
|
100.0 % |
- 1 |
- 1 |
+ 55 |
+ 55 |
- |
|
|
100.0 % |
- 1 |
- 1 |
+ 30 |
+ 30 |
- periphery/contracts/misc/src/periphery/contracts/misc |
+ protocol/tokenization/base/ |
|
100.0 % |
- 38 |
- 38 |
+ 124 |
+ 124 |
- |
|
|
- 100.0 % |
- 10 |
- 10 |
+ 97.6 % |
+ 42 |
+ 41 |
- periphery/contracts/rewards/src/periphery/contracts/rewards |
+ rewards/ |
-
+
|
- 99.1 % |
- 214 |
- 212 |
+ 98.6 % |
+ 219 |
+ 216 |
- |
|
|
- 100.0 % |
- 55 |
- 55 |
+ 96.7 % |
+ 61 |
+ 59 |
- periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies |
+ rewards/transfer-strategies/ |
-
+
|
- 100.0 % |
- 15 |
- 15 |
+ 83.3 % |
+ 24 |
+ 20 |
- |
|
|
- 100.0 % |
- 10 |
- 10 |
+ 93.3 % |
+ 15 |
+ 14 |
@@ -326,7 +326,7 @@
diff --git a/report/core/instances/src/core/instances/ATokenInstance.sol.func-c.html b/report/instances/ATokenInstance.sol.func-c.html
similarity index 63%
rename from report/core/instances/src/core/instances/ATokenInstance.sol.func-c.html
rename to report/instances/ATokenInstance.sol.func-c.html
index 9c9950d0..d83b22b7 100644
--- a/report/core/instances/src/core/instances/ATokenInstance.sol.func-c.html
+++ b/report/instances/ATokenInstance.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/instances/src/core/instances/ATokenInstance.sol - functions
-
+ LCOV - lcov.info.p - instances/ATokenInstance.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -37,12 +37,12 @@
-
+
|
-
-
+
+
|
@@ -53,35 +53,42 @@
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../glass.png) |
+
+
+
+
+ ATokenInstance. |
+
+ 11 |
ATokenInstance.getRevision |
- 3469 |
+ 166696 |
ATokenInstance.initialize |
- 3470 |
+ 166697 |
@@ -89,8 +96,8 @@
diff --git a/report/core/instances/src/core/instances/ATokenInstance.sol.func.html b/report/instances/ATokenInstance.sol.func.html
similarity index 63%
rename from report/core/instances/src/core/instances/ATokenInstance.sol.func.html
rename to report/instances/ATokenInstance.sol.func.html
index 4ea020d2..8e578d85 100644
--- a/report/core/instances/src/core/instances/ATokenInstance.sol.func.html
+++ b/report/instances/ATokenInstance.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/instances/src/core/instances/ATokenInstance.sol - functions
-
+ LCOV - lcov.info.p - instances/ATokenInstance.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -37,12 +37,12 @@
-
+
|
-
-
+
+
|
@@ -53,35 +53,42 @@
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../updown.png) |
+
+
+
+
+ ATokenInstance. |
+
+ 11 |
ATokenInstance.getRevision |
- 3469 |
+ 166696 |
ATokenInstance.initialize |
- 3470 |
+ 166697 |
@@ -89,8 +96,8 @@
diff --git a/report/core/instances/src/core/instances/ATokenInstance.sol.gcov.html b/report/instances/ATokenInstance.sol.gcov.html
similarity index 79%
rename from report/core/instances/src/core/instances/ATokenInstance.sol.gcov.html
rename to report/instances/ATokenInstance.sol.gcov.html
index 9c0e3a35..fe163efd 100644
--- a/report/core/instances/src/core/instances/ATokenInstance.sol.gcov.html
+++ b/report/instances/ATokenInstance.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/instances/src/core/instances/ATokenInstance.sol
-
+ LCOV - lcov.info.p - instances/ATokenInstance.sol
+
LCOV - code coverage report |
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -37,12 +37,12 @@
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
@@ -72,7 +72,7 @@
1 : : // SPDX-License-Identifier: MIT
2 : : pragma solidity ^0.8.0;
3 : :
- 4 : : import {AToken, IPool, IAaveIncentivesController, IInitializableAToken, Errors, VersionedInitializable} from '../contracts/protocol/tokenization/AToken.sol';
+ 4 : : import {AToken, IPool, IAaveIncentivesController, IInitializableAToken, Errors, VersionedInitializable} from '../protocol/tokenization/AToken.sol';
5 : :
6 : : contract ATokenInstance is AToken {
7 : : uint256 public constant ATOKEN_REVISION = 1;
@@ -80,12 +80,12 @@
9 : : constructor(IPool pool) AToken(pool) {}
10 : :
11 : : /// @inheritdoc VersionedInitializable
- 12 : 3469 : function getRevision() internal pure virtual override returns (uint256) {
- 13 : 6938 : return ATOKEN_REVISION;
+ 12 : : function getRevision() internal pure virtual override returns (uint256) {
+ 13 : 166696 : return ATOKEN_REVISION;
14 : : }
15 : :
16 : : /// @inheritdoc IInitializableAToken
- 17 : 3470 : function initialize(
+ 17 : : function initialize(
18 : : IPool initializingPool,
19 : : address treasury,
20 : : address underlyingAsset,
@@ -95,18 +95,18 @@
24 : : string calldata aTokenSymbol,
25 : : bytes calldata params
26 : : ) public virtual override initializer {
- 27 : 6940 : require(initializingPool == POOL, Errors.POOL_ADDRESSES_DO_NOT_MATCH);
- 28 : 6940 : _setName(aTokenName);
- 29 : 6940 : _setSymbol(aTokenSymbol);
- 30 : 6940 : _setDecimals(aTokenDecimals);
+ 27 : 166697 : require(initializingPool == POOL, Errors.POOL_ADDRESSES_DO_NOT_MATCH);
+ 28 : 166697 : _setName(aTokenName);
+ 29 : 166697 : _setSymbol(aTokenSymbol);
+ 30 : 166697 : _setDecimals(aTokenDecimals);
31 : :
- 32 : 6940 : _treasury = treasury;
- 33 : 6940 : _underlyingAsset = underlyingAsset;
- 34 : 6940 : _incentivesController = incentivesController;
+ 32 : 166697 : _treasury = treasury;
+ 33 : 166697 : _underlyingAsset = underlyingAsset;
+ 34 : 166697 : _incentivesController = incentivesController;
35 : :
- 36 : 6940 : _domainSeparator = _calculateDomainSeparator();
+ 36 : 166697 : _domainSeparator = _calculateDomainSeparator();
37 : :
- 38 : 6940 : emit Initialized(
+ 38 : 166697 : emit Initialized(
39 : : underlyingAsset,
40 : : address(POOL),
41 : : treasury,
@@ -125,8 +125,8 @@
diff --git a/report/core/instances/src/core/instances/PoolConfiguratorInstance.sol.func-c.html b/report/instances/PoolConfiguratorInstance.sol.func-c.html
similarity index 68%
rename from report/core/instances/src/core/instances/PoolConfiguratorInstance.sol.func-c.html
rename to report/instances/PoolConfiguratorInstance.sol.func-c.html
index f69764a3..a679cce6 100644
--- a/report/core/instances/src/core/instances/PoolConfiguratorInstance.sol.func-c.html
+++ b/report/instances/PoolConfiguratorInstance.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/instances/src/core/instances/PoolConfiguratorInstance.sol - functions
-
+ LCOV - lcov.info.p - instances/PoolConfiguratorInstance.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -37,7 +37,7 @@
-
+
|
@@ -53,35 +53,35 @@
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../glass.png) |
PoolConfiguratorInstance.getRevision |
- 1232 |
+ 1389 |
PoolConfiguratorInstance.initialize |
- 1232 |
+ 1389 |
@@ -89,8 +89,8 @@
diff --git a/report/core/instances/src/core/instances/PoolConfiguratorInstance.sol.func.html b/report/instances/PoolConfiguratorInstance.sol.func.html
similarity index 68%
rename from report/core/instances/src/core/instances/PoolConfiguratorInstance.sol.func.html
rename to report/instances/PoolConfiguratorInstance.sol.func.html
index 8fe1d16b..39a526df 100644
--- a/report/core/instances/src/core/instances/PoolConfiguratorInstance.sol.func.html
+++ b/report/instances/PoolConfiguratorInstance.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/instances/src/core/instances/PoolConfiguratorInstance.sol - functions
-
+ LCOV - lcov.info.p - instances/PoolConfiguratorInstance.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -37,7 +37,7 @@
-
+
|
@@ -53,35 +53,35 @@
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../updown.png) |
PoolConfiguratorInstance.getRevision |
- 1232 |
+ 1389 |
PoolConfiguratorInstance.initialize |
- 1232 |
+ 1389 |
@@ -89,8 +89,8 @@
diff --git a/report/core/instances/src/core/instances/PoolConfiguratorInstance.sol.gcov.html b/report/instances/PoolConfiguratorInstance.sol.gcov.html
similarity index 72%
rename from report/core/instances/src/core/instances/PoolConfiguratorInstance.sol.gcov.html
rename to report/instances/PoolConfiguratorInstance.sol.gcov.html
index 92e18a88..86aefa61 100644
--- a/report/core/instances/src/core/instances/PoolConfiguratorInstance.sol.gcov.html
+++ b/report/instances/PoolConfiguratorInstance.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/instances/src/core/instances/PoolConfiguratorInstance.sol
-
+ LCOV - lcov.info.p - instances/PoolConfiguratorInstance.sol
+
LCOV - code coverage report |
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -37,7 +37,7 @@
-
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
@@ -72,19 +72,19 @@
1 : : // SPDX-License-Identifier: MIT
2 : : pragma solidity ^0.8.0;
3 : :
- 4 : : import {PoolConfigurator, IPoolAddressesProvider, IPool, VersionedInitializable} from 'aave-v3-core/contracts/protocol/pool/PoolConfigurator.sol';
+ 4 : : import {PoolConfigurator, IPoolAddressesProvider, IPool, VersionedInitializable} from '../protocol/pool/PoolConfigurator.sol';
5 : :
6 : : contract PoolConfiguratorInstance is PoolConfigurator {
- 7 : : uint256 public constant CONFIGURATOR_REVISION = 3;
+ 7 : : uint256 public constant CONFIGURATOR_REVISION = 4;
8 : :
9 : : /// @inheritdoc VersionedInitializable
- 10 : 1232 : function getRevision() internal pure virtual override returns (uint256) {
- 11 : 2464 : return CONFIGURATOR_REVISION;
+ 10 : : function getRevision() internal pure virtual override returns (uint256) {
+ 11 : 1389 : return CONFIGURATOR_REVISION;
12 : : }
13 : :
- 14 : 1232 : function initialize(IPoolAddressesProvider provider) public virtual override initializer {
- 15 : 2464 : _addressesProvider = provider;
- 16 : 2464 : _pool = IPool(_addressesProvider.getPool());
+ 14 : : function initialize(IPoolAddressesProvider provider) public virtual override initializer {
+ 15 : 1389 : _addressesProvider = provider;
+ 16 : 1389 : _pool = IPool(_addressesProvider.getPool());
17 : : }
18 : : }
@@ -94,8 +94,8 @@
diff --git a/report/core/instances/src/core/instances/PoolInstance.sol.func-c.html b/report/instances/PoolInstance.sol.func-c.html
similarity index 64%
rename from report/core/instances/src/core/instances/PoolInstance.sol.func-c.html
rename to report/instances/PoolInstance.sol.func-c.html
index 9587d444..2187e044 100644
--- a/report/core/instances/src/core/instances/PoolInstance.sol.func-c.html
+++ b/report/instances/PoolInstance.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/instances/src/core/instances/PoolInstance.sol - functions
-
+ LCOV - lcov.info.p - instances/PoolInstance.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,35 +53,42 @@
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../updown.png) |
+
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../glass.png) |
+
+
+
+
+ PoolInstance. |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../glass.png) |
+ 194 |
- PoolInstance.getRevision |
+ PoolInstance.getRevision |
- 1238 |
+ 1395 |
PoolInstance.initialize |
- 1238 |
+ 1395 |
@@ -89,8 +96,8 @@
diff --git a/report/core/instances/src/core/instances/PoolInstance.sol.func.html b/report/instances/PoolInstance.sol.func.html
similarity index 64%
rename from report/core/instances/src/core/instances/PoolInstance.sol.func.html
rename to report/instances/PoolInstance.sol.func.html
index 1d449c53..c5b24f36 100644
--- a/report/core/instances/src/core/instances/PoolInstance.sol.func.html
+++ b/report/instances/PoolInstance.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/instances/src/core/instances/PoolInstance.sol - functions
-
+ LCOV - lcov.info.p - instances/PoolInstance.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,35 +53,42 @@
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../glass.png) |
+
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../updown.png) |
+
+
+
+
+ PoolInstance. |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../updown.png) |
+ 194 |
- PoolInstance.getRevision |
+ PoolInstance.getRevision |
- 1238 |
+ 1395 |
PoolInstance.initialize |
- 1238 |
+ 1395 |
@@ -89,8 +96,8 @@
diff --git a/report/core/instances/src/core/instances/PoolInstance.sol.gcov.html b/report/instances/PoolInstance.sol.gcov.html
similarity index 72%
rename from report/core/instances/src/core/instances/PoolInstance.sol.gcov.html
rename to report/instances/PoolInstance.sol.gcov.html
index a90e1377..1a6d65d6 100644
--- a/report/core/instances/src/core/instances/PoolInstance.sol.gcov.html
+++ b/report/instances/PoolInstance.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/instances/src/core/instances/PoolInstance.sol
-
+ LCOV - lcov.info.p - instances/PoolInstance.sol
+
LCOV - code coverage report |
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
@@ -72,12 +72,12 @@
1 : : // SPDX-License-Identifier: MIT
2 : : pragma solidity ^0.8.0;
3 : :
- 4 : : import {Pool} from '../contracts/protocol/pool/Pool.sol';
- 5 : : import {IPoolAddressesProvider} from '../contracts/interfaces/IPoolAddressesProvider.sol';
- 6 : : import {Errors} from '../contracts/protocol/libraries/helpers/Errors.sol';
+ 4 : : import {Pool} from '../protocol/pool/Pool.sol';
+ 5 : : import {IPoolAddressesProvider} from '../interfaces/IPoolAddressesProvider.sol';
+ 6 : : import {Errors} from '../protocol/libraries/helpers/Errors.sol';
7 : :
8 : : contract PoolInstance is Pool {
- 9 : : uint256 public constant POOL_REVISION = 4;
+ 9 : : uint256 public constant POOL_REVISION = 5;
10 : :
11 : : constructor(IPoolAddressesProvider provider) Pool(provider) {}
12 : :
@@ -88,15 +88,14 @@
17 : : * @dev Caching the address of the PoolAddressesProvider in order to reduce gas consumption on subsequent operations
18 : : * @param provider The address of the PoolAddressesProvider
19 : : */
- 20 : 1238 : function initialize(IPoolAddressesProvider provider) external virtual override initializer {
- 21 : 2476 : require(provider == ADDRESSES_PROVIDER, Errors.INVALID_ADDRESSES_PROVIDER);
- 22 : 2472 : _maxStableRateBorrowSizePercent = 0.25e4;
- 23 : : }
- 24 : :
- 25 : 1238 : function getRevision() internal pure virtual override returns (uint256) {
- 26 : 2476 : return POOL_REVISION;
- 27 : : }
- 28 : : }
+ 20 : : function initialize(IPoolAddressesProvider provider) external virtual override initializer {
+ 21 : 1395 : require(provider == ADDRESSES_PROVIDER, Errors.INVALID_ADDRESSES_PROVIDER);
+ 22 : : }
+ 23 : :
+ 24 : : function getRevision() internal pure virtual override returns (uint256) {
+ 25 : 1395 : return POOL_REVISION;
+ 26 : : }
+ 27 : : }
@@ -104,8 +103,8 @@
diff --git a/report/instances/VariableDebtTokenInstance.sol.func-c.html b/report/instances/VariableDebtTokenInstance.sol.func-c.html
new file mode 100644
index 00000000..ea596034
--- /dev/null
+++ b/report/instances/VariableDebtTokenInstance.sol.func-c.html
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - instances/VariableDebtTokenInstance.sol - functions
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../glass.png) |
+
+ |
+
+
+ ![](../glass.png) |
+
+
+
+
+
+
+
+
+
+
+
diff --git a/report/instances/VariableDebtTokenInstance.sol.func.html b/report/instances/VariableDebtTokenInstance.sol.func.html
new file mode 100644
index 00000000..d228d81b
--- /dev/null
+++ b/report/instances/VariableDebtTokenInstance.sol.func.html
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - instances/VariableDebtTokenInstance.sol - functions
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../glass.png) |
+
+ |
+
+
+ ![](../glass.png) |
+
+
+
+
+
+
+
+
+
+
+
diff --git a/report/core/instances/src/core/instances/VariableDebtTokenInstance.sol.gcov.html b/report/instances/VariableDebtTokenInstance.sol.gcov.html
similarity index 76%
rename from report/core/instances/src/core/instances/VariableDebtTokenInstance.sol.gcov.html
rename to report/instances/VariableDebtTokenInstance.sol.gcov.html
index 8445d25a..2a2860c8 100644
--- a/report/core/instances/src/core/instances/VariableDebtTokenInstance.sol.gcov.html
+++ b/report/instances/VariableDebtTokenInstance.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/instances/src/core/instances/VariableDebtTokenInstance.sol
-
+ LCOV - lcov.info.p - instances/VariableDebtTokenInstance.sol
+
LCOV - code coverage report |
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
+
+
-
-
+
|
-
-
-
+
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
@@ -72,7 +72,7 @@
1 : : // SPDX-License-Identifier: MIT
2 : : pragma solidity ^0.8.0;
3 : :
- 4 : : import {VariableDebtToken, IPool, IInitializableDebtToken, VersionedInitializable, IAaveIncentivesController, Errors} from '../contracts/protocol/tokenization/VariableDebtToken.sol';
+ 4 : : import {VariableDebtToken, IPool, IInitializableDebtToken, VersionedInitializable, IAaveIncentivesController, Errors} from '../protocol/tokenization/VariableDebtToken.sol';
5 : :
6 : : contract VariableDebtTokenInstance is VariableDebtToken {
7 : : uint256 public constant DEBT_TOKEN_REVISION = 1;
@@ -80,12 +80,12 @@
9 : : constructor(IPool pool) VariableDebtToken(pool) {}
10 : :
11 : : /// @inheritdoc VersionedInitializable
- 12 : 0 : function getRevision() internal pure virtual override returns (uint256) {
- 13 : 0 : return DEBT_TOKEN_REVISION;
+ 12 : : function getRevision() internal pure virtual override returns (uint256) {
+ 13 : 174696 : return DEBT_TOKEN_REVISION;
14 : : }
15 : :
16 : : /// @inheritdoc IInitializableDebtToken
- 17 : 3478 : function initialize(
+ 17 : : function initialize(
18 : : IPool initializingPool,
19 : : address underlyingAsset,
20 : : IAaveIncentivesController incentivesController,
@@ -94,17 +94,17 @@
23 : : string memory debtTokenSymbol,
24 : : bytes calldata params
25 : : ) external override initializer {
- 26 : 6954 : require(initializingPool == POOL, Errors.POOL_ADDRESSES_DO_NOT_MATCH);
- 27 : 6952 : _setName(debtTokenName);
- 28 : 6952 : _setSymbol(debtTokenSymbol);
- 29 : 6952 : _setDecimals(debtTokenDecimals);
+ 26 : 173697 : require(initializingPool == POOL, Errors.POOL_ADDRESSES_DO_NOT_MATCH);
+ 27 : 172697 : _setName(debtTokenName);
+ 28 : 172697 : _setSymbol(debtTokenSymbol);
+ 29 : 172697 : _setDecimals(debtTokenDecimals);
30 : :
- 31 : 6952 : _underlyingAsset = underlyingAsset;
- 32 : 6952 : _incentivesController = incentivesController;
+ 31 : 172697 : _underlyingAsset = underlyingAsset;
+ 32 : 172697 : _incentivesController = incentivesController;
33 : :
- 34 : 6952 : _domainSeparator = _calculateDomainSeparator();
+ 34 : 172697 : _domainSeparator = _calculateDomainSeparator();
35 : :
- 36 : 6952 : emit Initialized(
+ 36 : 172697 : emit Initialized(
37 : : underlyingAsset,
38 : : address(POOL),
39 : : address(incentivesController),
@@ -122,8 +122,8 @@
diff --git a/report/core/instances/src/core/instances/index-sort-b.html b/report/instances/index-sort-b.html
similarity index 58%
rename from report/core/instances/src/core/instances/index-sort-b.html
rename to report/instances/index-sort-b.html
index 028d3cdd..c211fc71 100644
--- a/report/core/instances/src/core/instances/index-sort-b.html
+++ b/report/instances/index-sort-b.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/instances/src/core/instances
-
+ LCOV - lcov.info.p - instances
+
LCOV - code coverage report |
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../glass.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../glass.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../updown.png) |
Rate |
@@ -96,9 +96,9 @@
Hit |
- ATokenInstance.sol |
+ ATokenInstance.sol |
-
+
|
100.0 % |
10 |
@@ -107,13 +107,13 @@
|
|
100.0 % |
- 2 |
- 2 |
+ 3 |
+ 3 |
- PoolConfiguratorInstance.sol |
+ PoolConfiguratorInstance.sol |
-
+
|
100.0 % |
3 |
@@ -126,57 +126,42 @@
2 |
- PoolInstance.sol |
+ PoolInstance.sol |
-
+
|
100.0 % |
- 3 |
- 3 |
- - |
- |
- |
- 100.0 % |
2 |
2 |
-
-
- StableDebtTokenInstance.sol |
-
-
- |
- 88.9 % |
- 9 |
- 8 |
- |
|
|
- 50.0 % |
- 2 |
- 1 |
+ 100.0 % |
+ 3 |
+ 3 |
- VariableDebtTokenInstance.sol |
+ VariableDebtTokenInstance.sol |
-
+
|
- 88.9 % |
+ 100.0 % |
+ 9 |
9 |
- 8 |
- |
|
|
- 50.0 % |
- 2 |
- 1 |
+ 100.0 % |
+ 3 |
+ 3 |
diff --git a/report/core/instances/src/core/instances/index-sort-f.html b/report/instances/index-sort-f.html
similarity index 58%
rename from report/core/instances/src/core/instances/index-sort-f.html
rename to report/instances/index-sort-f.html
index ac8828b3..bdf13aeb 100644
--- a/report/core/instances/src/core/instances/index-sort-f.html
+++ b/report/instances/index-sort-f.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/instances/src/core/instances
-
+ LCOV - lcov.info.p - instances
+
LCOV - code coverage report |
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../glass.png) |
+ File ![Click to sort table by file name Sort by file name](../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../glass.png) |
Rate |
@@ -96,39 +96,24 @@
Hit |
- StableDebtTokenInstance.sol |
+ PoolConfiguratorInstance.sol |
-
+
|
- 88.9 % |
- 9 |
- 8 |
+ 100.0 % |
+ 3 |
+ 3 |
- |
|
|
- 50.0 % |
+ 100.0 % |
2 |
- 1 |
-
-
- VariableDebtTokenInstance.sol |
-
-
- |
- 88.9 % |
- 9 |
- 8 |
- - |
- |
- |
- 50.0 % |
2 |
- 1 |
- ATokenInstance.sol |
+ ATokenInstance.sol |
-
+
|
100.0 % |
10 |
@@ -137,46 +122,46 @@
|
|
100.0 % |
- 2 |
- 2 |
+ 3 |
+ 3 |
- PoolConfiguratorInstance.sol |
+ PoolInstance.sol |
-
+
|
100.0 % |
- 3 |
- 3 |
+ 2 |
+ 2 |
- |
|
|
100.0 % |
- 2 |
- 2 |
+ 3 |
+ 3 |
- PoolInstance.sol |
+ VariableDebtTokenInstance.sol |
-
+
|
100.0 % |
- 3 |
- 3 |
+ 9 |
+ 9 |
- |
|
|
100.0 % |
- 2 |
- 2 |
+ 3 |
+ 3 |
diff --git a/report/core/instances/src/core/instances/index-sort-l.html b/report/instances/index-sort-l.html
similarity index 58%
rename from report/core/instances/src/core/instances/index-sort-l.html
rename to report/instances/index-sort-l.html
index 4cf73f34..9da9aab6 100644
--- a/report/core/instances/src/core/instances/index-sort-l.html
+++ b/report/instances/index-sort-l.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/instances/src/core/instances
-
+ LCOV - lcov.info.p - instances
+
LCOV - code coverage report |
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../glass.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../glass.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../updown.png) |
Rate |
@@ -96,39 +96,24 @@
Hit |
- StableDebtTokenInstance.sol |
+ PoolInstance.sol |
-
+
|
- 88.9 % |
- 9 |
- 8 |
- - |
- |
- |
- 50.0 % |
+ 100.0 % |
+ 2 |
2 |
- 1 |
-
-
- VariableDebtTokenInstance.sol |
-
-
- |
- 88.9 % |
- 9 |
- 8 |
- |
|
|
- 50.0 % |
- 2 |
- 1 |
+ 100.0 % |
+ 3 |
+ 3 |
- PoolConfiguratorInstance.sol |
+ PoolConfiguratorInstance.sol |
-
+
|
100.0 % |
3 |
@@ -141,24 +126,24 @@
2 |
- PoolInstance.sol |
+ VariableDebtTokenInstance.sol |
-
+
|
100.0 % |
- 3 |
- 3 |
+ 9 |
+ 9 |
- |
|
|
100.0 % |
- 2 |
- 2 |
+ 3 |
+ 3 |
- ATokenInstance.sol |
+ ATokenInstance.sol |
-
+
|
100.0 % |
10 |
@@ -167,16 +152,16 @@
|
|
100.0 % |
- 2 |
- 2 |
+ 3 |
+ 3 |
diff --git a/report/core/instances/src/core/instances/index.html b/report/instances/index.html
similarity index 58%
rename from report/core/instances/src/core/instances/index.html
rename to report/instances/index.html
index 71308d47..cc65427a 100644
--- a/report/core/instances/src/core/instances/index.html
+++ b/report/instances/index.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/instances/src/core/instances
-
+ LCOV - lcov.info.p - instances
+
LCOV - code coverage report |
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../glass.png) |
+ ![](../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../glass.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../glass.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../updown.png) |
Rate |
@@ -96,9 +96,9 @@
Hit |
- ATokenInstance.sol |
+ ATokenInstance.sol |
-
+
|
100.0 % |
10 |
@@ -107,13 +107,13 @@
|
|
100.0 % |
- 2 |
- 2 |
+ 3 |
+ 3 |
- PoolConfiguratorInstance.sol |
+ PoolConfiguratorInstance.sol |
-
+
|
100.0 % |
3 |
@@ -126,57 +126,42 @@
2 |
- PoolInstance.sol |
+ PoolInstance.sol |
-
+
|
100.0 % |
- 3 |
- 3 |
- - |
- |
- |
- 100.0 % |
2 |
2 |
-
-
- StableDebtTokenInstance.sol |
-
-
- |
- 88.9 % |
- 9 |
- 8 |
- |
|
|
- 50.0 % |
- 2 |
- 1 |
+ 100.0 % |
+ 3 |
+ 3 |
- VariableDebtTokenInstance.sol |
+ VariableDebtTokenInstance.sol |
-
+
|
- 88.9 % |
+ 100.0 % |
+ 9 |
9 |
- 8 |
- |
|
|
- 50.0 % |
- 2 |
- 1 |
+ 100.0 % |
+ 3 |
+ 3 |
diff --git a/report/core/contracts/misc/src/core/contracts/misc/AaveOracle.sol.func-c.html b/report/misc/AaveOracle.sol.func-c.html
similarity index 65%
rename from report/core/contracts/misc/src/core/contracts/misc/AaveOracle.sol.func-c.html
rename to report/misc/AaveOracle.sol.func-c.html
index 05b9424a..45980202 100644
--- a/report/core/contracts/misc/src/core/contracts/misc/AaveOracle.sol.func-c.html
+++ b/report/misc/AaveOracle.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/misc/src/core/contracts/misc/AaveOracle.sol - functions
-
+ LCOV - lcov.info.p - misc/AaveOracle.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,21 +53,28 @@
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../glass.png) |
+
+
+
+
+ AaveOracle. |
+
+ 0 |
@@ -91,6 +98,13 @@
4 |
+
+
+ AaveOracle.onlyAssetListingOrPoolAdmins |
+
+ 4 |
+
+
AaveOracle.setFallbackOracle |
@@ -102,35 +116,35 @@
AaveOracle._setAssetsSources |
- 590 |
+ 659 |
AaveOracle.setAssetSources |
- 591 |
+ 660 |
AaveOracle._onlyAssetListingOrPoolAdmins |
- 595 |
+ 664 |
AaveOracle.getSourceOfAsset |
- 3030 |
+ 4115 |
AaveOracle.getAssetPrice |
- 69942 |
+ 111429 |
@@ -138,8 +152,8 @@
diff --git a/report/core/contracts/misc/src/core/contracts/misc/AaveOracle.sol.func.html b/report/misc/AaveOracle.sol.func.html
similarity index 65%
rename from report/core/contracts/misc/src/core/contracts/misc/AaveOracle.sol.func.html
rename to report/misc/AaveOracle.sol.func.html
index ac9e07c2..c7bd647e 100644
--- a/report/core/contracts/misc/src/core/contracts/misc/AaveOracle.sol.func.html
+++ b/report/misc/AaveOracle.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/misc/src/core/contracts/misc/AaveOracle.sol - functions
-
+ LCOV - lcov.info.p - misc/AaveOracle.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,35 +53,42 @@
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../updown.png) |
+
+
+
+
+ AaveOracle. |
+
+ 0 |
AaveOracle._onlyAssetListingOrPoolAdmins |
- 595 |
+ 664 |
AaveOracle._setAssetsSources |
- 590 |
+ 659 |
@@ -95,7 +102,7 @@
AaveOracle.getAssetPrice |
- 69942 |
+ 111429 |
@@ -116,14 +123,21 @@
AaveOracle.getSourceOfAsset |
- 3030 |
+ 4115 |
+
+
+
+
+ AaveOracle.onlyAssetListingOrPoolAdmins |
+
+ 4 |
AaveOracle.setAssetSources |
- 591 |
+ 660 |
@@ -138,8 +152,8 @@
diff --git a/report/core/contracts/misc/src/core/contracts/misc/AaveOracle.sol.gcov.html b/report/misc/AaveOracle.sol.gcov.html
similarity index 80%
rename from report/core/contracts/misc/src/core/contracts/misc/AaveOracle.sol.gcov.html
rename to report/misc/AaveOracle.sol.gcov.html
index a334d9fd..e3d70004 100644
--- a/report/core/contracts/misc/src/core/contracts/misc/AaveOracle.sol.gcov.html
+++ b/report/misc/AaveOracle.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/misc/src/core/contracts/misc/AaveOracle.sol
-
+ LCOV - lcov.info.p - misc/AaveOracle.sol
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
@@ -101,7 +101,7 @@
30 : : * @dev Only asset listing or pool admin can call functions marked by this modifier.
31 : : */
32 : : modifier onlyAssetListingOrPoolAdmins() {
- 33 : : _onlyAssetListingOrPoolAdmins();
+ 33 : 4 : _onlyAssetListingOrPoolAdmins();
34 : : _;
35 : : }
36 : :
@@ -123,27 +123,27 @@
52 : : address baseCurrency,
53 : : uint256 baseCurrencyUnit
54 : : ) {
- 55 : : ADDRESSES_PROVIDER = provider;
- 56 : : _setFallbackOracle(fallbackOracle);
- 57 : : _setAssetsSources(assets, sources);
- 58 : : BASE_CURRENCY = baseCurrency;
- 59 : : BASE_CURRENCY_UNIT = baseCurrencyUnit;
- 60 : : emit BaseCurrencySet(baseCurrency, baseCurrencyUnit);
+ 55 : 0 : ADDRESSES_PROVIDER = provider;
+ 56 : 0 : _setFallbackOracle(fallbackOracle);
+ 57 : 0 : _setAssetsSources(assets, sources);
+ 58 : 0 : BASE_CURRENCY = baseCurrency;
+ 59 : 0 : BASE_CURRENCY_UNIT = baseCurrencyUnit;
+ 60 : 0 : emit BaseCurrencySet(baseCurrency, baseCurrencyUnit);
61 : : }
62 : :
63 : : /// @inheritdoc IAaveOracle
- 64 : 591 : function setAssetSources(
+ 64 : : function setAssetSources(
65 : : address[] calldata assets,
66 : : address[] calldata sources
67 : : ) external override onlyAssetListingOrPoolAdmins {
- 68 : 1180 : _setAssetsSources(assets, sources);
+ 68 : 659 : _setAssetsSources(assets, sources);
69 : : }
70 : :
71 : : /// @inheritdoc IAaveOracle
- 72 : 4 : function setFallbackOracle(
+ 72 : : function setFallbackOracle(
73 : : address fallbackOracle
74 : : ) external override onlyAssetListingOrPoolAdmins {
- 75 : 8 : _setFallbackOracle(fallbackOracle);
+ 75 : 4 : _setFallbackOracle(fallbackOracle);
76 : : }
77 : :
78 : : /**
@@ -151,11 +151,11 @@
80 : : * @param assets The addresses of the assets
81 : : * @param sources The address of the source of each asset
82 : : */
- 83 : 590 : function _setAssetsSources(address[] memory assets, address[] memory sources) internal {
- 84 : 1180 : require(assets.length == sources.length, Errors.INCONSISTENT_PARAMS_LENGTH);
- 85 : 5273 : for (uint256 i = 0; i < assets.length; i++) {
- 86 : 3506 : assetsSources[assets[i]] = AggregatorInterface(sources[i]);
- 87 : 3506 : emit AssetSourceUpdated(assets[i], sources[i]);
+ 83 : : function _setAssetsSources(address[] memory assets, address[] memory sources) internal {
+ 84 : 659 : require(assets.length == sources.length, Errors.INCONSISTENT_PARAMS_LENGTH);
+ 85 : 658 : for (uint256 i = 0; i < assets.length; i++) {
+ 86 : 1954 : assetsSources[assets[i]] = AggregatorInterface(sources[i]);
+ 87 : 1954 : emit AssetSourceUpdated(assets[i], sources[i]);
88 : : }
89 : : }
90 : :
@@ -163,53 +163,53 @@
92 : : * @notice Internal function to set the fallback oracle
93 : : * @param fallbackOracle The address of the fallback oracle
94 : : */
- 95 : 4 : function _setFallbackOracle(address fallbackOracle) internal {
- 96 : 8 : _fallbackOracle = IPriceOracleGetter(fallbackOracle);
- 97 : 8 : emit FallbackOracleUpdated(fallbackOracle);
+ 95 : : function _setFallbackOracle(address fallbackOracle) internal {
+ 96 : 4 : _fallbackOracle = IPriceOracleGetter(fallbackOracle);
+ 97 : 4 : emit FallbackOracleUpdated(fallbackOracle);
98 : : }
99 : :
100 : : /// @inheritdoc IPriceOracleGetter
- 101 : 69942 : function getAssetPrice(address asset) public view override returns (uint256) {
- 102 : 139890 : AggregatorInterface source = assetsSources[asset];
+ 101 : : function getAssetPrice(address asset) public view override returns (uint256) {
+ 102 : 111432 : AggregatorInterface source = assetsSources[asset];
103 : :
- 104 : 139890 : if (asset == BASE_CURRENCY) {
- 105 : 4 : return BASE_CURRENCY_UNIT;
- 106 : 279772 : } else if (address(source) == address(0)) {
- 107 : 9 : return _fallbackOracle.getAssetPrice(asset);
+ 104 : 111432 : if (asset == BASE_CURRENCY) {
+ 105 : 2 : return BASE_CURRENCY_UNIT;
+ 106 : 111430 : } else if (address(source) == address(0)) {
+ 107 : 3 : return _fallbackOracle.getAssetPrice(asset);
108 : : } else {
- 109 : 209820 : int256 price = source.latestAnswer();
- 110 : 139880 : if (price > 0) {
- 111 : 209811 : return uint256(price);
+ 109 : 111427 : int256 price = source.latestAnswer();
+ 110 : 111427 : if (price > 0) {
+ 111 : 111424 : return uint256(price);
112 : : } else {
- 113 : 9 : return _fallbackOracle.getAssetPrice(asset);
+ 113 : 3 : return _fallbackOracle.getAssetPrice(asset);
114 : : }
115 : : }
116 : : }
117 : :
118 : : /// @inheritdoc IAaveOracle
- 119 : 3 : function getAssetsPrices(
+ 119 : : function getAssetsPrices(
120 : : address[] calldata assets
121 : : ) external view override returns (uint256[] memory) {
- 122 : 9 : uint256[] memory prices = new uint256[](assets.length);
- 123 : 13 : for (uint256 i = 0; i < assets.length; i++) {
- 124 : 6 : prices[i] = getAssetPrice(assets[i]);
+ 122 : 3 : uint256[] memory prices = new uint256[](assets.length);
+ 123 : 3 : for (uint256 i = 0; i < assets.length; i++) {
+ 124 : 3 : prices[i] = getAssetPrice(assets[i]);
125 : : }
- 126 : 4 : return prices;
+ 126 : 2 : return prices;
127 : : }
128 : :
129 : : /// @inheritdoc IAaveOracle
- 130 : 3030 : function getSourceOfAsset(address asset) external view override returns (address) {
- 131 : 9090 : return address(assetsSources[asset]);
+ 130 : : function getSourceOfAsset(address asset) external view override returns (address) {
+ 131 : 4115 : return address(assetsSources[asset]);
132 : : }
133 : :
134 : : /// @inheritdoc IAaveOracle
- 135 : 3 : function getFallbackOracle() external view returns (address) {
- 136 : 9 : return address(_fallbackOracle);
+ 135 : : function getFallbackOracle() external view returns (address) {
+ 136 : 3 : return address(_fallbackOracle);
137 : : }
138 : :
- 139 : 595 : function _onlyAssetListingOrPoolAdmins() internal view {
- 140 : 1785 : IACLManager aclManager = IACLManager(ADDRESSES_PROVIDER.getACLManager());
- 141 : 1190 : require(
+ 139 : : function _onlyAssetListingOrPoolAdmins() internal view {
+ 140 : 664 : IACLManager aclManager = IACLManager(ADDRESSES_PROVIDER.getACLManager());
+ 141 : 664 : require(
142 : : aclManager.isAssetListingAdmin(msg.sender) || aclManager.isPoolAdmin(msg.sender),
143 : : Errors.CALLER_NOT_ASSET_LISTING_OR_POOL_ADMIN
144 : : );
@@ -222,8 +222,8 @@
diff --git a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/DefaultReserveInterestRateStrategyV2.sol.func-c.html b/report/misc/DefaultReserveInterestRateStrategyV2.sol.func-c.html
similarity index 64%
rename from report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/DefaultReserveInterestRateStrategyV2.sol.func-c.html
rename to report/misc/DefaultReserveInterestRateStrategyV2.sol.func-c.html
index 529f1d46..3c30b0e5 100644
--- a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/DefaultReserveInterestRateStrategyV2.sol.func-c.html
+++ b/report/misc/DefaultReserveInterestRateStrategyV2.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/pool/src/core/contracts/protocol/pool/DefaultReserveInterestRateStrategyV2.sol - functions
-
+ LCOV - lcov.info.p - misc/DefaultReserveInterestRateStrategyV2.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,112 +53,119 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../glass.png) |
- DefaultReserveInterestRateStrategyV2.getInterestRateData |
+ DefaultReserveInterestRateStrategyV2. |
+
+ 242 |
+
+
+
+
+ DefaultReserveInterestRateStrategyV2.getInterestRateData |
1000 |
- DefaultReserveInterestRateStrategyV2.getInterestRateDataBps |
+ DefaultReserveInterestRateStrategyV2.getInterestRateDataBps |
1000 |
- DefaultReserveInterestRateStrategyV2.getMaxVariableBorrowRate |
+ DefaultReserveInterestRateStrategyV2.getMaxVariableBorrowRate |
- 3002 |
+ 5084 |
- DefaultReserveInterestRateStrategyV2.getVariableRateSlope2 |
+ DefaultReserveInterestRateStrategyV2.getVariableRateSlope2 |
- 3004 |
+ 5088 |
- DefaultReserveInterestRateStrategyV2.getOptimalUsageRatio |
+ DefaultReserveInterestRateStrategyV2.getOptimalUsageRatio |
- 6003 |
+ 8088 |
- DefaultReserveInterestRateStrategyV2.getVariableRateSlope1 |
+ DefaultReserveInterestRateStrategyV2.getVariableRateSlope1 |
- 6008 |
+ 8092 |
- DefaultReserveInterestRateStrategyV2.getBaseVariableBorrowRate |
+ DefaultReserveInterestRateStrategyV2.getBaseVariableBorrowRate |
- 9008 |
+ 11092 |
- DefaultReserveInterestRateStrategyV2._getOverallBorrowRate |
+ DefaultReserveInterestRateStrategyV2.calculateInterestRates |
- 23756 |
+ 92717 |
- DefaultReserveInterestRateStrategyV2._setInterestRateParams |
+ DefaultReserveInterestRateStrategyV2._rayifyRateData |
- 23891 |
+ 93717 |
- DefaultReserveInterestRateStrategyV2.setInterestRateParams |
+ DefaultReserveInterestRateStrategyV2.onlyPoolConfigurator |
- 25891 |
+ 190067 |
- DefaultReserveInterestRateStrategyV2.calculateInterestRates |
+ DefaultReserveInterestRateStrategyV2._setInterestRateParams |
- 49547 |
+ 198067 |
- DefaultReserveInterestRateStrategyV2._rayifyRateData |
+ DefaultReserveInterestRateStrategyV2.setInterestRateParams |
- 50547 |
+ 201067 |
- DefaultReserveInterestRateStrategyV2._bpsToRay |
+ DefaultReserveInterestRateStrategyV2._bpsToRay |
- 229213 |
+ 412312 |
@@ -166,8 +173,8 @@
diff --git a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/DefaultReserveInterestRateStrategyV2.sol.func.html b/report/misc/DefaultReserveInterestRateStrategyV2.sol.func.html
similarity index 64%
rename from report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/DefaultReserveInterestRateStrategyV2.sol.func.html
rename to report/misc/DefaultReserveInterestRateStrategyV2.sol.func.html
index 7c05a933..c58484f3 100644
--- a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/DefaultReserveInterestRateStrategyV2.sol.func.html
+++ b/report/misc/DefaultReserveInterestRateStrategyV2.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/pool/src/core/contracts/protocol/pool/DefaultReserveInterestRateStrategyV2.sol - functions
-
+ LCOV - lcov.info.p - misc/DefaultReserveInterestRateStrategyV2.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,112 +53,119 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../updown.png) |
- DefaultReserveInterestRateStrategyV2._bpsToRay |
+ DefaultReserveInterestRateStrategyV2. |
- 229213 |
+ 242 |
- DefaultReserveInterestRateStrategyV2._getOverallBorrowRate |
+ DefaultReserveInterestRateStrategyV2._bpsToRay |
- 23756 |
+ 412312 |
- DefaultReserveInterestRateStrategyV2._rayifyRateData |
+ DefaultReserveInterestRateStrategyV2._rayifyRateData |
- 50547 |
+ 93717 |
- DefaultReserveInterestRateStrategyV2._setInterestRateParams |
+ DefaultReserveInterestRateStrategyV2._setInterestRateParams |
- 23891 |
+ 198067 |
- DefaultReserveInterestRateStrategyV2.calculateInterestRates |
+ DefaultReserveInterestRateStrategyV2.calculateInterestRates |
- 49547 |
+ 92717 |
- DefaultReserveInterestRateStrategyV2.getBaseVariableBorrowRate |
+ DefaultReserveInterestRateStrategyV2.getBaseVariableBorrowRate |
- 9008 |
+ 11092 |
- DefaultReserveInterestRateStrategyV2.getInterestRateData |
+ DefaultReserveInterestRateStrategyV2.getInterestRateData |
1000 |
- DefaultReserveInterestRateStrategyV2.getInterestRateDataBps |
+ DefaultReserveInterestRateStrategyV2.getInterestRateDataBps |
1000 |
- DefaultReserveInterestRateStrategyV2.getMaxVariableBorrowRate |
+ DefaultReserveInterestRateStrategyV2.getMaxVariableBorrowRate |
- 3002 |
+ 5084 |
- DefaultReserveInterestRateStrategyV2.getOptimalUsageRatio |
+ DefaultReserveInterestRateStrategyV2.getOptimalUsageRatio |
- 6003 |
+ 8088 |
- DefaultReserveInterestRateStrategyV2.getVariableRateSlope1 |
+ DefaultReserveInterestRateStrategyV2.getVariableRateSlope1 |
- 6008 |
+ 8092 |
- DefaultReserveInterestRateStrategyV2.getVariableRateSlope2 |
+ DefaultReserveInterestRateStrategyV2.getVariableRateSlope2 |
- 3004 |
+ 5088 |
- DefaultReserveInterestRateStrategyV2.setInterestRateParams |
+ DefaultReserveInterestRateStrategyV2.onlyPoolConfigurator |
- 25891 |
+ 190067 |
+
+
+
+
+ DefaultReserveInterestRateStrategyV2.setInterestRateParams |
+
+ 201067 |
@@ -166,8 +173,8 @@
diff --git a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/DefaultReserveInterestRateStrategyV2.sol.gcov.html b/report/misc/DefaultReserveInterestRateStrategyV2.sol.gcov.html
similarity index 70%
rename from report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/DefaultReserveInterestRateStrategyV2.sol.gcov.html
rename to report/misc/DefaultReserveInterestRateStrategyV2.sol.gcov.html
index 4e879f02..b12fad4c 100644
--- a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/DefaultReserveInterestRateStrategyV2.sol.gcov.html
+++ b/report/misc/DefaultReserveInterestRateStrategyV2.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/pool/src/core/contracts/protocol/pool/DefaultReserveInterestRateStrategyV2.sol
-
+ LCOV - lcov.info.p - misc/DefaultReserveInterestRateStrategyV2.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../glass.png) |
@@ -72,14 +72,14 @@
1 : : // SPDX-License-Identifier: MIT
2 : : pragma solidity ^0.8.0;
3 : :
- 4 : : import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
- 5 : : import {WadRayMath} from '../libraries/math/WadRayMath.sol';
- 6 : : import {PercentageMath} from '../libraries/math/PercentageMath.sol';
- 7 : : import {DataTypes} from '../libraries/types/DataTypes.sol';
- 8 : : import {Errors} from '../libraries/helpers/Errors.sol';
- 9 : : import {IDefaultInterestRateStrategyV2} from '../../interfaces/IDefaultInterestRateStrategyV2.sol';
- 10 : : import {IReserveInterestRateStrategy} from '../../interfaces/IReserveInterestRateStrategy.sol';
- 11 : : import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
+ 4 : : import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.sol';
+ 5 : : import {WadRayMath} from '../protocol/libraries/math/WadRayMath.sol';
+ 6 : : import {PercentageMath} from '../protocol/libraries/math/PercentageMath.sol';
+ 7 : : import {DataTypes} from '../protocol/libraries/types/DataTypes.sol';
+ 8 : : import {Errors} from '../protocol/libraries/helpers/Errors.sol';
+ 9 : : import {IDefaultInterestRateStrategyV2} from '../interfaces/IDefaultInterestRateStrategyV2.sol';
+ 10 : : import {IReserveInterestRateStrategy} from '../interfaces/IReserveInterestRateStrategy.sol';
+ 11 : : import {IPoolAddressesProvider} from '../interfaces/IPoolAddressesProvider.sol';
12 : :
13 : : /**
14 : : * @title DefaultReserveInterestRateStrategyV2 contract
@@ -93,247 +93,223 @@
22 : : using WadRayMath for uint256;
23 : : using PercentageMath for uint256;
24 : :
- 25 : : /// @inheritdoc IDefaultInterestRateStrategyV2
- 26 : : IPoolAddressesProvider public immutable ADDRESSES_PROVIDER;
- 27 : :
- 28 : : /// @inheritdoc IDefaultInterestRateStrategyV2
- 29 : : uint256 public constant MAX_BORROW_RATE = 1000_00;
- 30 : :
- 31 : : /// @inheritdoc IDefaultInterestRateStrategyV2
- 32 : : uint256 public constant MIN_OPTIMAL_POINT = 1_00;
+ 25 : : struct CalcInterestRatesLocalVars {
+ 26 : : uint256 availableLiquidity;
+ 27 : : uint256 currentVariableBorrowRate;
+ 28 : : uint256 currentLiquidityRate;
+ 29 : : uint256 borrowUsageRatio;
+ 30 : : uint256 supplyUsageRatio;
+ 31 : : uint256 availableLiquidityPlusDebt;
+ 32 : : }
33 : :
34 : : /// @inheritdoc IDefaultInterestRateStrategyV2
- 35 : : uint256 public constant MAX_OPTIMAL_POINT = 99_00;
+ 35 : : IPoolAddressesProvider public immutable ADDRESSES_PROVIDER;
36 : :
- 37 : : /// @dev Underlying asset listed on the Aave pool => rate data
- 38 : : mapping(address reserve => InterestRateData) internal _interestRateData;
+ 37 : : /// @inheritdoc IDefaultInterestRateStrategyV2
+ 38 : : uint256 public constant MAX_BORROW_RATE = 1000_00;
39 : :
- 40 : : /**
- 41 : : * @param provider The address of the PoolAddressesProvider of the associated Aave pool
- 42 : : */
- 43 : : constructor(address provider) {
- 44 : : require(provider != address(0), Errors.INVALID_ADDRESSES_PROVIDER);
- 45 : : ADDRESSES_PROVIDER = IPoolAddressesProvider(provider);
- 46 : : }
- 47 : :
- 48 : : modifier onlyPoolConfigurator() {
- 49 : : require(
- 50 : : msg.sender == ADDRESSES_PROVIDER.getPoolConfigurator(),
- 51 : : Errors.CALLER_NOT_POOL_CONFIGURATOR
- 52 : : );
- 53 : : _;
- 54 : : }
- 55 : :
- 56 : : /// @inheritdoc IReserveInterestRateStrategy
- 57 : 25891 : function setInterestRateParams(
- 58 : : address reserve,
- 59 : : bytes calldata rateData
- 60 : : ) external onlyPoolConfigurator {
- 61 : 37782 : _setInterestRateParams(reserve, abi.decode(rateData, (InterestRateData)));
- 62 : : }
- 63 : :
- 64 : : /// @inheritdoc IDefaultInterestRateStrategyV2
- 65 : : function setInterestRateParams(
- 66 : : address reserve,
- 67 : : InterestRateData calldata rateData
- 68 : : ) external onlyPoolConfigurator {
- 69 : 10000 : _setInterestRateParams(reserve, rateData);
- 70 : : }
- 71 : :
- 72 : : /// @inheritdoc IDefaultInterestRateStrategyV2
- 73 : 1000 : function getInterestRateData(address reserve) external view returns (InterestRateDataRay memory) {
- 74 : 3000 : return _rayifyRateData(_interestRateData[reserve]);
- 75 : : }
- 76 : :
- 77 : : /// @inheritdoc IDefaultInterestRateStrategyV2
- 78 : 1000 : function getInterestRateDataBps(address reserve) external view returns (InterestRateData memory) {
- 79 : 2000 : return _interestRateData[reserve];
+ 40 : : /// @inheritdoc IDefaultInterestRateStrategyV2
+ 41 : : uint256 public constant MIN_OPTIMAL_POINT = 1_00;
+ 42 : :
+ 43 : : /// @inheritdoc IDefaultInterestRateStrategyV2
+ 44 : : uint256 public constant MAX_OPTIMAL_POINT = 99_00;
+ 45 : :
+ 46 : : /// @dev Map of reserves address and their interest rate data (reserveAddress => interestRateData)
+ 47 : : mapping(address => InterestRateData) internal _interestRateData;
+ 48 : :
+ 49 : : modifier onlyPoolConfigurator() {
+ 50 : 190067 : require(
+ 51 : : msg.sender == ADDRESSES_PROVIDER.getPoolConfigurator(),
+ 52 : : Errors.CALLER_NOT_POOL_CONFIGURATOR
+ 53 : : );
+ 54 : : _;
+ 55 : : }
+ 56 : :
+ 57 : : /**
+ 58 : : * @dev Constructor.
+ 59 : : * @param provider The address of the PoolAddressesProvider of the associated Aave pool
+ 60 : : */
+ 61 : : constructor(address provider) {
+ 62 : 147 : require(provider != address(0), Errors.INVALID_ADDRESSES_PROVIDER);
+ 63 : 165 : ADDRESSES_PROVIDER = IPoolAddressesProvider(provider);
+ 64 : : }
+ 65 : :
+ 66 : : /// @inheritdoc IReserveInterestRateStrategy
+ 67 : : function setInterestRateParams(
+ 68 : : address reserve,
+ 69 : : bytes calldata rateData
+ 70 : : ) external onlyPoolConfigurator {
+ 71 : 188067 : _setInterestRateParams(reserve, abi.decode(rateData, (InterestRateData)));
+ 72 : : }
+ 73 : :
+ 74 : : /// @inheritdoc IDefaultInterestRateStrategyV2
+ 75 : : function setInterestRateParams(
+ 76 : : address reserve,
+ 77 : : InterestRateData calldata rateData
+ 78 : : ) external onlyPoolConfigurator {
+ 79 : 10000 : _setInterestRateParams(reserve, rateData);
80 : : }
81 : :
82 : : /// @inheritdoc IDefaultInterestRateStrategyV2
- 83 : 6003 : function getOptimalUsageRatio(address reserve) external view returns (uint256) {
- 84 : 18009 : return _bpsToRay(uint256(_interestRateData[reserve].optimalUsageRatio));
+ 83 : : function getInterestRateData(address reserve) external view returns (InterestRateDataRay memory) {
+ 84 : 1000 : return _rayifyRateData(_interestRateData[reserve]);
85 : : }
86 : :
87 : : /// @inheritdoc IDefaultInterestRateStrategyV2
- 88 : 6008 : function getVariableRateSlope1(address reserve) external view returns (uint256) {
- 89 : 18024 : return _bpsToRay(uint256(_interestRateData[reserve].variableRateSlope1));
+ 88 : : function getInterestRateDataBps(address reserve) external view returns (InterestRateData memory) {
+ 89 : 1000 : return _interestRateData[reserve];
90 : : }
91 : :
92 : : /// @inheritdoc IDefaultInterestRateStrategyV2
- 93 : 3004 : function getVariableRateSlope2(address reserve) external view returns (uint256) {
- 94 : 9012 : return _bpsToRay(uint256(_interestRateData[reserve].variableRateSlope2));
+ 93 : : function getOptimalUsageRatio(address reserve) external view returns (uint256) {
+ 94 : 8088 : return _bpsToRay(uint256(_interestRateData[reserve].optimalUsageRatio));
95 : : }
96 : :
97 : : /// @inheritdoc IDefaultInterestRateStrategyV2
- 98 : 9008 : function getBaseVariableBorrowRate(address reserve) external view override returns (uint256) {
- 99 : 27024 : return _bpsToRay(uint256(_interestRateData[reserve].baseVariableBorrowRate));
+ 98 : : function getVariableRateSlope1(address reserve) external view returns (uint256) {
+ 99 : 8092 : return _bpsToRay(uint256(_interestRateData[reserve].variableRateSlope1));
100 : : }
101 : :
102 : : /// @inheritdoc IDefaultInterestRateStrategyV2
- 103 : 3002 : function getMaxVariableBorrowRate(address reserve) external view override returns (uint256) {
- 104 : 6004 : return
- 105 : 6004 : _bpsToRay(
- 106 : : uint256(
- 107 : : _interestRateData[reserve].baseVariableBorrowRate +
- 108 : : _interestRateData[reserve].variableRateSlope1 +
- 109 : : _interestRateData[reserve].variableRateSlope2
- 110 : : )
- 111 : : );
- 112 : : }
- 113 : :
- 114 : : /// @inheritdoc IReserveInterestRateStrategy
- 115 : 49547 : function calculateInterestRates(
- 116 : : DataTypes.CalculateInterestRatesParams memory params
- 117 : : ) public view virtual override returns (uint256, uint256, uint256) {
- 118 : 148641 : InterestRateDataRay memory rateData = _rayifyRateData(_interestRateData[params.reserve]);
- 119 : :
- 120 : : // @note This is a short circuit to allow mintable assets, which by definition cannot be supplied
- 121 : : // and thus do not use virtual underlying balances.
- 122 : 99094 : if (!params.usingVirtualBalance) {
- 123 : 2000 : return (0, 0, rateData.baseVariableBorrowRate);
- 124 : : }
- 125 : :
- 126 : 97094 : CalcInterestRatesLocalVars memory vars;
- 127 : :
- 128 : 97094 : vars.totalDebt = params.totalStableDebt + params.totalVariableDebt;
+ 103 : : function getVariableRateSlope2(address reserve) external view returns (uint256) {
+ 104 : 5088 : return _bpsToRay(uint256(_interestRateData[reserve].variableRateSlope2));
+ 105 : : }
+ 106 : :
+ 107 : : /// @inheritdoc IDefaultInterestRateStrategyV2
+ 108 : : function getBaseVariableBorrowRate(address reserve) external view override returns (uint256) {
+ 109 : 11092 : return _bpsToRay(uint256(_interestRateData[reserve].baseVariableBorrowRate));
+ 110 : : }
+ 111 : :
+ 112 : : /// @inheritdoc IDefaultInterestRateStrategyV2
+ 113 : : function getMaxVariableBorrowRate(address reserve) external view override returns (uint256) {
+ 114 : 5084 : return
+ 115 : 5084 : _bpsToRay(
+ 116 : : uint256(
+ 117 : : _interestRateData[reserve].baseVariableBorrowRate +
+ 118 : : _interestRateData[reserve].variableRateSlope1 +
+ 119 : : _interestRateData[reserve].variableRateSlope2
+ 120 : : )
+ 121 : : );
+ 122 : : }
+ 123 : :
+ 124 : : /// @inheritdoc IReserveInterestRateStrategy
+ 125 : : function calculateInterestRates(
+ 126 : : DataTypes.CalculateInterestRatesParams memory params
+ 127 : : ) external view virtual override returns (uint256, uint256) {
+ 128 : 92717 : InterestRateDataRay memory rateData = _rayifyRateData(_interestRateData[params.reserve]);
129 : :
- 130 : 97094 : vars.currentLiquidityRate = 0;
- 131 : 97094 : vars.currentVariableBorrowRate = rateData.baseVariableBorrowRate;
- 132 : :
- 133 : 97094 : if (vars.totalDebt != 0) {
- 134 : 47514 : vars.availableLiquidity =
- 135 : : params.virtualUnderlyingBalance +
- 136 : : params.liquidityAdded -
- 137 : : params.liquidityTaken;
- 138 : :
- 139 : 47512 : vars.availableLiquidityPlusDebt = vars.availableLiquidity + vars.totalDebt;
- 140 : 47512 : vars.borrowUsageRatio = vars.totalDebt.rayDiv(vars.availableLiquidityPlusDebt);
- 141 : 47512 : vars.supplyUsageRatio = vars.totalDebt.rayDiv(
- 142 : : vars.availableLiquidityPlusDebt + params.unbacked
- 143 : : );
- 144 : : } else {
- 145 : 49580 : return (0, 0, vars.currentVariableBorrowRate);
- 146 : : }
- 147 : :
- 148 : 47512 : if (vars.borrowUsageRatio > rateData.optimalUsageRatio) {
- 149 : 12192 : uint256 excessBorrowUsageRatio = (vars.borrowUsageRatio - rateData.optimalUsageRatio).rayDiv(
- 150 : : WadRayMath.RAY - rateData.optimalUsageRatio
+ 130 : : // @note This is a short circuit to allow mintable assets (ex. GHO), which by definition cannot be supplied
+ 131 : : // and thus do not use virtual underlying balances.
+ 132 : 92717 : if (!params.usingVirtualBalance) {
+ 133 : 1000 : return (0, rateData.baseVariableBorrowRate);
+ 134 : : }
+ 135 : :
+ 136 : 91717 : CalcInterestRatesLocalVars memory vars;
+ 137 : :
+ 138 : 91717 : vars.currentLiquidityRate = 0;
+ 139 : 91717 : vars.currentVariableBorrowRate = rateData.baseVariableBorrowRate;
+ 140 : :
+ 141 : 91717 : if (params.totalDebt != 0) {
+ 142 : 32099 : vars.availableLiquidity =
+ 143 : : params.virtualUnderlyingBalance +
+ 144 : : params.liquidityAdded -
+ 145 : : params.liquidityTaken;
+ 146 : :
+ 147 : 32098 : vars.availableLiquidityPlusDebt = vars.availableLiquidity + params.totalDebt;
+ 148 : 32098 : vars.borrowUsageRatio = params.totalDebt.rayDiv(vars.availableLiquidityPlusDebt);
+ 149 : 32098 : vars.supplyUsageRatio = params.totalDebt.rayDiv(
+ 150 : : vars.availableLiquidityPlusDebt + params.unbacked
151 : : );
- 152 : :
- 153 : 8128 : vars.currentVariableBorrowRate +=
- 154 : : rateData.variableRateSlope1 +
- 155 : : rateData.variableRateSlope2.rayMul(excessBorrowUsageRatio);
- 156 : : } else {
- 157 : 39384 : vars.currentVariableBorrowRate += rateData
- 158 : : .variableRateSlope1
- 159 : : .rayMul(vars.borrowUsageRatio)
- 160 : : .rayDiv(rateData.optimalUsageRatio);
- 161 : : }
- 162 : :
- 163 : 47512 : vars.currentLiquidityRate = _getOverallBorrowRate(
- 164 : : params.totalStableDebt,
- 165 : : params.totalVariableDebt,
- 166 : : vars.currentVariableBorrowRate,
- 167 : : params.averageStableBorrowRate
- 168 : : ).rayMul(vars.supplyUsageRatio).percentMul(
- 169 : : PercentageMath.PERCENTAGE_FACTOR - params.reserveFactor
- 170 : : );
- 171 : :
- 172 : 47512 : return (vars.currentLiquidityRate, 0, vars.currentVariableBorrowRate);
- 173 : : }
- 174 : :
- 175 : : /**
- 176 : : * @dev Calculates the overall borrow rate as the weighted average between the total variable debt and total stable
- 177 : : * debt
- 178 : : * @param totalStableDebt The total borrowed from the reserve at a stable rate
- 179 : : * @param totalVariableDebt The total borrowed from the reserve at a variable rate
- 180 : : * @param currentVariableBorrowRate The current variable borrow rate of the reserve
- 181 : : * @param currentAverageStableBorrowRate The current weighted average of all the stable rate loans
- 182 : : * @return The weighted averaged borrow rate
+ 152 : : } else {
+ 153 : 59618 : return (0, vars.currentVariableBorrowRate);
+ 154 : : }
+ 155 : :
+ 156 : 32098 : if (vars.borrowUsageRatio > rateData.optimalUsageRatio) {
+ 157 : 6390 : uint256 excessBorrowUsageRatio = (vars.borrowUsageRatio - rateData.optimalUsageRatio).rayDiv(
+ 158 : : WadRayMath.RAY - rateData.optimalUsageRatio
+ 159 : : );
+ 160 : :
+ 161 : 6390 : vars.currentVariableBorrowRate +=
+ 162 : : rateData.variableRateSlope1 +
+ 163 : : rateData.variableRateSlope2.rayMul(excessBorrowUsageRatio);
+ 164 : : } else {
+ 165 : 25708 : vars.currentVariableBorrowRate += rateData
+ 166 : : .variableRateSlope1
+ 167 : : .rayMul(vars.borrowUsageRatio)
+ 168 : : .rayDiv(rateData.optimalUsageRatio);
+ 169 : : }
+ 170 : :
+ 171 : 32098 : vars.currentLiquidityRate = vars
+ 172 : : .currentVariableBorrowRate
+ 173 : : .rayMul(vars.supplyUsageRatio)
+ 174 : : .percentMul(PercentageMath.PERCENTAGE_FACTOR - params.reserveFactor);
+ 175 : :
+ 176 : 32098 : return (vars.currentLiquidityRate, vars.currentVariableBorrowRate);
+ 177 : : }
+ 178 : :
+ 179 : : /**
+ 180 : : * @dev Doing validations and data update for an asset
+ 181 : : * @param reserve address of the underlying asset of the reserve
+ 182 : : * @param rateData Encoded reserve interest rate data to apply
183 : : */
- 184 : 23756 : function _getOverallBorrowRate(
- 185 : : uint256 totalStableDebt,
- 186 : : uint256 totalVariableDebt,
- 187 : : uint256 currentVariableBorrowRate,
- 188 : : uint256 currentAverageStableBorrowRate
- 189 : : ) internal pure returns (uint256) {
- 190 : 71268 : uint256 totalDebt = totalStableDebt + totalVariableDebt;
- 191 : :
- 192 : 71268 : uint256 weightedVariableRate = totalVariableDebt.wadToRay().rayMul(currentVariableBorrowRate);
- 193 : :
- 194 : 71268 : uint256 weightedStableRate = totalStableDebt.wadToRay().rayMul(currentAverageStableBorrowRate);
- 195 : :
- 196 : 71268 : uint256 overallBorrowRate = (weightedVariableRate + weightedStableRate).rayDiv(
- 197 : : totalDebt.wadToRay()
- 198 : : );
- 199 : :
- 200 : 47512 : return overallBorrowRate;
- 201 : : }
- 202 : :
- 203 : : /**
- 204 : : * @dev Doing validations and data update for an asset
- 205 : : * @param reserve address of the underlying asset of the reserve
- 206 : : * @param rateData Encoded eserve interest rate data to apply
- 207 : : */
- 208 : 23891 : function _setInterestRateParams(address reserve, InterestRateData memory rateData) internal {
- 209 : 47782 : require(reserve != address(0), Errors.ZERO_ADDRESS_NOT_VALID);
- 210 : :
- 211 : 43782 : require(
- 212 : : rateData.optimalUsageRatio <= MAX_OPTIMAL_POINT &&
- 213 : : rateData.optimalUsageRatio >= MIN_OPTIMAL_POINT,
- 214 : : Errors.INVALID_OPTIMAL_USAGE_RATIO
- 215 : : );
+ 184 : : function _setInterestRateParams(address reserve, InterestRateData memory rateData) internal {
+ 185 : 198067 : require(reserve != address(0), Errors.ZERO_ADDRESS_NOT_VALID);
+ 186 : :
+ 187 : 194067 : require(
+ 188 : : rateData.optimalUsageRatio <= MAX_OPTIMAL_POINT &&
+ 189 : : rateData.optimalUsageRatio >= MIN_OPTIMAL_POINT,
+ 190 : : Errors.INVALID_OPTIMAL_USAGE_RATIO
+ 191 : : );
+ 192 : :
+ 193 : 186067 : require(
+ 194 : : rateData.variableRateSlope1 <= rateData.variableRateSlope2,
+ 195 : : Errors.SLOPE_2_MUST_BE_GTE_SLOPE_1
+ 196 : : );
+ 197 : :
+ 198 : : // The maximum rate should not be above certain threshold
+ 199 : 182067 : require(
+ 200 : : uint256(rateData.baseVariableBorrowRate) +
+ 201 : : uint256(rateData.variableRateSlope1) +
+ 202 : : uint256(rateData.variableRateSlope2) <=
+ 203 : : MAX_BORROW_RATE,
+ 204 : : Errors.INVALID_MAX_RATE
+ 205 : : );
+ 206 : :
+ 207 : 178067 : _interestRateData[reserve] = rateData;
+ 208 : 178067 : emit RateDataUpdate(
+ 209 : : reserve,
+ 210 : : rateData.optimalUsageRatio,
+ 211 : : rateData.baseVariableBorrowRate,
+ 212 : : rateData.variableRateSlope1,
+ 213 : : rateData.variableRateSlope2
+ 214 : : );
+ 215 : : }
216 : :
- 217 : 35782 : require(
- 218 : : rateData.variableRateSlope1 <= rateData.variableRateSlope2,
- 219 : : Errors.SLOPE_2_MUST_BE_GTE_SLOPE_1
- 220 : : );
- 221 : :
- 222 : : // The maximum rate should not be above certain threshold
- 223 : 31782 : require(
- 224 : : uint256(rateData.baseVariableBorrowRate) +
- 225 : : uint256(rateData.variableRateSlope1) +
- 226 : : uint256(rateData.variableRateSlope2) <=
- 227 : : MAX_BORROW_RATE,
- 228 : : Errors.INVALID_MAXRATE
- 229 : : );
- 230 : :
- 231 : 27782 : _interestRateData[reserve] = rateData;
- 232 : 27782 : emit RateDataUpdate(
- 233 : : reserve,
- 234 : : rateData.optimalUsageRatio,
- 235 : : rateData.baseVariableBorrowRate,
- 236 : : rateData.variableRateSlope1,
- 237 : : rateData.variableRateSlope2
- 238 : : );
- 239 : : }
- 240 : :
- 241 : : /**
- 242 : : * @dev Transforms an InterestRateData struct to an InterestRateDataRay struct by multiplying all values
- 243 : : * by 1e23, turning them into ray values
- 244 : : *
- 245 : : * @param data The InterestRateData struct to transform
- 246 : : *
- 247 : : * @return The resulting InterestRateDataRay struct
- 248 : : */
- 249 : 50547 : function _rayifyRateData(
- 250 : : InterestRateData memory data
- 251 : : ) internal pure returns (InterestRateDataRay memory) {
- 252 : 101094 : return
- 253 : 101094 : InterestRateDataRay({
- 254 : : optimalUsageRatio: _bpsToRay(uint256(data.optimalUsageRatio)),
- 255 : : baseVariableBorrowRate: _bpsToRay(uint256(data.baseVariableBorrowRate)),
- 256 : : variableRateSlope1: _bpsToRay(uint256(data.variableRateSlope1)),
- 257 : : variableRateSlope2: _bpsToRay(uint256(data.variableRateSlope2))
- 258 : : });
- 259 : : }
- 260 : :
- 261 : : // @dev helper function added here, as generally the protocol doesn't use bps
- 262 : 229213 : function _bpsToRay(uint256 n) internal pure returns (uint256) {
- 263 : 687639 : return n * 1e23;
- 264 : : }
- 265 : : }
+ 217 : : /**
+ 218 : : * @dev Transforms an InterestRateData struct to an InterestRateDataRay struct by multiplying all values
+ 219 : : * by 1e23, turning them into ray values
+ 220 : : *
+ 221 : : * @param data The InterestRateData struct to transform
+ 222 : : *
+ 223 : : * @return The resulting InterestRateDataRay struct
+ 224 : : */
+ 225 : : function _rayifyRateData(
+ 226 : : InterestRateData memory data
+ 227 : : ) internal pure returns (InterestRateDataRay memory) {
+ 228 : 93717 : return
+ 229 : : InterestRateDataRay({
+ 230 : : optimalUsageRatio: _bpsToRay(uint256(data.optimalUsageRatio)),
+ 231 : : baseVariableBorrowRate: _bpsToRay(uint256(data.baseVariableBorrowRate)),
+ 232 : : variableRateSlope1: _bpsToRay(uint256(data.variableRateSlope1)),
+ 233 : : variableRateSlope2: _bpsToRay(uint256(data.variableRateSlope2))
+ 234 : : });
+ 235 : : }
+ 236 : :
+ 237 : : // @dev helper function added here, as generally the protocol doesn't use bps
+ 238 : : function _bpsToRay(uint256 n) internal pure returns (uint256) {
+ 239 : 412312 : return n * 1e23;
+ 240 : : }
+ 241 : : }
@@ -341,8 +317,8 @@
diff --git a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PriceOracleSentinel.sol.func-c.html b/report/misc/PriceOracleSentinel.sol.func-c.html
similarity index 67%
rename from report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PriceOracleSentinel.sol.func-c.html
rename to report/misc/PriceOracleSentinel.sol.func-c.html
index d63dff30..6e8daa7d 100644
--- a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PriceOracleSentinel.sol.func-c.html
+++ b/report/misc/PriceOracleSentinel.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PriceOracleSentinel.sol - functions
-
+ LCOV - lcov.info.p - misc/PriceOracleSentinel.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,21 +53,21 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../glass.png) |
diff --git a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PriceOracleSentinel.sol.func.html b/report/misc/PriceOracleSentinel.sol.func.html
similarity index 67%
rename from report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PriceOracleSentinel.sol.func.html
rename to report/misc/PriceOracleSentinel.sol.func.html
index 7b4171e0..e024a865 100644
--- a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PriceOracleSentinel.sol.func.html
+++ b/report/misc/PriceOracleSentinel.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PriceOracleSentinel.sol - functions
-
+ LCOV - lcov.info.p - misc/PriceOracleSentinel.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,21 +53,28 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../updown.png) |
+
+
+
+
+ PriceOracleSentinel. |
+
+ 50 |
@@ -105,6 +112,20 @@
5 |
+
+
+ PriceOracleSentinel.onlyPoolAdmin |
+
+ 2 |
+
+
+
+
+ PriceOracleSentinel.onlyRiskOrPoolAdmins |
+
+ 2 |
+
+
PriceOracleSentinel.setGracePeriod |
@@ -124,8 +145,8 @@
diff --git a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PriceOracleSentinel.sol.gcov.html b/report/misc/PriceOracleSentinel.sol.gcov.html
similarity index 77%
rename from report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PriceOracleSentinel.sol.gcov.html
rename to report/misc/PriceOracleSentinel.sol.gcov.html
index bcae9cb6..b3ade1e7 100644
--- a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PriceOracleSentinel.sol.gcov.html
+++ b/report/misc/PriceOracleSentinel.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PriceOracleSentinel.sol
-
+ LCOV - lcov.info.p - misc/PriceOracleSentinel.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../glass.png) |
@@ -72,11 +72,11 @@
1 : : // SPDX-License-Identifier: BUSL-1.1
2 : : pragma solidity ^0.8.10;
3 : :
- 4 : : import {Errors} from '../libraries/helpers/Errors.sol';
- 5 : : import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
- 6 : : import {IPriceOracleSentinel} from '../../interfaces/IPriceOracleSentinel.sol';
- 7 : : import {ISequencerOracle} from '../../interfaces/ISequencerOracle.sol';
- 8 : : import {IACLManager} from '../../interfaces/IACLManager.sol';
+ 4 : : import {Errors} from '../protocol/libraries/helpers/Errors.sol';
+ 5 : : import {IPoolAddressesProvider} from '../interfaces/IPoolAddressesProvider.sol';
+ 6 : : import {IPriceOracleSentinel} from '../interfaces/IPriceOracleSentinel.sol';
+ 7 : : import {ISequencerOracle} from '../interfaces/ISequencerOracle.sol';
+ 8 : : import {IACLManager} from '../interfaces/IACLManager.sol';
9 : :
10 : : /**
11 : : * @title PriceOracleSentinel
@@ -90,8 +90,8 @@
19 : : * @dev Only pool admin can call functions marked by this modifier.
20 : : */
21 : : modifier onlyPoolAdmin() {
- 22 : : IACLManager aclManager = IACLManager(ADDRESSES_PROVIDER.getACLManager());
- 23 : : require(aclManager.isPoolAdmin(msg.sender), Errors.CALLER_NOT_POOL_ADMIN);
+ 22 : 2 : IACLManager aclManager = IACLManager(ADDRESSES_PROVIDER.getACLManager());
+ 23 : 2 : require(aclManager.isPoolAdmin(msg.sender), Errors.CALLER_NOT_POOL_ADMIN);
24 : : _;
25 : : }
26 : :
@@ -99,8 +99,8 @@
28 : : * @dev Only risk or pool admin can call functions marked by this modifier.
29 : : */
30 : : modifier onlyRiskOrPoolAdmins() {
- 31 : : IACLManager aclManager = IACLManager(ADDRESSES_PROVIDER.getACLManager());
- 32 : : require(
+ 31 : 2 : IACLManager aclManager = IACLManager(ADDRESSES_PROVIDER.getACLManager());
+ 32 : 2 : require(
33 : : aclManager.isRiskAdmin(msg.sender) || aclManager.isPoolAdmin(msg.sender),
34 : : Errors.CALLER_NOT_RISK_OR_POOL_ADMIN
35 : : );
@@ -120,50 +120,50 @@
49 : : * @param gracePeriod The duration of the grace period in seconds
50 : : */
51 : : constructor(IPoolAddressesProvider provider, ISequencerOracle oracle, uint256 gracePeriod) {
- 52 : : ADDRESSES_PROVIDER = provider;
- 53 : : _sequencerOracle = oracle;
- 54 : : _gracePeriod = gracePeriod;
+ 52 : 31 : ADDRESSES_PROVIDER = provider;
+ 53 : 28 : _sequencerOracle = oracle;
+ 54 : 20 : _gracePeriod = gracePeriod;
55 : : }
56 : :
57 : : /// @inheritdoc IPriceOracleSentinel
- 58 : 5 : function isBorrowAllowed() public view override returns (bool) {
- 59 : 15 : return _isUpAndGracePeriodPassed();
+ 58 : : function isBorrowAllowed() external view override returns (bool) {
+ 59 : 5 : return _isUpAndGracePeriodPassed();
60 : : }
61 : :
62 : : /// @inheritdoc IPriceOracleSentinel
- 63 : 5 : function isLiquidationAllowed() public view override returns (bool) {
- 64 : 15 : return _isUpAndGracePeriodPassed();
+ 63 : : function isLiquidationAllowed() external view override returns (bool) {
+ 64 : 5 : return _isUpAndGracePeriodPassed();
65 : : }
66 : :
67 : : /**
68 : : * @notice Checks the sequencer oracle is healthy: is up and grace period passed.
69 : : * @return True if the SequencerOracle is up and the grace period passed, false otherwise
70 : : */
- 71 : 10 : function _isUpAndGracePeriodPassed() internal view returns (bool) {
- 72 : 30 : (, int256 answer, uint256 startedAt, , ) = _sequencerOracle.latestRoundData();
- 73 : 48 : return answer == 0 && block.timestamp - startedAt > _gracePeriod;
+ 71 : : function _isUpAndGracePeriodPassed() internal view returns (bool) {
+ 72 : 10 : (, int256 answer, uint256 startedAt, , ) = _sequencerOracle.latestRoundData();
+ 73 : 10 : return answer == 0 && block.timestamp - startedAt > _gracePeriod;
74 : : }
75 : :
76 : : /// @inheritdoc IPriceOracleSentinel
- 77 : 2 : function setSequencerOracle(address newSequencerOracle) public onlyPoolAdmin {
- 78 : 2 : _sequencerOracle = ISequencerOracle(newSequencerOracle);
- 79 : 2 : emit SequencerOracleUpdated(newSequencerOracle);
+ 77 : : function setSequencerOracle(address newSequencerOracle) external onlyPoolAdmin {
+ 78 : 1 : _sequencerOracle = ISequencerOracle(newSequencerOracle);
+ 79 : 1 : emit SequencerOracleUpdated(newSequencerOracle);
80 : : }
81 : :
82 : : /// @inheritdoc IPriceOracleSentinel
- 83 : 2 : function setGracePeriod(uint256 newGracePeriod) public onlyRiskOrPoolAdmins {
- 84 : 2 : _gracePeriod = newGracePeriod;
- 85 : 2 : emit GracePeriodUpdated(newGracePeriod);
+ 83 : : function setGracePeriod(uint256 newGracePeriod) external onlyRiskOrPoolAdmins {
+ 84 : 1 : _gracePeriod = newGracePeriod;
+ 85 : 1 : emit GracePeriodUpdated(newGracePeriod);
86 : : }
87 : :
88 : : /// @inheritdoc IPriceOracleSentinel
- 89 : 1 : function getSequencerOracle() public view returns (address) {
- 90 : 3 : return address(_sequencerOracle);
+ 89 : : function getSequencerOracle() external view returns (address) {
+ 90 : 1 : return address(_sequencerOracle);
91 : : }
92 : :
93 : : /// @inheritdoc IPriceOracleSentinel
- 94 : 1 : function getGracePeriod() public view returns (uint256) {
- 95 : 2 : return _gracePeriod;
+ 94 : : function getGracePeriod() external view returns (uint256) {
+ 95 : 1 : return _gracePeriod;
96 : : }
97 : : }
@@ -173,8 +173,8 @@
diff --git a/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol.func-c.html b/report/misc/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol.func-c.html
similarity index 63%
rename from report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol.func-c.html
rename to report/misc/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol.func-c.html
index 6e5d290f..eeea7ea9 100644
--- a/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol.func-c.html
+++ b/report/misc/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol - functions
-
+ LCOV - lcov.info.p - misc/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,21 +53,28 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../glass.png) |
+
+
+
+
+ BaseImmutableAdminUpgradeabilityProxy.ifAdmin |
+
+ 2 |
@@ -95,14 +102,21 @@
BaseImmutableAdminUpgradeabilityProxy.upgradeToAndCall |
- 14 |
+ 13 |
+
+
+
+
+ BaseImmutableAdminUpgradeabilityProxy. |
+
+ 46 |
BaseImmutableAdminUpgradeabilityProxy._willFallback |
- 723623 |
+ 2165226 |
@@ -110,8 +124,8 @@
diff --git a/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol.func.html b/report/misc/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol.func.html
similarity index 63%
rename from report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol.func.html
rename to report/misc/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol.func.html
index eaed6f00..181045ea 100644
--- a/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol.func.html
+++ b/report/misc/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol - functions
-
+ LCOV - lcov.info.p - misc/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,28 +53,35 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../updown.png) |
+
+
+
+
+ BaseImmutableAdminUpgradeabilityProxy. |
+
+ 46 |
BaseImmutableAdminUpgradeabilityProxy._willFallback |
- 723623 |
+ 2165226 |
@@ -84,6 +91,13 @@
8 |
+
+
+ BaseImmutableAdminUpgradeabilityProxy.ifAdmin |
+
+ 2 |
+
+
BaseImmutableAdminUpgradeabilityProxy.implementation |
@@ -102,7 +116,7 @@
BaseImmutableAdminUpgradeabilityProxy.upgradeToAndCall |
- 14 |
+ 13 |
@@ -110,8 +124,8 @@
diff --git a/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol.gcov.html b/report/misc/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol.gcov.html
similarity index 81%
rename from report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol.gcov.html
rename to report/misc/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol.gcov.html
index c8f68263..52c8d83b 100644
--- a/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol.gcov.html
+++ b/report/misc/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol
-
+ LCOV - lcov.info.p - misc/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -72,7 +72,7 @@
1 : : // SPDX-License-Identifier: MIT
2 : : pragma solidity ^0.8.10;
3 : :
- 4 : : import {BaseUpgradeabilityProxy} from '../../../dependencies/openzeppelin/upgradeability/BaseUpgradeabilityProxy.sol';
+ 4 : : import {BaseUpgradeabilityProxy} from '../../dependencies/openzeppelin/upgradeability/BaseUpgradeabilityProxy.sol';
5 : :
6 : : /**
7 : : * @title BaseImmutableAdminUpgradeabilityProxy
@@ -92,14 +92,14 @@
21 : : * @param admin_ The address of the admin
22 : : */
23 : : constructor(address admin_) {
- 24 : : _admin = admin_;
+ 24 : 46 : _admin = admin_;
25 : : }
26 : :
27 : : modifier ifAdmin() {
- 28 : : if (msg.sender == _admin) {
+ 28 : 2 : if (msg.sender == _admin) {
29 : : _;
30 : : } else {
- 31 : : _fallback();
+ 31 : 1 : _fallback();
32 : : }
33 : : }
34 : :
@@ -107,16 +107,16 @@
36 : : * @notice Return the admin address
37 : : * @return The address of the proxy admin.
38 : : */
- 39 : 8 : function admin() external ifAdmin returns (address) {
- 40 : 16 : return _admin;
+ 39 : : function admin() external ifAdmin returns (address) {
+ 40 : 8 : return _admin;
41 : : }
42 : :
43 : : /**
44 : : * @notice Return the implementation address
45 : : * @return The address of the implementation.
46 : : */
- 47 : 3 : function implementation() external ifAdmin returns (address) {
- 48 : 9 : return _implementation();
+ 47 : : function implementation() external ifAdmin returns (address) {
+ 48 : 3 : return _implementation();
49 : : }
50 : :
51 : : /**
@@ -124,8 +124,8 @@
53 : : * @dev Only the admin can call this function.
54 : : * @param newImplementation The address of the new implementation.
55 : : */
- 56 : 2 : function upgradeTo(address newImplementation) external ifAdmin {
- 57 : 2 : _upgradeTo(newImplementation);
+ 56 : : function upgradeTo(address newImplementation) external ifAdmin {
+ 57 : 1 : _upgradeTo(newImplementation);
58 : : }
59 : :
60 : : /**
@@ -137,21 +137,21 @@
66 : : * It should include the signature and the parameters of the function to be called, as described in
67 : : * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
68 : : */
- 69 : 14 : function upgradeToAndCall(
+ 69 : : function upgradeToAndCall(
70 : : address newImplementation,
71 : : bytes calldata data
72 : : ) external payable ifAdmin {
- 73 : 26 : _upgradeTo(newImplementation);
- 74 : 39 : (bool success, ) = newImplementation.delegatecall(data);
- 75 : 26 : require(success);
+ 73 : 12 : _upgradeTo(newImplementation);
+ 74 : 12 : (bool success, ) = newImplementation.delegatecall(data);
+ 75 : 12 : require(success);
76 : : }
77 : :
78 : : /**
79 : : * @notice Only fall back when the sender is not the admin.
80 : : */
- 81 : 723623 : function _willFallback() internal virtual override {
- 82 : 1447246 : require(msg.sender != _admin, 'Cannot call fallback function from the proxy admin');
- 83 : 1447246 : super._willFallback();
+ 81 : : function _willFallback() internal virtual override {
+ 82 : 2165226 : require(msg.sender != _admin, 'Cannot call fallback function from the proxy admin');
+ 83 : 2165226 : super._willFallback();
84 : : }
85 : : }
@@ -161,8 +161,8 @@
diff --git a/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol.func-c.html b/report/misc/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol.func-c.html
similarity index 60%
rename from report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol.func-c.html
rename to report/misc/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol.func-c.html
index 4d2f52d6..bf41678a 100644
--- a/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol.func-c.html
+++ b/report/misc/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol - functions
-
+ LCOV - lcov.info.p - misc/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -37,12 +37,12 @@
-
+
|
-
-
+
+
|
@@ -53,28 +53,35 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../updown.png) |
+
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../glass.png) |
+
+
+
+
+ InitializableImmutableAdminUpgradeabilityProxy. |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../glass.png) |
+ 142 |
InitializableImmutableAdminUpgradeabilityProxy._willFallback |
- 723623 |
+ 2165226 |
@@ -82,8 +89,8 @@
diff --git a/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol.func.html b/report/misc/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol.func.html
similarity index 60%
rename from report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol.func.html
rename to report/misc/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol.func.html
index d1d87275..11f67cbb 100644
--- a/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol.func.html
+++ b/report/misc/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol - functions
-
+ LCOV - lcov.info.p - misc/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -37,12 +37,12 @@
-
+
|
-
-
+
+
|
@@ -53,28 +53,35 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../glass.png) |
+
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../updown.png) |
+
+
+
+
+ InitializableImmutableAdminUpgradeabilityProxy. |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../updown.png) |
+ 142 |
InitializableImmutableAdminUpgradeabilityProxy._willFallback |
- 723623 |
+ 2165226 |
@@ -82,8 +89,8 @@
diff --git a/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol.gcov.html b/report/misc/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol.gcov.html
similarity index 75%
rename from report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol.gcov.html
rename to report/misc/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol.gcov.html
index 248a1551..07ba6326 100644
--- a/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol.gcov.html
+++ b/report/misc/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol
-
+ LCOV - lcov.info.p - misc/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -37,12 +37,12 @@
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -72,8 +72,8 @@
1 : : // SPDX-License-Identifier: MIT
2 : : pragma solidity ^0.8.10;
3 : :
- 4 : : import {InitializableUpgradeabilityProxy} from '../../../dependencies/openzeppelin/upgradeability/InitializableUpgradeabilityProxy.sol';
- 5 : : import {Proxy} from '../../../dependencies/openzeppelin/upgradeability/Proxy.sol';
+ 4 : : import {InitializableUpgradeabilityProxy} from '../../dependencies/openzeppelin/upgradeability/InitializableUpgradeabilityProxy.sol';
+ 5 : : import {Proxy} from '../../dependencies/openzeppelin/upgradeability/Proxy.sol';
6 : : import {BaseImmutableAdminUpgradeabilityProxy} from './BaseImmutableAdminUpgradeabilityProxy.sol';
7 : :
8 : : /**
@@ -94,8 +94,8 @@
23 : : }
24 : :
25 : : /// @inheritdoc BaseImmutableAdminUpgradeabilityProxy
- 26 : 723623 : function _willFallback() internal override(BaseImmutableAdminUpgradeabilityProxy, Proxy) {
- 27 : 1447246 : BaseImmutableAdminUpgradeabilityProxy._willFallback();
+ 26 : : function _willFallback() internal override(BaseImmutableAdminUpgradeabilityProxy, Proxy) {
+ 27 : 2165226 : BaseImmutableAdminUpgradeabilityProxy._willFallback();
28 : : }
29 : : }
@@ -105,8 +105,8 @@
diff --git a/report/misc/aave-upgradeability/VersionedInitializable.sol.func-c.html b/report/misc/aave-upgradeability/VersionedInitializable.sol.func-c.html
new file mode 100644
index 00000000..e6d9f827
--- /dev/null
+++ b/report/misc/aave-upgradeability/VersionedInitializable.sol.func-c.html
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - misc/aave-upgradeability/VersionedInitializable.sol - functions
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../glass.png) |
+
+ |
+
+
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+
+
+
+
diff --git a/report/misc/aave-upgradeability/VersionedInitializable.sol.func.html b/report/misc/aave-upgradeability/VersionedInitializable.sol.func.html
new file mode 100644
index 00000000..c9988d86
--- /dev/null
+++ b/report/misc/aave-upgradeability/VersionedInitializable.sol.func.html
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - misc/aave-upgradeability/VersionedInitializable.sol - functions
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../glass.png) |
+
+ |
+
+
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+
+
+
+
diff --git a/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol.gcov.html b/report/misc/aave-upgradeability/VersionedInitializable.sol.gcov.html
similarity index 83%
rename from report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol.gcov.html
rename to report/misc/aave-upgradeability/VersionedInitializable.sol.gcov.html
index 41805ea2..298962d7 100644
--- a/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol.gcov.html
+++ b/report/misc/aave-upgradeability/VersionedInitializable.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol
-
+ LCOV - lcov.info.p - misc/aave-upgradeability/VersionedInitializable.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -99,22 +99,22 @@
28 : : * @dev Modifier to use in the initializer function of a contract.
29 : : */
30 : : modifier initializer() {
- 31 : : uint256 revision = getRevision();
- 32 : : require(
+ 31 : 346987 : uint256 revision = getRevision();
+ 32 : 346987 : require(
33 : : initializing || isConstructor() || revision > lastInitializedRevision,
34 : : 'Contract instance has already been initialized'
35 : : );
36 : :
- 37 : : bool isTopLevelCall = !initializing;
- 38 : : if (isTopLevelCall) {
- 39 : : initializing = true;
- 40 : : lastInitializedRevision = revision;
+ 37 : 345986 : bool isTopLevelCall = !initializing;
+ 38 : 345986 : if (isTopLevelCall) {
+ 39 : 345986 : initializing = true;
+ 40 : 345986 : lastInitializedRevision = revision;
41 : : }
42 : :
43 : : _;
44 : :
- 45 : : if (isTopLevelCall) {
- 46 : : initializing = false;
+ 45 : 344984 : if (isTopLevelCall) {
+ 46 : 344984 : initializing = false;
47 : : }
48 : : }
49 : :
@@ -129,18 +129,18 @@
58 : : * @notice Returns true if and only if the function is running in the constructor
59 : : * @return True if the function is running in the constructor
60 : : */
- 61 : 15381 : function isConstructor() private view returns (bool) {
+ 61 : : function isConstructor() private view returns (bool) {
62 : : // extcodesize checks the size of the code stored in an address, and
63 : : // address returns the current address. Since the code is still not
64 : : // deployed when running a constructor, any checks on its code size will
65 : : // yield zero, making it an effective way to detect if a contract is
66 : : // under construction or not.
- 67 : 30762 : uint256 cs;
+ 67 : 346987 : uint256 cs;
68 : : //solium-disable-next-line
69 : : assembly {
- 70 : 30762 : cs := extcodesize(address())
+ 70 : 346987 : cs := extcodesize(address())
71 : : }
- 72 : 46143 : return cs == 0;
+ 72 : 346987 : return cs == 0;
73 : : }
74 : :
75 : : // Reserved storage space to allow for layout changes in the future.
@@ -153,8 +153,8 @@
diff --git a/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/index-sort-b.html b/report/misc/aave-upgradeability/index-sort-b.html
similarity index 59%
rename from report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/index-sort-b.html
rename to report/misc/aave-upgradeability/index-sort-b.html
index e9076aeb..6fbec03e 100644
--- a/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/index-sort-b.html
+++ b/report/misc/aave-upgradeability/index-sort-b.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability
-
+ LCOV - lcov.info.p - misc/aave-upgradeability
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../../../glass.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../glass.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../updown.png) |
Rate |
@@ -96,24 +96,24 @@
Hit |
- BaseImmutableAdminUpgradeabilityProxy.sol |
+ BaseImmutableAdminUpgradeabilityProxy.sol |
-
+
|
100.0 % |
- 8 |
- 8 |
+ 11 |
+ 11 |
- |
|
|
100.0 % |
- 5 |
- 5 |
+ 7 |
+ 7 |
- InitializableImmutableAdminUpgradeabilityProxy.sol |
+ InitializableImmutableAdminUpgradeabilityProxy.sol |
-
+
|
100.0 % |
1 |
@@ -122,31 +122,31 @@
|
|
100.0 % |
- 1 |
- 1 |
+ 2 |
+ 2 |
- VersionedInitializable.sol |
+ VersionedInitializable.sol |
-
+
|
100.0 % |
- 3 |
- 3 |
+ 11 |
+ 11 |
- |
|
|
100.0 % |
- 1 |
- 1 |
+ 2 |
+ 2 |
diff --git a/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/index-sort-f.html b/report/misc/aave-upgradeability/index-sort-f.html
similarity index 59%
rename from report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/index-sort-f.html
rename to report/misc/aave-upgradeability/index-sort-f.html
index b5084b97..c743f57f 100644
--- a/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/index-sort-f.html
+++ b/report/misc/aave-upgradeability/index-sort-f.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability
-
+ LCOV - lcov.info.p - misc/aave-upgradeability
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../../../glass.png) |
+ File ![Click to sort table by file name Sort by file name](../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../glass.png) |
Rate |
@@ -96,9 +96,9 @@
Hit |
- InitializableImmutableAdminUpgradeabilityProxy.sol |
+ InitializableImmutableAdminUpgradeabilityProxy.sol |
-
+
|
100.0 % |
1 |
@@ -107,46 +107,46 @@
|
|
100.0 % |
- 1 |
- 1 |
+ 2 |
+ 2 |
- VersionedInitializable.sol |
+ VersionedInitializable.sol |
-
+
|
100.0 % |
- 3 |
- 3 |
+ 11 |
+ 11 |
- |
|
|
100.0 % |
- 1 |
- 1 |
+ 2 |
+ 2 |
- BaseImmutableAdminUpgradeabilityProxy.sol |
+ BaseImmutableAdminUpgradeabilityProxy.sol |
-
+
|
100.0 % |
- 8 |
- 8 |
+ 11 |
+ 11 |
- |
|
|
100.0 % |
- 5 |
- 5 |
+ 7 |
+ 7 |
diff --git a/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/index-sort-l.html b/report/misc/aave-upgradeability/index-sort-l.html
similarity index 59%
rename from report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/index-sort-l.html
rename to report/misc/aave-upgradeability/index-sort-l.html
index 9ecef43f..b8ae0b74 100644
--- a/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/index-sort-l.html
+++ b/report/misc/aave-upgradeability/index-sort-l.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability
-
+ LCOV - lcov.info.p - misc/aave-upgradeability
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../../../glass.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../glass.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../updown.png) |
Rate |
@@ -96,9 +96,9 @@
Hit |
- InitializableImmutableAdminUpgradeabilityProxy.sol |
+ InitializableImmutableAdminUpgradeabilityProxy.sol |
-
+
|
100.0 % |
1 |
@@ -107,46 +107,46 @@
|
|
100.0 % |
- 1 |
- 1 |
+ 2 |
+ 2 |
- VersionedInitializable.sol |
+ BaseImmutableAdminUpgradeabilityProxy.sol |
-
+
|
100.0 % |
- 3 |
- 3 |
+ 11 |
+ 11 |
- |
|
|
100.0 % |
- 1 |
- 1 |
+ 7 |
+ 7 |
- BaseImmutableAdminUpgradeabilityProxy.sol |
+ VersionedInitializable.sol |
-
+
|
100.0 % |
- 8 |
- 8 |
+ 11 |
+ 11 |
- |
|
|
100.0 % |
- 5 |
- 5 |
+ 2 |
+ 2 |
diff --git a/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/index.html b/report/misc/aave-upgradeability/index.html
similarity index 59%
rename from report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/index.html
rename to report/misc/aave-upgradeability/index.html
index db271224..2fc18e97 100644
--- a/report/core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability/index.html
+++ b/report/misc/aave-upgradeability/index.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/aave-upgradeability/src/core/contracts/protocol/libraries/aave-upgradeability
-
+ LCOV - lcov.info.p - misc/aave-upgradeability
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../../../glass.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../../glass.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../updown.png) |
Rate |
@@ -96,24 +96,24 @@
Hit |
- BaseImmutableAdminUpgradeabilityProxy.sol |
+ BaseImmutableAdminUpgradeabilityProxy.sol |
-
+
|
100.0 % |
- 8 |
- 8 |
+ 11 |
+ 11 |
- |
|
|
100.0 % |
- 5 |
- 5 |
+ 7 |
+ 7 |
- InitializableImmutableAdminUpgradeabilityProxy.sol |
+ InitializableImmutableAdminUpgradeabilityProxy.sol |
-
+
|
100.0 % |
1 |
@@ -122,31 +122,31 @@
|
|
100.0 % |
- 1 |
- 1 |
+ 2 |
+ 2 |
- VersionedInitializable.sol |
+ VersionedInitializable.sol |
-
+
|
100.0 % |
- 3 |
- 3 |
+ 11 |
+ 11 |
- |
|
|
100.0 % |
- 1 |
- 1 |
+ 2 |
+ 2 |
diff --git a/report/misc/flashloan/base/FlashLoanReceiverBase.sol.func-c.html b/report/misc/flashloan/base/FlashLoanReceiverBase.sol.func-c.html
new file mode 100644
index 00000000..a035c960
--- /dev/null
+++ b/report/misc/flashloan/base/FlashLoanReceiverBase.sol.func-c.html
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - misc/flashloan/base/FlashLoanReceiverBase.sol - functions
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../../glass.png) |
+
+ |
+
+
+ ![](../../../glass.png) |
+
+
+
+
+
+
+
+
+
+
+
diff --git a/report/misc/flashloan/base/FlashLoanReceiverBase.sol.func.html b/report/misc/flashloan/base/FlashLoanReceiverBase.sol.func.html
new file mode 100644
index 00000000..cf8732da
--- /dev/null
+++ b/report/misc/flashloan/base/FlashLoanReceiverBase.sol.func.html
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - misc/flashloan/base/FlashLoanReceiverBase.sol - functions
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../../glass.png) |
+
+ |
+
+
+ ![](../../../glass.png) |
+
+
+
+
+
+
+
+
+
+
+
diff --git a/report/periphery/contracts/libraries/src/periphery/contracts/libraries/DataTypesHelper.sol.gcov.html b/report/misc/flashloan/base/FlashLoanReceiverBase.sol.gcov.html
similarity index 54%
rename from report/periphery/contracts/libraries/src/periphery/contracts/libraries/DataTypesHelper.sol.gcov.html
rename to report/misc/flashloan/base/FlashLoanReceiverBase.sol.gcov.html
index 8762d67b..540e9e6e 100644
--- a/report/periphery/contracts/libraries/src/periphery/contracts/libraries/DataTypesHelper.sol.gcov.html
+++ b/report/misc/flashloan/base/FlashLoanReceiverBase.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/libraries/src/periphery/contracts/libraries/DataTypesHelper.sol
-
+ LCOV - lcov.info.p - misc/flashloan/base/FlashLoanReceiverBase.sol
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -72,32 +72,24 @@
1 : : // SPDX-License-Identifier: MIT
2 : : pragma solidity ^0.8.10;
3 : :
- 4 : : import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
- 5 : : import {DataTypes} from 'aave-v3-core/contracts/protocol/libraries/types/DataTypes.sol';
- 6 : :
- 7 : : /**
- 8 : : * @title DataTypesHelper
- 9 : : * @author Aave
- 10 : : * @dev Helper library to track user current debt balance, used by WrappedTokenGatewayV3
- 11 : : */
- 12 : : library DataTypesHelper {
- 13 : : /**
- 14 : : * @notice Fetches the user current stable and variable debt balances
- 15 : : * @param user The user address
- 16 : : * @param reserve The reserve data object
- 17 : : * @return The stable debt balance
- 18 : : * @return The variable debt balance
- 19 : : **/
- 20 : 5 : function getUserCurrentDebt(
- 21 : : address user,
- 22 : : DataTypes.ReserveDataLegacy memory reserve
- 23 : : ) internal view returns (uint256, uint256) {
- 24 : 10 : return (
- 25 : : IERC20(reserve.stableDebtTokenAddress).balanceOf(user),
- 26 : : IERC20(reserve.variableDebtTokenAddress).balanceOf(user)
- 27 : : );
- 28 : : }
- 29 : : }
+ 4 : : import {IFlashLoanReceiver} from '../interfaces/IFlashLoanReceiver.sol';
+ 5 : : import {IPoolAddressesProvider} from '../../../interfaces/IPoolAddressesProvider.sol';
+ 6 : : import {IPool} from '../../../interfaces/IPool.sol';
+ 7 : :
+ 8 : : /**
+ 9 : : * @title FlashLoanReceiverBase
+ 10 : : * @author Aave
+ 11 : : * @notice Base contract to develop a flashloan-receiver contract.
+ 12 : : */
+ 13 : : abstract contract FlashLoanReceiverBase is IFlashLoanReceiver {
+ 14 : : IPoolAddressesProvider public immutable override ADDRESSES_PROVIDER;
+ 15 : : IPool public immutable override POOL;
+ 16 : :
+ 17 : : constructor(IPoolAddressesProvider provider) {
+ 18 : 0 : ADDRESSES_PROVIDER = provider;
+ 19 : 0 : POOL = IPool(provider.getPool());
+ 20 : : }
+ 21 : : }
@@ -105,8 +97,8 @@
diff --git a/report/periphery/contracts/libraries/src/periphery/contracts/libraries/DataTypesHelper.sol.func-c.html b/report/misc/flashloan/base/FlashLoanSimpleReceiverBase.sol.func-c.html
similarity index 65%
rename from report/periphery/contracts/libraries/src/periphery/contracts/libraries/DataTypesHelper.sol.func-c.html
rename to report/misc/flashloan/base/FlashLoanSimpleReceiverBase.sol.func-c.html
index d37d5d7d..c50fb247 100644
--- a/report/periphery/contracts/libraries/src/periphery/contracts/libraries/DataTypesHelper.sol.func-c.html
+++ b/report/misc/flashloan/base/FlashLoanSimpleReceiverBase.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/libraries/src/periphery/contracts/libraries/DataTypesHelper.sol - functions
-
+ LCOV - lcov.info.p - misc/flashloan/base/FlashLoanSimpleReceiverBase.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,12 +32,12 @@
|
-
-
+
+
-
+
|
@@ -53,28 +53,28 @@
- ![](../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../glass.png) |
- DataTypesHelper.getUserCurrentDebt |
+ FlashLoanSimpleReceiverBase. |
- 5 |
+ 58 |
@@ -82,8 +82,8 @@
diff --git a/report/periphery/contracts/libraries/src/periphery/contracts/libraries/DataTypesHelper.sol.func.html b/report/misc/flashloan/base/FlashLoanSimpleReceiverBase.sol.func.html
similarity index 65%
rename from report/periphery/contracts/libraries/src/periphery/contracts/libraries/DataTypesHelper.sol.func.html
rename to report/misc/flashloan/base/FlashLoanSimpleReceiverBase.sol.func.html
index e8c58a59..882c4121 100644
--- a/report/periphery/contracts/libraries/src/periphery/contracts/libraries/DataTypesHelper.sol.func.html
+++ b/report/misc/flashloan/base/FlashLoanSimpleReceiverBase.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/libraries/src/periphery/contracts/libraries/DataTypesHelper.sol - functions
-
+ LCOV - lcov.info.p - misc/flashloan/base/FlashLoanSimpleReceiverBase.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,12 +32,12 @@
|
-
-
+
+
-
+
|
@@ -53,28 +53,28 @@
- ![](../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../updown.png) |
- DataTypesHelper.getUserCurrentDebt |
+ FlashLoanSimpleReceiverBase. |
- 5 |
+ 58 |
@@ -82,8 +82,8 @@
diff --git a/report/core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers/Helpers.sol.gcov.html b/report/misc/flashloan/base/FlashLoanSimpleReceiverBase.sol.gcov.html
similarity index 57%
rename from report/core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers/Helpers.sol.gcov.html
rename to report/misc/flashloan/base/FlashLoanSimpleReceiverBase.sol.gcov.html
index 17c7eb68..786fcf67 100644
--- a/report/core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers/Helpers.sol.gcov.html
+++ b/report/misc/flashloan/base/FlashLoanSimpleReceiverBase.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers/Helpers.sol
-
+ LCOV - lcov.info.p - misc/flashloan/base/FlashLoanSimpleReceiverBase.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,12 +32,12 @@
|
-
-
+
+
-
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -70,33 +70,26 @@
Branch data Line data Source code
1 : : // SPDX-License-Identifier: MIT
- 2 : : pragma solidity ^0.8.0;
+ 2 : : pragma solidity ^0.8.10;
3 : :
- 4 : : import {IERC20} from '../../../dependencies/openzeppelin/contracts/IERC20.sol';
- 5 : : import {DataTypes} from '../types/DataTypes.sol';
- 6 : :
- 7 : : /**
- 8 : : * @title Helpers library
- 9 : : * @author Aave
- 10 : : */
- 11 : : library Helpers {
- 12 : : /**
- 13 : : * @notice Fetches the user current stable and variable debt balances
- 14 : : * @param user The user address
- 15 : : * @param reserveCache The reserve cache data object
- 16 : : * @return The stable debt balance
- 17 : : * @return The variable debt balance
- 18 : : */
- 19 : 16329 : function getUserCurrentDebt(
- 20 : : address user,
- 21 : : DataTypes.ReserveCache memory reserveCache
- 22 : : ) internal view returns (uint256, uint256) {
- 23 : 32658 : return (
- 24 : : IERC20(reserveCache.stableDebtTokenAddress).balanceOf(user),
- 25 : : IERC20(reserveCache.variableDebtTokenAddress).balanceOf(user)
- 26 : : );
- 27 : : }
- 28 : : }
+ 4 : : import {IFlashLoanSimpleReceiver} from '../interfaces/IFlashLoanSimpleReceiver.sol';
+ 5 : : import {IPoolAddressesProvider} from '../../../interfaces/IPoolAddressesProvider.sol';
+ 6 : : import {IPool} from '../../../interfaces/IPool.sol';
+ 7 : :
+ 8 : : /**
+ 9 : : * @title FlashLoanSimpleReceiverBase
+ 10 : : * @author Aave
+ 11 : : * @notice Base contract to develop a flashloan-receiver contract.
+ 12 : : */
+ 13 : : abstract contract FlashLoanSimpleReceiverBase is IFlashLoanSimpleReceiver {
+ 14 : : IPoolAddressesProvider public immutable override ADDRESSES_PROVIDER;
+ 15 : : IPool public immutable override POOL;
+ 16 : :
+ 17 : : constructor(IPoolAddressesProvider provider) {
+ 18 : 58 : ADDRESSES_PROVIDER = provider;
+ 19 : 68 : POOL = IPool(provider.getPool());
+ 20 : : }
+ 21 : : }
@@ -104,8 +97,8 @@
diff --git a/report/misc/flashloan/base/index-sort-b.html b/report/misc/flashloan/base/index-sort-b.html
new file mode 100644
index 00000000..b77bf200
--- /dev/null
+++ b/report/misc/flashloan/base/index-sort-b.html
@@ -0,0 +1,139 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - misc/flashloan/base
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../../glass.png) |
+
+ |
+
+
+ ![](../../../glass.png) |
+
+
+
+
+
+
+
|
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+ File ![Click to sort table by file name Sort by file name](../../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../glass.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../updown.png) |
+
+
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+
+
+ FlashLoanReceiverBase.sol |
+
+
+ |
+ 0.0 % |
+ 2 |
+ |
+ - |
+ |
+ |
+ 0.0 % |
+ 1 |
+ |
+
+
+ FlashLoanSimpleReceiverBase.sol |
+
+
+ |
+ 100.0 % |
+ 2 |
+ 2 |
+ - |
+ |
+ |
+ 100.0 % |
+ 1 |
+ 1 |
+
+
+
+
+
+
+
+
+
+
diff --git a/report/misc/flashloan/base/index-sort-f.html b/report/misc/flashloan/base/index-sort-f.html
new file mode 100644
index 00000000..95df52ec
--- /dev/null
+++ b/report/misc/flashloan/base/index-sort-f.html
@@ -0,0 +1,139 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - misc/flashloan/base
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../../glass.png) |
+
+ |
+
+
+ ![](../../../glass.png) |
+
+
+
+
+
+
+
|
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+ File ![Click to sort table by file name Sort by file name](../../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../glass.png) |
+
+
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+
+
+ FlashLoanReceiverBase.sol |
+
+
+ |
+ 0.0 % |
+ 2 |
+ |
+ - |
+ |
+ |
+ 0.0 % |
+ 1 |
+ |
+
+
+ FlashLoanSimpleReceiverBase.sol |
+
+
+ |
+ 100.0 % |
+ 2 |
+ 2 |
+ - |
+ |
+ |
+ 100.0 % |
+ 1 |
+ 1 |
+
+
+
+
+
+
+
+
+
+
diff --git a/report/misc/flashloan/base/index-sort-l.html b/report/misc/flashloan/base/index-sort-l.html
new file mode 100644
index 00000000..6dfece1e
--- /dev/null
+++ b/report/misc/flashloan/base/index-sort-l.html
@@ -0,0 +1,139 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - misc/flashloan/base
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../../glass.png) |
+
+ |
+
+
+ ![](../../../glass.png) |
+
+
+
+
+
+
+
|
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+ File ![Click to sort table by file name Sort by file name](../../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../glass.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../updown.png) |
+
+
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+
+
+ FlashLoanReceiverBase.sol |
+
+
+ |
+ 0.0 % |
+ 2 |
+ |
+ - |
+ |
+ |
+ 0.0 % |
+ 1 |
+ |
+
+
+ FlashLoanSimpleReceiverBase.sol |
+
+
+ |
+ 100.0 % |
+ 2 |
+ 2 |
+ - |
+ |
+ |
+ 100.0 % |
+ 1 |
+ 1 |
+
+
+
+
+
+
+
+
+
+
diff --git a/report/misc/flashloan/base/index.html b/report/misc/flashloan/base/index.html
new file mode 100644
index 00000000..7ce3a1d7
--- /dev/null
+++ b/report/misc/flashloan/base/index.html
@@ -0,0 +1,139 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - misc/flashloan/base
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../../glass.png) |
+
+ |
+
+
+ ![](../../../glass.png) |
+
+
+
+
+
+
+
|
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+ File ![Click to sort table by file name Sort by file name](../../../glass.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../updown.png) |
+
+
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+
+
+ FlashLoanReceiverBase.sol |
+
+
+ |
+ 0.0 % |
+ 2 |
+ |
+ - |
+ |
+ |
+ 0.0 % |
+ 1 |
+ |
+
+
+ FlashLoanSimpleReceiverBase.sol |
+
+
+ |
+ 100.0 % |
+ 2 |
+ 2 |
+ - |
+ |
+ |
+ 100.0 % |
+ 1 |
+ 1 |
+
+
+
+
+
+
+
+
+
+
diff --git a/report/misc/index-sort-b.html b/report/misc/index-sort-b.html
new file mode 100644
index 00000000..4dab1ea9
--- /dev/null
+++ b/report/misc/index-sort-b.html
@@ -0,0 +1,154 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - misc
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../glass.png) |
+
+ |
+
+
+ ![](../glass.png) |
+
+
+
+
+
+
+
|
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+ File ![Click to sort table by file name Sort by file name](../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../glass.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../updown.png) |
+
+
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+
+
+ AaveOracle.sol |
+
+
+ |
+ 81.2 % |
+ 32 |
+ 26 |
+ - |
+ |
+ |
+ 90.9 % |
+ 11 |
+ 10 |
+
+
+ DefaultReserveInterestRateStrategyV2.sol |
+
+
+ |
+ 100.0 % |
+ 39 |
+ 39 |
+ - |
+ |
+ |
+ 100.0 % |
+ 14 |
+ 14 |
+
+
+ PriceOracleSentinel.sol |
+
+
+ |
+ 100.0 % |
+ 17 |
+ 17 |
+ - |
+ |
+ |
+ 100.0 % |
+ 10 |
+ 10 |
+
+
+
+
+
+
+
+
+
+
diff --git a/report/misc/index-sort-f.html b/report/misc/index-sort-f.html
new file mode 100644
index 00000000..eb5ba0f1
--- /dev/null
+++ b/report/misc/index-sort-f.html
@@ -0,0 +1,154 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - misc
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../glass.png) |
+
+ |
+
+
+ ![](../glass.png) |
+
+
+
+
+
+
+
|
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+ File ![Click to sort table by file name Sort by file name](../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../glass.png) |
+
+
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+
+
+ AaveOracle.sol |
+
+
+ |
+ 81.2 % |
+ 32 |
+ 26 |
+ - |
+ |
+ |
+ 90.9 % |
+ 11 |
+ 10 |
+
+
+ PriceOracleSentinel.sol |
+
+
+ |
+ 100.0 % |
+ 17 |
+ 17 |
+ - |
+ |
+ |
+ 100.0 % |
+ 10 |
+ 10 |
+
+
+ DefaultReserveInterestRateStrategyV2.sol |
+
+
+ |
+ 100.0 % |
+ 39 |
+ 39 |
+ - |
+ |
+ |
+ 100.0 % |
+ 14 |
+ 14 |
+
+
+
+
+
+
+
+
+
+
diff --git a/report/misc/index-sort-l.html b/report/misc/index-sort-l.html
new file mode 100644
index 00000000..01bfd04d
--- /dev/null
+++ b/report/misc/index-sort-l.html
@@ -0,0 +1,154 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - misc
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../glass.png) |
+
+ |
+
+
+ ![](../glass.png) |
+
+
+
+
+
+
+
|
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+ File ![Click to sort table by file name Sort by file name](../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../glass.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../updown.png) |
+
+
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+
+
+ AaveOracle.sol |
+
+
+ |
+ 81.2 % |
+ 32 |
+ 26 |
+ - |
+ |
+ |
+ 90.9 % |
+ 11 |
+ 10 |
+
+
+ PriceOracleSentinel.sol |
+
+
+ |
+ 100.0 % |
+ 17 |
+ 17 |
+ - |
+ |
+ |
+ 100.0 % |
+ 10 |
+ 10 |
+
+
+ DefaultReserveInterestRateStrategyV2.sol |
+
+
+ |
+ 100.0 % |
+ 39 |
+ 39 |
+ - |
+ |
+ |
+ 100.0 % |
+ 14 |
+ 14 |
+
+
+
+
+
+
+
+
+
+
diff --git a/report/misc/index.html b/report/misc/index.html
new file mode 100644
index 00000000..8c76bd84
--- /dev/null
+++ b/report/misc/index.html
@@ -0,0 +1,154 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - misc
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../glass.png) |
+
+ |
+
+
+ ![](../glass.png) |
+
+
+
+
+
+
+
|
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+ File ![Click to sort table by file name Sort by file name](../glass.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../updown.png) |
+
+
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+
+
+ AaveOracle.sol |
+
+
+ |
+ 81.2 % |
+ 32 |
+ 26 |
+ - |
+ |
+ |
+ 90.9 % |
+ 11 |
+ 10 |
+
+
+ DefaultReserveInterestRateStrategyV2.sol |
+
+
+ |
+ 100.0 % |
+ 39 |
+ 39 |
+ - |
+ |
+ |
+ 100.0 % |
+ 14 |
+ 14 |
+
+
+ PriceOracleSentinel.sol |
+
+
+ |
+ 100.0 % |
+ 17 |
+ 17 |
+ - |
+ |
+ |
+ 100.0 % |
+ 10 |
+ 10 |
+
+
+
+
+
+
+
+
+
+
diff --git a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapBuyAdapter.sol.func-c.html b/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapBuyAdapter.sol.func-c.html
deleted file mode 100644
index ef077afb..00000000
--- a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapBuyAdapter.sol.func-c.html
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapBuyAdapter.sol - functions
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
-
-
-
-
diff --git a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapBuyAdapter.sol.func.html b/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapBuyAdapter.sol.func.html
deleted file mode 100644
index 5c15c254..00000000
--- a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapBuyAdapter.sol.func.html
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapBuyAdapter.sol - functions
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
-
-
-
-
diff --git a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapSellAdapter.sol.func-c.html b/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapSellAdapter.sol.func-c.html
deleted file mode 100644
index 72e640e0..00000000
--- a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapSellAdapter.sol.func-c.html
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapSellAdapter.sol - functions
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
-
-
-
-
diff --git a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapSellAdapter.sol.func.html b/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapSellAdapter.sol.func.html
deleted file mode 100644
index 9953c476..00000000
--- a/report/periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapSellAdapter.sol.func.html
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - periphery/contracts/adapters/paraswap/src/periphery/contracts/adapters/paraswap/BaseParaSwapSellAdapter.sol - functions
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../../../glass.png) |
-
-
-
-
-
-
-
-
-
-
-
diff --git a/report/periphery/contracts/libraries/src/periphery/contracts/libraries/index-sort-b.html b/report/periphery/contracts/libraries/src/periphery/contracts/libraries/index-sort-b.html
deleted file mode 100644
index b0c9d92c..00000000
--- a/report/periphery/contracts/libraries/src/periphery/contracts/libraries/index-sort-b.html
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - periphery/contracts/libraries/src/periphery/contracts/libraries
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../glass.png) |
-
-
-
-
-
-
-
|
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../glass.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../updown.png) |
-
-
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
-
-
- DataTypesHelper.sol |
-
-
- |
- 100.0 % |
- 1 |
- 1 |
- - |
- |
- |
- 100.0 % |
- 1 |
- 1 |
-
-
-
-
-
-
-
-
-
-
diff --git a/report/periphery/contracts/libraries/src/periphery/contracts/libraries/index-sort-f.html b/report/periphery/contracts/libraries/src/periphery/contracts/libraries/index-sort-f.html
deleted file mode 100644
index 48dbe985..00000000
--- a/report/periphery/contracts/libraries/src/periphery/contracts/libraries/index-sort-f.html
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - periphery/contracts/libraries/src/periphery/contracts/libraries
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../glass.png) |
-
-
-
-
-
-
-
|
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../glass.png) |
-
-
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
-
-
- DataTypesHelper.sol |
-
-
- |
- 100.0 % |
- 1 |
- 1 |
- - |
- |
- |
- 100.0 % |
- 1 |
- 1 |
-
-
-
-
-
-
-
-
-
-
diff --git a/report/periphery/contracts/libraries/src/periphery/contracts/libraries/index-sort-l.html b/report/periphery/contracts/libraries/src/periphery/contracts/libraries/index-sort-l.html
deleted file mode 100644
index 3adc162a..00000000
--- a/report/periphery/contracts/libraries/src/periphery/contracts/libraries/index-sort-l.html
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - periphery/contracts/libraries/src/periphery/contracts/libraries
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../glass.png) |
-
-
-
-
-
-
-
|
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../glass.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../updown.png) |
-
-
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
-
-
- DataTypesHelper.sol |
-
-
- |
- 100.0 % |
- 1 |
- 1 |
- - |
- |
- |
- 100.0 % |
- 1 |
- 1 |
-
-
-
-
-
-
-
-
-
-
diff --git a/report/periphery/contracts/libraries/src/periphery/contracts/libraries/index.html b/report/periphery/contracts/libraries/src/periphery/contracts/libraries/index.html
deleted file mode 100644
index 5055d076..00000000
--- a/report/periphery/contracts/libraries/src/periphery/contracts/libraries/index.html
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - periphery/contracts/libraries/src/periphery/contracts/libraries
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../glass.png) |
-
-
-
-
-
-
-
|
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../glass.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../updown.png) |
-
-
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
-
-
- DataTypesHelper.sol |
-
-
- |
- 100.0 % |
- 1 |
- 1 |
- - |
- |
- |
- 100.0 % |
- 1 |
- 1 |
-
-
-
-
-
-
-
-
-
-
diff --git a/report/periphery/contracts/misc/src/periphery/contracts/misc/index-sort-b.html b/report/periphery/contracts/misc/src/periphery/contracts/misc/index-sort-b.html
deleted file mode 100644
index 0f9f4c34..00000000
--- a/report/periphery/contracts/misc/src/periphery/contracts/misc/index-sort-b.html
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - periphery/contracts/misc/src/periphery/contracts/misc
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../glass.png) |
-
-
-
-
-
-
-
|
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../glass.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../updown.png) |
-
-
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
-
-
- WrappedTokenGatewayV3.sol |
-
-
- |
- 100.0 % |
- 38 |
- 38 |
- - |
- |
- |
- 100.0 % |
- 10 |
- 10 |
-
-
-
-
-
-
-
-
-
-
diff --git a/report/periphery/contracts/misc/src/periphery/contracts/misc/index-sort-f.html b/report/periphery/contracts/misc/src/periphery/contracts/misc/index-sort-f.html
deleted file mode 100644
index 491ae36d..00000000
--- a/report/periphery/contracts/misc/src/periphery/contracts/misc/index-sort-f.html
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - periphery/contracts/misc/src/periphery/contracts/misc
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../glass.png) |
-
-
-
-
-
-
-
|
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../glass.png) |
-
-
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
-
-
- WrappedTokenGatewayV3.sol |
-
-
- |
- 100.0 % |
- 38 |
- 38 |
- - |
- |
- |
- 100.0 % |
- 10 |
- 10 |
-
-
-
-
-
-
-
-
-
-
diff --git a/report/periphery/contracts/misc/src/periphery/contracts/misc/index-sort-l.html b/report/periphery/contracts/misc/src/periphery/contracts/misc/index-sort-l.html
deleted file mode 100644
index 949ca423..00000000
--- a/report/periphery/contracts/misc/src/periphery/contracts/misc/index-sort-l.html
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - periphery/contracts/misc/src/periphery/contracts/misc
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../glass.png) |
-
-
-
-
-
-
-
|
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../glass.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../updown.png) |
-
-
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
-
-
- WrappedTokenGatewayV3.sol |
-
-
- |
- 100.0 % |
- 38 |
- 38 |
- - |
- |
- |
- 100.0 % |
- 10 |
- 10 |
-
-
-
-
-
-
-
-
-
-
diff --git a/report/periphery/contracts/misc/src/periphery/contracts/misc/index.html b/report/periphery/contracts/misc/src/periphery/contracts/misc/index.html
deleted file mode 100644
index 6a4c8cf0..00000000
--- a/report/periphery/contracts/misc/src/periphery/contracts/misc/index.html
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
-
-
-
- LCOV - lcov.info.p - periphery/contracts/misc/src/periphery/contracts/misc
-
-
-
-
-
-
- LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
-
-
-
-
-
-
-
- |
- |
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
- |
- |
- |
-
-
-
-
-
- ![](../../../../../../../glass.png) |
-
- |
-
-
- ![](../../../../../../../glass.png) |
-
-
-
-
-
-
-
|
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../glass.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../updown.png) |
-
-
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
- Rate |
- Total |
- Hit |
-
-
- WrappedTokenGatewayV3.sol |
-
-
- |
- 100.0 % |
- 38 |
- 38 |
- - |
- |
- |
- 100.0 % |
- 10 |
- 10 |
-
-
-
-
-
-
-
-
-
-
diff --git a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/ACLManager.sol.func-c.html b/report/protocol/configuration/ACLManager.sol.func-c.html
similarity index 75%
rename from report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/ACLManager.sol.func-c.html
rename to report/protocol/configuration/ACLManager.sol.func-c.html
index 9a24bbad..5f6427f2 100644
--- a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/ACLManager.sol.func-c.html
+++ b/report/protocol/configuration/ACLManager.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/ACLManager.sol - functions
-
+ LCOV - lcov.info.p - protocol/configuration/ACLManager.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,17 +31,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
@@ -53,21 +53,28 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../updown.png) |
+
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../glass.png) |
+
+
+
+
+ ACLManager. |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../glass.png) |
+ 0 |
@@ -133,13 +140,6 @@
6 |
-
-
- ACLManager.isFlashBorrower |
-
- 11 |
-
-
ACLManager.addBridge |
@@ -165,42 +165,49 @@
ACLManager.addEmergencyAdmin |
- 608 |
+ 683 |
+
+
+
+
+ ACLManager.isFlashBorrower |
+
+ 1012 |
ACLManager.addPoolAdmin |
- 1794 |
+ 2028 |
ACLManager.isAssetListingAdmin |
- 3188 |
+ 10317 |
ACLManager.isEmergencyAdmin |
- 10004 |
+ 17013 |
ACLManager.isRiskAdmin |
- 25336 |
+ 84695 |
ACLManager.isPoolAdmin |
- 51690 |
+ 140446 |
@@ -208,8 +215,8 @@
diff --git a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/ACLManager.sol.func.html b/report/protocol/configuration/ACLManager.sol.func.html
similarity index 75%
rename from report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/ACLManager.sol.func.html
rename to report/protocol/configuration/ACLManager.sol.func.html
index 093dcf6d..59cf45d2 100644
--- a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/ACLManager.sol.func.html
+++ b/report/protocol/configuration/ACLManager.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/ACLManager.sol - functions
-
+ LCOV - lcov.info.p - protocol/configuration/ACLManager.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,17 +31,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
@@ -53,21 +53,28 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../glass.png) |
+
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../updown.png) |
+
+
+
+
+ ACLManager. |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../updown.png) |
+ 0 |
@@ -88,7 +95,7 @@
ACLManager.addEmergencyAdmin |
- 608 |
+ 683 |
@@ -102,7 +109,7 @@
ACLManager.addPoolAdmin |
- 1794 |
+ 2028 |
@@ -116,7 +123,7 @@
ACLManager.isAssetListingAdmin |
- 3188 |
+ 10317 |
@@ -130,28 +137,28 @@
ACLManager.isEmergencyAdmin |
- 10004 |
+ 17013 |
ACLManager.isFlashBorrower |
- 11 |
+ 1012 |
ACLManager.isPoolAdmin |
- 51690 |
+ 140446 |
ACLManager.isRiskAdmin |
- 25336 |
+ 84695 |
@@ -208,8 +215,8 @@
diff --git a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/ACLManager.sol.gcov.html b/report/protocol/configuration/ACLManager.sol.gcov.html
similarity index 75%
rename from report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/ACLManager.sol.gcov.html
rename to report/protocol/configuration/ACLManager.sol.gcov.html
index bf60ee78..9f69f4dd 100644
--- a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/ACLManager.sol.gcov.html
+++ b/report/protocol/configuration/ACLManager.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/ACLManager.sol
-
+ LCOV - lcov.info.p - protocol/configuration/ACLManager.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,17 +31,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -98,108 +98,108 @@
27 : : * @param provider The address of the PoolAddressesProvider
28 : : */
29 : : constructor(IPoolAddressesProvider provider) {
- 30 : : ADDRESSES_PROVIDER = provider;
- 31 : : address aclAdmin = provider.getACLAdmin();
- 32 : : require(aclAdmin != address(0), Errors.ACL_ADMIN_CANNOT_BE_ZERO);
- 33 : : _setupRole(DEFAULT_ADMIN_ROLE, aclAdmin);
+ 30 : 0 : ADDRESSES_PROVIDER = provider;
+ 31 : 0 : address aclAdmin = provider.getACLAdmin();
+ 32 : 0 : require(aclAdmin != address(0), Errors.ACL_ADMIN_CANNOT_BE_ZERO);
+ 33 : 0 : _setupRole(DEFAULT_ADMIN_ROLE, aclAdmin);
34 : : }
35 : :
36 : : /// @inheritdoc IACLManager
- 37 : 6 : function setRoleAdmin(
+ 37 : : function setRoleAdmin(
38 : : bytes32 role,
39 : : bytes32 adminRole
40 : : ) external override onlyRole(DEFAULT_ADMIN_ROLE) {
- 41 : 10 : _setRoleAdmin(role, adminRole);
+ 41 : 5 : _setRoleAdmin(role, adminRole);
42 : : }
43 : :
44 : : /// @inheritdoc IACLManager
- 45 : 1794 : function addPoolAdmin(address admin) external override {
- 46 : 3588 : grantRole(POOL_ADMIN_ROLE, admin);
+ 45 : : function addPoolAdmin(address admin) external override {
+ 46 : 2028 : grantRole(POOL_ADMIN_ROLE, admin);
47 : : }
48 : :
49 : : /// @inheritdoc IACLManager
- 50 : 1 : function removePoolAdmin(address admin) external override {
- 51 : 2 : revokeRole(POOL_ADMIN_ROLE, admin);
+ 50 : : function removePoolAdmin(address admin) external override {
+ 51 : 1 : revokeRole(POOL_ADMIN_ROLE, admin);
52 : : }
53 : :
54 : : /// @inheritdoc IACLManager
- 55 : 51690 : function isPoolAdmin(address admin) external view override returns (bool) {
- 56 : 155070 : return hasRole(POOL_ADMIN_ROLE, admin);
+ 55 : : function isPoolAdmin(address admin) external view override returns (bool) {
+ 56 : 140446 : return hasRole(POOL_ADMIN_ROLE, admin);
57 : : }
58 : :
59 : : /// @inheritdoc IACLManager
- 60 : 608 : function addEmergencyAdmin(address admin) external override {
- 61 : 1216 : grantRole(EMERGENCY_ADMIN_ROLE, admin);
+ 60 : : function addEmergencyAdmin(address admin) external override {
+ 61 : 683 : grantRole(EMERGENCY_ADMIN_ROLE, admin);
62 : : }
63 : :
64 : : /// @inheritdoc IACLManager
- 65 : 1 : function removeEmergencyAdmin(address admin) external override {
- 66 : 2 : revokeRole(EMERGENCY_ADMIN_ROLE, admin);
+ 65 : : function removeEmergencyAdmin(address admin) external override {
+ 66 : 1 : revokeRole(EMERGENCY_ADMIN_ROLE, admin);
67 : : }
68 : :
69 : : /// @inheritdoc IACLManager
- 70 : 10004 : function isEmergencyAdmin(address admin) external view override returns (bool) {
- 71 : 30012 : return hasRole(EMERGENCY_ADMIN_ROLE, admin);
+ 70 : : function isEmergencyAdmin(address admin) external view override returns (bool) {
+ 71 : 17013 : return hasRole(EMERGENCY_ADMIN_ROLE, admin);
72 : : }
73 : :
74 : : /// @inheritdoc IACLManager
- 75 : 14 : function addRiskAdmin(address admin) external override {
- 76 : 28 : grantRole(RISK_ADMIN_ROLE, admin);
+ 75 : : function addRiskAdmin(address admin) external override {
+ 76 : 14 : grantRole(RISK_ADMIN_ROLE, admin);
77 : : }
78 : :
79 : : /// @inheritdoc IACLManager
- 80 : 1 : function removeRiskAdmin(address admin) external override {
- 81 : 2 : revokeRole(RISK_ADMIN_ROLE, admin);
+ 80 : : function removeRiskAdmin(address admin) external override {
+ 81 : 1 : revokeRole(RISK_ADMIN_ROLE, admin);
82 : : }
83 : :
84 : : /// @inheritdoc IACLManager
- 85 : 25336 : function isRiskAdmin(address admin) external view override returns (bool) {
- 86 : 76008 : return hasRole(RISK_ADMIN_ROLE, admin);
+ 85 : : function isRiskAdmin(address admin) external view override returns (bool) {
+ 86 : 84695 : return hasRole(RISK_ADMIN_ROLE, admin);
87 : : }
88 : :
89 : : /// @inheritdoc IACLManager
- 90 : 4 : function addFlashBorrower(address borrower) external override {
- 91 : 8 : grantRole(FLASH_BORROWER_ROLE, borrower);
+ 90 : : function addFlashBorrower(address borrower) external override {
+ 91 : 4 : grantRole(FLASH_BORROWER_ROLE, borrower);
92 : : }
93 : :
94 : : /// @inheritdoc IACLManager
- 95 : 2 : function removeFlashBorrower(address borrower) external override {
- 96 : 4 : revokeRole(FLASH_BORROWER_ROLE, borrower);
+ 95 : : function removeFlashBorrower(address borrower) external override {
+ 96 : 2 : revokeRole(FLASH_BORROWER_ROLE, borrower);
97 : : }
98 : :
99 : : /// @inheritdoc IACLManager
- 100 : 11 : function isFlashBorrower(address borrower) external view override returns (bool) {
- 101 : 33 : return hasRole(FLASH_BORROWER_ROLE, borrower);
+ 100 : : function isFlashBorrower(address borrower) external view override returns (bool) {
+ 101 : 1012 : return hasRole(FLASH_BORROWER_ROLE, borrower);
102 : : }
103 : :
104 : : /// @inheritdoc IACLManager
- 105 : 14 : function addBridge(address bridge) external override {
- 106 : 28 : grantRole(BRIDGE_ROLE, bridge);
+ 105 : : function addBridge(address bridge) external override {
+ 106 : 14 : grantRole(BRIDGE_ROLE, bridge);
107 : : }
108 : :
109 : : /// @inheritdoc IACLManager
- 110 : 1 : function removeBridge(address bridge) external override {
- 111 : 2 : revokeRole(BRIDGE_ROLE, bridge);
+ 110 : : function removeBridge(address bridge) external override {
+ 111 : 1 : revokeRole(BRIDGE_ROLE, bridge);
112 : : }
113 : :
114 : : /// @inheritdoc IACLManager
- 115 : 26 : function isBridge(address bridge) external view override returns (bool) {
- 116 : 78 : return hasRole(BRIDGE_ROLE, bridge);
+ 115 : : function isBridge(address bridge) external view override returns (bool) {
+ 116 : 26 : return hasRole(BRIDGE_ROLE, bridge);
117 : : }
118 : :
119 : : /// @inheritdoc IACLManager
- 120 : 3 : function addAssetListingAdmin(address admin) external override {
- 121 : 6 : grantRole(ASSET_LISTING_ADMIN_ROLE, admin);
+ 120 : : function addAssetListingAdmin(address admin) external override {
+ 121 : 3 : grantRole(ASSET_LISTING_ADMIN_ROLE, admin);
122 : : }
123 : :
124 : : /// @inheritdoc IACLManager
- 125 : 2 : function removeAssetListingAdmin(address admin) external override {
- 126 : 4 : revokeRole(ASSET_LISTING_ADMIN_ROLE, admin);
+ 125 : : function removeAssetListingAdmin(address admin) external override {
+ 126 : 2 : revokeRole(ASSET_LISTING_ADMIN_ROLE, admin);
127 : : }
128 : :
129 : : /// @inheritdoc IACLManager
- 130 : 3188 : function isAssetListingAdmin(address admin) external view override returns (bool) {
- 131 : 9564 : return hasRole(ASSET_LISTING_ADMIN_ROLE, admin);
+ 130 : : function isAssetListingAdmin(address admin) external view override returns (bool) {
+ 131 : 10317 : return hasRole(ASSET_LISTING_ADMIN_ROLE, admin);
132 : : }
133 : : }
@@ -209,8 +209,8 @@
diff --git a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PoolAddressesProvider.sol.func-c.html b/report/protocol/configuration/PoolAddressesProvider.sol.func-c.html
similarity index 72%
rename from report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PoolAddressesProvider.sol.func-c.html
rename to report/protocol/configuration/PoolAddressesProvider.sol.func-c.html
index bd71f553..04404e4a 100644
--- a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PoolAddressesProvider.sol.func-c.html
+++ b/report/protocol/configuration/PoolAddressesProvider.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PoolAddressesProvider.sol - functions
-
+ LCOV - lcov.info.p - protocol/configuration/PoolAddressesProvider.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,175 +53,182 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../glass.png) |
- PoolAddressesProvider._setMarketId |
+ PoolAddressesProvider.setMarketId |
- 1 |
+ 2 |
- PoolAddressesProvider.setMarketId |
+ PoolAddressesProvider.getMarketId |
- 2 |
+ 6 |
PoolAddressesProvider.setAddress |
- 5 |
+ 6 |
- PoolAddressesProvider.getMarketId |
+ PoolAddressesProvider.setPriceOracleSentinel |
- 6 |
+ 21 |
- PoolAddressesProvider.setPriceOracleSentinel |
+ PoolAddressesProvider._setMarketId |
- 6 |
+ 446 |
PoolAddressesProvider.setACLManager |
- 609 |
+ 684 |
- PoolAddressesProvider.setPoolConfiguratorImpl |
+ PoolAddressesProvider.setAddressAsProxy |
- 609 |
+ 684 |
- PoolAddressesProvider.setPoolDataProvider |
+ PoolAddressesProvider.setPoolConfiguratorImpl |
- 609 |
+ 684 |
- PoolAddressesProvider.setPoolImpl |
+ PoolAddressesProvider.setPoolDataProvider |
- 609 |
+ 684 |
- PoolAddressesProvider.setPriceOracle |
+ PoolAddressesProvider.setPoolImpl |
- 609 |
+ 684 |
- PoolAddressesProvider.setAddressAsProxy |
+ PoolAddressesProvider.setPriceOracle |
- 610 |
+ 684 |
PoolAddressesProvider.getAddress |
- 613 |
+ 688 |
- PoolAddressesProvider.getACLAdmin |
+ PoolAddressesProvider. |
- 632 |
+ 1116 |
PoolAddressesProvider.setACLAdmin |
- 1234 |
+ 1384 |
- PoolAddressesProvider.getPoolDataProvider |
+ PoolAddressesProvider.getACLAdmin |
- 1783 |
+ 1711 |
PoolAddressesProvider._getProxyImplementation |
- 1824 |
+ 2048 |
PoolAddressesProvider._updateImpl |
- 1824 |
+ 2048 |
- PoolAddressesProvider.getPriceOracleSentinel |
+ PoolAddressesProvider.getPoolDataProvider |
- 20415 |
+ 3034 |
- PoolAddressesProvider.getPool |
+ PoolAddressesProvider.getPriceOracleSentinel |
- 21433 |
+ 30644 |
PoolAddressesProvider.getPriceOracle |
- 24761 |
+ 71014 |
PoolAddressesProvider.getACLManager |
- 46744 |
+ 119508 |
+
+
+
+
+ PoolAddressesProvider.getPool |
+
+ 165196 |
PoolAddressesProvider.getPoolConfigurator |
- 106989 |
+ 649253 |
@@ -229,8 +236,8 @@
diff --git a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PoolAddressesProvider.sol.func.html b/report/protocol/configuration/PoolAddressesProvider.sol.func.html
similarity index 72%
rename from report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PoolAddressesProvider.sol.func.html
rename to report/protocol/configuration/PoolAddressesProvider.sol.func.html
index 605822fa..a5f4ebac 100644
--- a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PoolAddressesProvider.sol.func.html
+++ b/report/protocol/configuration/PoolAddressesProvider.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PoolAddressesProvider.sol - functions
-
+ LCOV - lcov.info.p - protocol/configuration/PoolAddressesProvider.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,63 +53,70 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../updown.png) |
+
+
+
+
+ PoolAddressesProvider. |
+
+ 1116 |
PoolAddressesProvider._getProxyImplementation |
- 1824 |
+ 2048 |
PoolAddressesProvider._setMarketId |
- 1 |
+ 446 |
PoolAddressesProvider._updateImpl |
- 1824 |
+ 2048 |
PoolAddressesProvider.getACLAdmin |
- 632 |
+ 1711 |
PoolAddressesProvider.getACLManager |
- 46744 |
+ 119508 |
PoolAddressesProvider.getAddress |
- 613 |
+ 688 |
@@ -123,63 +130,63 @@
PoolAddressesProvider.getPool |
- 21433 |
+ 165196 |
PoolAddressesProvider.getPoolConfigurator |
- 106989 |
+ 649253 |
PoolAddressesProvider.getPoolDataProvider |
- 1783 |
+ 3034 |
PoolAddressesProvider.getPriceOracle |
- 24761 |
+ 71014 |
PoolAddressesProvider.getPriceOracleSentinel |
- 20415 |
+ 30644 |
PoolAddressesProvider.setACLAdmin |
- 1234 |
+ 1384 |
PoolAddressesProvider.setACLManager |
- 609 |
+ 684 |
PoolAddressesProvider.setAddress |
- 5 |
+ 6 |
PoolAddressesProvider.setAddressAsProxy |
- 610 |
+ 684 |
@@ -193,35 +200,35 @@
PoolAddressesProvider.setPoolConfiguratorImpl |
- 609 |
+ 684 |
PoolAddressesProvider.setPoolDataProvider |
- 609 |
+ 684 |
PoolAddressesProvider.setPoolImpl |
- 609 |
+ 684 |
PoolAddressesProvider.setPriceOracle |
- 609 |
+ 684 |
PoolAddressesProvider.setPriceOracleSentinel |
- 6 |
+ 21 |
@@ -229,8 +236,8 @@
diff --git a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PoolAddressesProvider.sol.gcov.html b/report/protocol/configuration/PoolAddressesProvider.sol.gcov.html
similarity index 75%
rename from report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PoolAddressesProvider.sol.gcov.html
rename to report/protocol/configuration/PoolAddressesProvider.sol.gcov.html
index 6cab0271..d8d491d9 100644
--- a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PoolAddressesProvider.sol.gcov.html
+++ b/report/protocol/configuration/PoolAddressesProvider.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PoolAddressesProvider.sol
-
+ LCOV - lcov.info.p - protocol/configuration/PoolAddressesProvider.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -74,7 +74,7 @@
3 : :
4 : : import {Ownable} from '../../dependencies/openzeppelin/contracts/Ownable.sol';
5 : : import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
- 6 : : import {InitializableImmutableAdminUpgradeabilityProxy} from '../libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol';
+ 6 : : import {InitializableImmutableAdminUpgradeabilityProxy} from '../../misc/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol';
7 : :
8 : : /**
9 : : * @title PoolAddressesProvider
@@ -105,125 +105,125 @@
34 : : * @param owner The owner address of this contract.
35 : : */
36 : : constructor(string memory marketId, address owner) {
- 37 : : _setMarketId(marketId);
- 38 : : transferOwnership(owner);
+ 37 : 419 : _setMarketId(marketId);
+ 38 : 627 : transferOwnership(owner);
39 : : }
40 : :
41 : : /// @inheritdoc IPoolAddressesProvider
- 42 : 6 : function getMarketId() external view override returns (string memory) {
- 43 : 12 : return _marketId;
+ 42 : : function getMarketId() external view override returns (string memory) {
+ 43 : 6 : return _marketId;
44 : : }
45 : :
46 : : /// @inheritdoc IPoolAddressesProvider
- 47 : 2 : function setMarketId(string memory newMarketId) external override onlyOwner {
- 48 : 2 : _setMarketId(newMarketId);
+ 47 : : function setMarketId(string memory newMarketId) external override onlyOwner {
+ 48 : 1 : _setMarketId(newMarketId);
49 : : }
50 : :
51 : : /// @inheritdoc IPoolAddressesProvider
- 52 : 613 : function getAddress(bytes32 id) public view override returns (address) {
- 53 : 446740 : return _addresses[id];
+ 52 : : function getAddress(bytes32 id) public view override returns (address) {
+ 53 : 1041048 : return _addresses[id];
54 : : }
55 : :
56 : : /// @inheritdoc IPoolAddressesProvider
- 57 : 5 : function setAddress(bytes32 id, address newAddress) external override onlyOwner {
- 58 : 6 : address oldAddress = _addresses[id];
- 59 : 6 : _addresses[id] = newAddress;
- 60 : 6 : emit AddressSet(id, oldAddress, newAddress);
+ 57 : : function setAddress(bytes32 id, address newAddress) external override onlyOwner {
+ 58 : 4 : address oldAddress = _addresses[id];
+ 59 : 4 : _addresses[id] = newAddress;
+ 60 : 4 : emit AddressSet(id, oldAddress, newAddress);
61 : : }
62 : :
63 : : /// @inheritdoc IPoolAddressesProvider
- 64 : 610 : function setAddressAsProxy(
+ 64 : : function setAddressAsProxy(
65 : : bytes32 id,
66 : : address newImplementationAddress
67 : : ) external override onlyOwner {
- 68 : 1216 : address proxyAddress = _addresses[id];
- 69 : 1824 : address oldImplementationAddress = _getProxyImplementation(id);
- 70 : 1216 : _updateImpl(id, newImplementationAddress);
- 71 : 1216 : emit AddressSetAsProxy(id, proxyAddress, oldImplementationAddress, newImplementationAddress);
+ 68 : 682 : address proxyAddress = _addresses[id];
+ 69 : 682 : address oldImplementationAddress = _getProxyImplementation(id);
+ 70 : 682 : _updateImpl(id, newImplementationAddress);
+ 71 : 682 : emit AddressSetAsProxy(id, proxyAddress, oldImplementationAddress, newImplementationAddress);
72 : : }
73 : :
74 : : /// @inheritdoc IPoolAddressesProvider
- 75 : 21433 : function getPool() external view override returns (address) {
- 76 : 64299 : return getAddress(POOL);
+ 75 : : function getPool() external view override returns (address) {
+ 76 : 165196 : return getAddress(POOL);
77 : : }
78 : :
79 : : /// @inheritdoc IPoolAddressesProvider
- 80 : 609 : function setPoolImpl(address newPoolImpl) external override onlyOwner {
- 81 : 1824 : address oldPoolImpl = _getProxyImplementation(POOL);
- 82 : 1216 : _updateImpl(POOL, newPoolImpl);
- 83 : 1216 : emit PoolUpdated(oldPoolImpl, newPoolImpl);
+ 80 : : function setPoolImpl(address newPoolImpl) external override onlyOwner {
+ 81 : 683 : address oldPoolImpl = _getProxyImplementation(POOL);
+ 82 : 683 : _updateImpl(POOL, newPoolImpl);
+ 83 : 683 : emit PoolUpdated(oldPoolImpl, newPoolImpl);
84 : : }
85 : :
86 : : /// @inheritdoc IPoolAddressesProvider
- 87 : 106989 : function getPoolConfigurator() external view override returns (address) {
- 88 : 320967 : return getAddress(POOL_CONFIGURATOR);
+ 87 : : function getPoolConfigurator() external view override returns (address) {
+ 88 : 649253 : return getAddress(POOL_CONFIGURATOR);
89 : : }
90 : :
91 : : /// @inheritdoc IPoolAddressesProvider
- 92 : 609 : function setPoolConfiguratorImpl(address newPoolConfiguratorImpl) external override onlyOwner {
- 93 : 1824 : address oldPoolConfiguratorImpl = _getProxyImplementation(POOL_CONFIGURATOR);
- 94 : 1216 : _updateImpl(POOL_CONFIGURATOR, newPoolConfiguratorImpl);
- 95 : 1216 : emit PoolConfiguratorUpdated(oldPoolConfiguratorImpl, newPoolConfiguratorImpl);
+ 92 : : function setPoolConfiguratorImpl(address newPoolConfiguratorImpl) external override onlyOwner {
+ 93 : 683 : address oldPoolConfiguratorImpl = _getProxyImplementation(POOL_CONFIGURATOR);
+ 94 : 683 : _updateImpl(POOL_CONFIGURATOR, newPoolConfiguratorImpl);
+ 95 : 683 : emit PoolConfiguratorUpdated(oldPoolConfiguratorImpl, newPoolConfiguratorImpl);
96 : : }
97 : :
98 : : /// @inheritdoc IPoolAddressesProvider
- 99 : 24761 : function getPriceOracle() external view override returns (address) {
- 100 : 74283 : return getAddress(PRICE_ORACLE);
+ 99 : : function getPriceOracle() external view override returns (address) {
+ 100 : 71014 : return getAddress(PRICE_ORACLE);
101 : : }
102 : :
103 : : /// @inheritdoc IPoolAddressesProvider
- 104 : 609 : function setPriceOracle(address newPriceOracle) external override onlyOwner {
- 105 : 1216 : address oldPriceOracle = _addresses[PRICE_ORACLE];
- 106 : 1216 : _addresses[PRICE_ORACLE] = newPriceOracle;
- 107 : 1216 : emit PriceOracleUpdated(oldPriceOracle, newPriceOracle);
+ 104 : : function setPriceOracle(address newPriceOracle) external override onlyOwner {
+ 105 : 683 : address oldPriceOracle = _addresses[PRICE_ORACLE];
+ 106 : 683 : _addresses[PRICE_ORACLE] = newPriceOracle;
+ 107 : 683 : emit PriceOracleUpdated(oldPriceOracle, newPriceOracle);
108 : : }
109 : :
110 : : /// @inheritdoc IPoolAddressesProvider
- 111 : 46744 : function getACLManager() external view override returns (address) {
- 112 : 140232 : return getAddress(ACL_MANAGER);
+ 111 : : function getACLManager() external view override returns (address) {
+ 112 : 119508 : return getAddress(ACL_MANAGER);
113 : : }
114 : :
115 : : /// @inheritdoc IPoolAddressesProvider
- 116 : 609 : function setACLManager(address newAclManager) external override onlyOwner {
- 117 : 1216 : address oldAclManager = _addresses[ACL_MANAGER];
- 118 : 1216 : _addresses[ACL_MANAGER] = newAclManager;
- 119 : 1216 : emit ACLManagerUpdated(oldAclManager, newAclManager);
+ 116 : : function setACLManager(address newAclManager) external override onlyOwner {
+ 117 : 683 : address oldAclManager = _addresses[ACL_MANAGER];
+ 118 : 683 : _addresses[ACL_MANAGER] = newAclManager;
+ 119 : 683 : emit ACLManagerUpdated(oldAclManager, newAclManager);
120 : : }
121 : :
122 : : /// @inheritdoc IPoolAddressesProvider
- 123 : 632 : function getACLAdmin() external view override returns (address) {
- 124 : 1896 : return getAddress(ACL_ADMIN);
+ 123 : : function getACLAdmin() external view override returns (address) {
+ 124 : 1711 : return getAddress(ACL_ADMIN);
125 : : }
126 : :
127 : : /// @inheritdoc IPoolAddressesProvider
- 128 : 1234 : function setACLAdmin(address newAclAdmin) external override onlyOwner {
- 129 : 2466 : address oldAclAdmin = _addresses[ACL_ADMIN];
- 130 : 2466 : _addresses[ACL_ADMIN] = newAclAdmin;
- 131 : 2466 : emit ACLAdminUpdated(oldAclAdmin, newAclAdmin);
+ 128 : : function setACLAdmin(address newAclAdmin) external override onlyOwner {
+ 129 : 1383 : address oldAclAdmin = _addresses[ACL_ADMIN];
+ 130 : 1383 : _addresses[ACL_ADMIN] = newAclAdmin;
+ 131 : 1383 : emit ACLAdminUpdated(oldAclAdmin, newAclAdmin);
132 : : }
133 : :
134 : : /// @inheritdoc IPoolAddressesProvider
- 135 : 20415 : function getPriceOracleSentinel() external view override returns (address) {
- 136 : 61245 : return getAddress(PRICE_ORACLE_SENTINEL);
+ 135 : : function getPriceOracleSentinel() external view override returns (address) {
+ 136 : 30644 : return getAddress(PRICE_ORACLE_SENTINEL);
137 : : }
138 : :
139 : : /// @inheritdoc IPoolAddressesProvider
- 140 : 6 : function setPriceOracleSentinel(address newPriceOracleSentinel) external override onlyOwner {
- 141 : 10 : address oldPriceOracleSentinel = _addresses[PRICE_ORACLE_SENTINEL];
- 142 : 10 : _addresses[PRICE_ORACLE_SENTINEL] = newPriceOracleSentinel;
- 143 : 10 : emit PriceOracleSentinelUpdated(oldPriceOracleSentinel, newPriceOracleSentinel);
+ 140 : : function setPriceOracleSentinel(address newPriceOracleSentinel) external override onlyOwner {
+ 141 : 20 : address oldPriceOracleSentinel = _addresses[PRICE_ORACLE_SENTINEL];
+ 142 : 20 : _addresses[PRICE_ORACLE_SENTINEL] = newPriceOracleSentinel;
+ 143 : 20 : emit PriceOracleSentinelUpdated(oldPriceOracleSentinel, newPriceOracleSentinel);
144 : : }
145 : :
146 : : /// @inheritdoc IPoolAddressesProvider
- 147 : 1783 : function getPoolDataProvider() external view override returns (address) {
- 148 : 5349 : return getAddress(DATA_PROVIDER);
+ 147 : : function getPoolDataProvider() external view override returns (address) {
+ 148 : 3034 : return getAddress(DATA_PROVIDER);
149 : : }
150 : :
151 : : /// @inheritdoc IPoolAddressesProvider
- 152 : 609 : function setPoolDataProvider(address newDataProvider) external override onlyOwner {
- 153 : 1216 : address oldDataProvider = _addresses[DATA_PROVIDER];
- 154 : 1216 : _addresses[DATA_PROVIDER] = newDataProvider;
- 155 : 1216 : emit PoolDataProviderUpdated(oldDataProvider, newDataProvider);
+ 152 : : function setPoolDataProvider(address newDataProvider) external override onlyOwner {
+ 153 : 683 : address oldDataProvider = _addresses[DATA_PROVIDER];
+ 154 : 683 : _addresses[DATA_PROVIDER] = newDataProvider;
+ 155 : 683 : emit PoolDataProviderUpdated(oldDataProvider, newDataProvider);
156 : : }
157 : :
158 : : /**
@@ -235,19 +235,19 @@
164 : : * @param id The id of the proxy to be updated
165 : : * @param newAddress The address of the new implementation
166 : : */
- 167 : 1824 : function _updateImpl(bytes32 id, address newAddress) internal {
- 168 : 3648 : address proxyAddress = _addresses[id];
- 169 : 3648 : InitializableImmutableAdminUpgradeabilityProxy proxy;
- 170 : 5472 : bytes memory params = abi.encodeWithSignature('initialize(address)', address(this));
+ 167 : : function _updateImpl(bytes32 id, address newAddress) internal {
+ 168 : 2048 : address proxyAddress = _addresses[id];
+ 169 : 2048 : InitializableImmutableAdminUpgradeabilityProxy proxy;
+ 170 : 2048 : bytes memory params = abi.encodeWithSignature('initialize(address)', address(this));
171 : :
- 172 : 5472 : if (proxyAddress == address(0)) {
- 173 : 3642 : proxy = new InitializableImmutableAdminUpgradeabilityProxy(address(this));
- 174 : 3642 : _addresses[id] = proxyAddress = address(proxy);
- 175 : 3642 : proxy.initialize(newAddress, params);
- 176 : 3642 : emit ProxyCreated(id, proxyAddress, newAddress);
+ 172 : 2048 : if (proxyAddress == address(0)) {
+ 173 : 2045 : proxy = new InitializableImmutableAdminUpgradeabilityProxy(address(this));
+ 174 : 2045 : _addresses[id] = proxyAddress = address(proxy);
+ 175 : 2045 : proxy.initialize(newAddress, params);
+ 176 : 2045 : emit ProxyCreated(id, proxyAddress, newAddress);
177 : : } else {
- 178 : 6 : proxy = InitializableImmutableAdminUpgradeabilityProxy(payable(proxyAddress));
- 179 : 6 : proxy.upgradeToAndCall(newAddress, params);
+ 178 : 3 : proxy = InitializableImmutableAdminUpgradeabilityProxy(payable(proxyAddress));
+ 179 : 3 : proxy.upgradeToAndCall(newAddress, params);
180 : : }
181 : : }
182 : :
@@ -255,10 +255,10 @@
184 : : * @notice Updates the identifier of the Aave market.
185 : : * @param newMarketId The new id of the market
186 : : */
- 187 : 1 : function _setMarketId(string memory newMarketId) internal {
- 188 : 2 : string memory oldMarketId = _marketId;
- 189 : 2 : _marketId = newMarketId;
- 190 : 2 : emit MarketIdSet(oldMarketId, newMarketId);
+ 187 : : function _setMarketId(string memory newMarketId) internal {
+ 188 : 380 : string memory oldMarketId = _marketId;
+ 189 : 377 : _marketId = newMarketId;
+ 190 : 265 : emit MarketIdSet(oldMarketId, newMarketId);
191 : : }
192 : :
193 : : /**
@@ -268,13 +268,13 @@
197 : : * @param id The id
198 : : * @return The address of the implementation contract
199 : : */
- 200 : 1824 : function _getProxyImplementation(bytes32 id) internal returns (address) {
- 201 : 3648 : address proxyAddress = _addresses[id];
- 202 : 5472 : if (proxyAddress == address(0)) {
- 203 : 5463 : return address(0);
+ 200 : : function _getProxyImplementation(bytes32 id) internal returns (address) {
+ 201 : 2048 : address proxyAddress = _addresses[id];
+ 202 : 2048 : if (proxyAddress == address(0)) {
+ 203 : 2045 : return address(0);
204 : : } else {
- 205 : 9 : address payable payableProxyAddress = payable(proxyAddress);
- 206 : 9 : return InitializableImmutableAdminUpgradeabilityProxy(payableProxyAddress).implementation();
+ 205 : 3 : address payable payableProxyAddress = payable(proxyAddress);
+ 206 : 3 : return InitializableImmutableAdminUpgradeabilityProxy(payableProxyAddress).implementation();
207 : : }
208 : : }
209 : : }
@@ -285,8 +285,8 @@
diff --git a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PoolAddressesProviderRegistry.sol.func-c.html b/report/protocol/configuration/PoolAddressesProviderRegistry.sol.func-c.html
similarity index 69%
rename from report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PoolAddressesProviderRegistry.sol.func-c.html
rename to report/protocol/configuration/PoolAddressesProviderRegistry.sol.func-c.html
index 699162a0..053a501b 100644
--- a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PoolAddressesProviderRegistry.sol.func-c.html
+++ b/report/protocol/configuration/PoolAddressesProviderRegistry.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PoolAddressesProviderRegistry.sol - functions
-
+ LCOV - lcov.info.p - protocol/configuration/PoolAddressesProviderRegistry.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,17 +31,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
@@ -53,21 +53,28 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../updown.png) |
+
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../glass.png) |
+
+
+
+
+ PoolAddressesProviderRegistry. |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../glass.png) |
+ 0 |
@@ -109,14 +116,14 @@
PoolAddressesProviderRegistry._addToAddressesProvidersList |
- 628 |
+ 710 |
PoolAddressesProviderRegistry.registerAddressesProvider |
- 629 |
+ 711 |
@@ -124,8 +131,8 @@
diff --git a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PoolAddressesProviderRegistry.sol.func.html b/report/protocol/configuration/PoolAddressesProviderRegistry.sol.func.html
similarity index 69%
rename from report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PoolAddressesProviderRegistry.sol.func.html
rename to report/protocol/configuration/PoolAddressesProviderRegistry.sol.func.html
index f7e1688d..c2a87e04 100644
--- a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PoolAddressesProviderRegistry.sol.func.html
+++ b/report/protocol/configuration/PoolAddressesProviderRegistry.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PoolAddressesProviderRegistry.sol - functions
-
+ LCOV - lcov.info.p - protocol/configuration/PoolAddressesProviderRegistry.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,17 +31,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
@@ -53,28 +53,35 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../glass.png) |
+
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../updown.png) |
+
+
+
+
+ PoolAddressesProviderRegistry. |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../updown.png) |
+ 0 |
PoolAddressesProviderRegistry._addToAddressesProvidersList |
- 628 |
+ 710 |
@@ -109,7 +116,7 @@
PoolAddressesProviderRegistry.registerAddressesProvider |
- 629 |
+ 711 |
@@ -124,8 +131,8 @@
diff --git a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PoolAddressesProviderRegistry.sol.gcov.html b/report/protocol/configuration/PoolAddressesProviderRegistry.sol.gcov.html
similarity index 77%
rename from report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PoolAddressesProviderRegistry.sol.gcov.html
rename to report/protocol/configuration/PoolAddressesProviderRegistry.sol.gcov.html
index 2addb373..acb39b7e 100644
--- a/report/core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PoolAddressesProviderRegistry.sol.gcov.html
+++ b/report/protocol/configuration/PoolAddressesProviderRegistry.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/configuration/src/core/contracts/protocol/configuration/PoolAddressesProviderRegistry.sol
-
+ LCOV - lcov.info.p - protocol/configuration/PoolAddressesProviderRegistry.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,17 +31,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -98,77 +98,77 @@
27 : : * @param owner The owner address of this contract.
28 : : */
29 : : constructor(address owner) {
- 30 : : transferOwnership(owner);
+ 30 : 0 : transferOwnership(owner);
31 : : }
32 : :
33 : : /// @inheritdoc IPoolAddressesProviderRegistry
- 34 : 5 : function getAddressesProvidersList() external view override returns (address[] memory) {
- 35 : 10 : return _addressesProvidersList;
+ 34 : : function getAddressesProvidersList() external view override returns (address[] memory) {
+ 35 : 5 : return _addressesProvidersList;
36 : : }
37 : :
38 : : /// @inheritdoc IPoolAddressesProviderRegistry
- 39 : 629 : function registerAddressesProvider(address provider, uint256 id) external override onlyOwner {
- 40 : 1258 : require(id != 0, Errors.INVALID_ADDRESSES_PROVIDER_ID);
- 41 : 1256 : require(_idToAddressesProvider[id] == address(0), Errors.INVALID_ADDRESSES_PROVIDER_ID);
- 42 : 1256 : require(_addressesProviderToId[provider] == 0, Errors.ADDRESSES_PROVIDER_ALREADY_ADDED);
+ 39 : : function registerAddressesProvider(address provider, uint256 id) external override onlyOwner {
+ 40 : 711 : require(id != 0, Errors.INVALID_ADDRESSES_PROVIDER_ID);
+ 41 : 710 : require(_idToAddressesProvider[id] == address(0), Errors.INVALID_ADDRESSES_PROVIDER_ID);
+ 42 : 710 : require(_addressesProviderToId[provider] == 0, Errors.ADDRESSES_PROVIDER_ALREADY_ADDED);
43 : :
- 44 : 1256 : _addressesProviderToId[provider] = id;
- 45 : 1256 : _idToAddressesProvider[id] = provider;
+ 44 : 710 : _addressesProviderToId[provider] = id;
+ 45 : 710 : _idToAddressesProvider[id] = provider;
46 : :
- 47 : 1256 : _addToAddressesProvidersList(provider);
- 48 : 1256 : emit AddressesProviderRegistered(provider, id);
+ 47 : 710 : _addToAddressesProvidersList(provider);
+ 48 : 710 : emit AddressesProviderRegistered(provider, id);
49 : : }
50 : :
51 : : /// @inheritdoc IPoolAddressesProviderRegistry
- 52 : 4 : function unregisterAddressesProvider(address provider) external override onlyOwner {
- 53 : 8 : require(_addressesProviderToId[provider] != 0, Errors.ADDRESSES_PROVIDER_NOT_REGISTERED);
- 54 : 6 : uint256 oldId = _addressesProviderToId[provider];
- 55 : 6 : _idToAddressesProvider[oldId] = address(0);
- 56 : 6 : _addressesProviderToId[provider] = 0;
+ 52 : : function unregisterAddressesProvider(address provider) external override onlyOwner {
+ 53 : 4 : require(_addressesProviderToId[provider] != 0, Errors.ADDRESSES_PROVIDER_NOT_REGISTERED);
+ 54 : 3 : uint256 oldId = _addressesProviderToId[provider];
+ 55 : 3 : _idToAddressesProvider[oldId] = address(0);
+ 56 : 3 : _addressesProviderToId[provider] = 0;
57 : :
- 58 : 6 : _removeFromAddressesProvidersList(provider);
+ 58 : 3 : _removeFromAddressesProvidersList(provider);
59 : :
- 60 : 6 : emit AddressesProviderUnregistered(provider, oldId);
+ 60 : 3 : emit AddressesProviderUnregistered(provider, oldId);
61 : : }
62 : :
63 : : /// @inheritdoc IPoolAddressesProviderRegistry
- 64 : 6 : function getAddressesProviderIdByAddress(
+ 64 : : function getAddressesProviderIdByAddress(
65 : : address addressesProvider
66 : : ) external view override returns (uint256) {
- 67 : 12 : return _addressesProviderToId[addressesProvider];
+ 67 : 6 : return _addressesProviderToId[addressesProvider];
68 : : }
69 : :
70 : : /// @inheritdoc IPoolAddressesProviderRegistry
- 71 : 4 : function getAddressesProviderAddressById(uint256 id) external view override returns (address) {
- 72 : 8 : return _idToAddressesProvider[id];
+ 71 : : function getAddressesProviderAddressById(uint256 id) external view override returns (address) {
+ 72 : 4 : return _idToAddressesProvider[id];
73 : : }
74 : :
75 : : /**
76 : : * @notice Adds the addresses provider address to the list.
77 : : * @param provider The address of the PoolAddressesProvider
78 : : */
- 79 : 628 : function _addToAddressesProvidersList(address provider) internal {
- 80 : 1256 : _addressesProvidersIndexes[provider] = _addressesProvidersList.length;
- 81 : 1256 : _addressesProvidersList.push(provider);
+ 79 : : function _addToAddressesProvidersList(address provider) internal {
+ 80 : 710 : _addressesProvidersIndexes[provider] = _addressesProvidersList.length;
+ 81 : 710 : _addressesProvidersList.push(provider);
82 : : }
83 : :
84 : : /**
85 : : * @notice Removes the addresses provider address from the list.
86 : : * @param provider The address of the PoolAddressesProvider
87 : : */
- 88 : 3 : function _removeFromAddressesProvidersList(address provider) internal {
- 89 : 6 : uint256 index = _addressesProvidersIndexes[provider];
+ 88 : : function _removeFromAddressesProvidersList(address provider) internal {
+ 89 : 3 : uint256 index = _addressesProvidersIndexes[provider];
90 : :
- 91 : 6 : _addressesProvidersIndexes[provider] = 0;
+ 91 : 3 : _addressesProvidersIndexes[provider] = 0;
92 : :
93 : : // Swap the index of the last addresses provider in the list with the index of the provider to remove
- 94 : 9 : uint256 lastIndex = _addressesProvidersList.length - 1;
- 95 : 6 : if (index < lastIndex) {
- 96 : 2 : address lastProvider = _addressesProvidersList[lastIndex];
- 97 : 2 : _addressesProvidersList[index] = lastProvider;
- 98 : 2 : _addressesProvidersIndexes[lastProvider] = index;
+ 94 : 3 : uint256 lastIndex = _addressesProvidersList.length - 1;
+ 95 : 3 : if (index < lastIndex) {
+ 96 : 1 : address lastProvider = _addressesProvidersList[lastIndex];
+ 97 : 1 : _addressesProvidersList[index] = lastProvider;
+ 98 : 1 : _addressesProvidersIndexes[lastProvider] = index;
99 : : }
- 100 : 6 : _addressesProvidersList.pop();
+ 100 : 3 : _addressesProvidersList.pop();
101 : : }
102 : : }
@@ -178,8 +178,8 @@
diff --git a/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/index-sort-b.html b/report/protocol/configuration/index-sort-b.html
similarity index 53%
rename from report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/index-sort-b.html
rename to report/protocol/configuration/index-sort-b.html
index ab2df64c..984082d6 100644
--- a/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/index-sort-b.html
+++ b/report/protocol/configuration/index-sort-b.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization
-
+ LCOV - lcov.info.p - protocol/configuration
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../glass.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../glass.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../updown.png) |
Rate |
@@ -96,57 +96,57 @@
Hit |
- AToken.sol |
+ ACLManager.sol |
-
+
|
- 100.0 % |
- 37 |
- 37 |
+ 82.6 % |
+ 23 |
+ 19 |
- |
|
|
- 100.0 % |
- 16 |
- 16 |
+ 95.0 % |
+ 20 |
+ 19 |
- StableDebtToken.sol |
+ PoolAddressesProvider.sol |
-
+
|
- 63.2 % |
- 19 |
- 12 |
+ 100.0 % |
+ 58 |
+ 58 |
- |
|
|
100.0 % |
- 19 |
- 19 |
+ 23 |
+ 23 |
- VariableDebtToken.sol |
+ PoolAddressesProviderRegistry.sol |
-
+
|
- 100.0 % |
- 18 |
- 18 |
+ 96.3 % |
+ 27 |
+ 26 |
- |
|
|
- 100.0 % |
- 12 |
- 12 |
+ 87.5 % |
+ 8 |
+ 7 |
diff --git a/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/index-sort-f.html b/report/protocol/configuration/index-sort-f.html
similarity index 53%
rename from report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/index-sort-f.html
rename to report/protocol/configuration/index-sort-f.html
index 292c8f20..3a7ac3a3 100644
--- a/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/index-sort-f.html
+++ b/report/protocol/configuration/index-sort-f.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization
-
+ LCOV - lcov.info.p - protocol/configuration
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../glass.png) |
+ File ![Click to sort table by file name Sort by file name](../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../glass.png) |
Rate |
@@ -96,57 +96,57 @@
Hit |
- VariableDebtToken.sol |
+ PoolAddressesProviderRegistry.sol |
-
+
|
- 100.0 % |
- 18 |
- 18 |
+ 96.3 % |
+ 27 |
+ 26 |
- |
|
|
- 100.0 % |
- 12 |
- 12 |
+ 87.5 % |
+ 8 |
+ 7 |
- AToken.sol |
+ ACLManager.sol |
-
+
|
- 100.0 % |
- 37 |
- 37 |
+ 82.6 % |
+ 23 |
+ 19 |
- |
|
|
- 100.0 % |
- 16 |
- 16 |
+ 95.0 % |
+ 20 |
+ 19 |
- StableDebtToken.sol |
+ PoolAddressesProvider.sol |
-
+
|
- 63.2 % |
- 19 |
- 12 |
+ 100.0 % |
+ 58 |
+ 58 |
- |
|
|
100.0 % |
- 19 |
- 19 |
+ 23 |
+ 23 |
diff --git a/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/index-sort-l.html b/report/protocol/configuration/index-sort-l.html
similarity index 53%
rename from report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/index-sort-l.html
rename to report/protocol/configuration/index-sort-l.html
index 8e982fdb..af67b94b 100644
--- a/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/index-sort-l.html
+++ b/report/protocol/configuration/index-sort-l.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization
-
+ LCOV - lcov.info.p - protocol/configuration
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../glass.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../glass.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../updown.png) |
Rate |
@@ -96,57 +96,57 @@
Hit |
- StableDebtToken.sol |
+ ACLManager.sol |
-
+
|
- 63.2 % |
+ 82.6 % |
+ 23 |
19 |
- 12 |
- |
|
|
- 100.0 % |
- 19 |
+ 95.0 % |
+ 20 |
19 |
- VariableDebtToken.sol |
+ PoolAddressesProviderRegistry.sol |
-
+
|
- 100.0 % |
- 18 |
- 18 |
+ 96.3 % |
+ 27 |
+ 26 |
- |
|
|
- 100.0 % |
- 12 |
- 12 |
+ 87.5 % |
+ 8 |
+ 7 |
- AToken.sol |
+ PoolAddressesProvider.sol |
-
+
|
100.0 % |
- 37 |
- 37 |
+ 58 |
+ 58 |
- |
|
|
100.0 % |
- 16 |
- 16 |
+ 23 |
+ 23 |
diff --git a/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/index.html b/report/protocol/configuration/index.html
similarity index 53%
rename from report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/index.html
rename to report/protocol/configuration/index.html
index 8353c61b..7c2000b3 100644
--- a/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/index.html
+++ b/report/protocol/configuration/index.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization
-
+ LCOV - lcov.info.p - protocol/configuration
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../glass.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../../glass.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../updown.png) |
Rate |
@@ -96,57 +96,57 @@
Hit |
- AToken.sol |
+ ACLManager.sol |
-
+
|
- 100.0 % |
- 37 |
- 37 |
+ 82.6 % |
+ 23 |
+ 19 |
- |
|
|
- 100.0 % |
- 16 |
- 16 |
+ 95.0 % |
+ 20 |
+ 19 |
- StableDebtToken.sol |
+ PoolAddressesProvider.sol |
-
+
|
- 63.2 % |
- 19 |
- 12 |
+ 100.0 % |
+ 58 |
+ 58 |
- |
|
|
100.0 % |
- 19 |
- 19 |
+ 23 |
+ 23 |
- VariableDebtToken.sol |
+ PoolAddressesProviderRegistry.sol |
-
+
|
- 100.0 % |
- 18 |
- 18 |
+ 96.3 % |
+ 27 |
+ 26 |
- |
|
|
- 100.0 % |
- 12 |
- 12 |
+ 87.5 % |
+ 8 |
+ 7 |
diff --git a/report/protocol/libraries/logic/BorrowLogic.sol.func-c.html b/report/protocol/libraries/logic/BorrowLogic.sol.func-c.html
new file mode 100644
index 00000000..84a67cc3
--- /dev/null
+++ b/report/protocol/libraries/logic/BorrowLogic.sol.func-c.html
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - protocol/libraries/logic/BorrowLogic.sol - functions
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../../glass.png) |
+
+ |
+
+
+ ![](../../../glass.png) |
+
+
+
+
+
+
+
+
+
+
+
diff --git a/report/protocol/libraries/logic/BorrowLogic.sol.func.html b/report/protocol/libraries/logic/BorrowLogic.sol.func.html
new file mode 100644
index 00000000..bb80c94e
--- /dev/null
+++ b/report/protocol/libraries/logic/BorrowLogic.sol.func.html
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - protocol/libraries/logic/BorrowLogic.sol - functions
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../../glass.png) |
+
+ |
+
+
+ ![](../../../glass.png) |
+
+
+
+
+
+
+
+
+
+
+
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/BorrowLogic.sol.gcov.html b/report/protocol/libraries/logic/BorrowLogic.sol.gcov.html
similarity index 56%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/BorrowLogic.sol.gcov.html
rename to report/protocol/libraries/logic/BorrowLogic.sol.gcov.html
index dc79b92f..ef740d79 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/BorrowLogic.sol.gcov.html
+++ b/report/protocol/libraries/logic/BorrowLogic.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/BorrowLogic.sol
-
+ LCOV - lcov.info.p - protocol/libraries/logic/BorrowLogic.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -75,357 +75,234 @@
4 : : import {GPv2SafeERC20} from '../../../dependencies/gnosis/contracts/GPv2SafeERC20.sol';
5 : : import {SafeCast} from '../../../dependencies/openzeppelin/contracts/SafeCast.sol';
6 : : import {IERC20} from '../../../dependencies/openzeppelin/contracts/IERC20.sol';
- 7 : : import {IStableDebtToken} from '../../../interfaces/IStableDebtToken.sol';
- 8 : : import {IVariableDebtToken} from '../../../interfaces/IVariableDebtToken.sol';
- 9 : : import {IAToken} from '../../../interfaces/IAToken.sol';
- 10 : : import {UserConfiguration} from '../configuration/UserConfiguration.sol';
- 11 : : import {ReserveConfiguration} from '../configuration/ReserveConfiguration.sol';
- 12 : : import {Helpers} from '../helpers/Helpers.sol';
- 13 : : import {DataTypes} from '../types/DataTypes.sol';
- 14 : : import {ValidationLogic} from './ValidationLogic.sol';
- 15 : : import {ReserveLogic} from './ReserveLogic.sol';
- 16 : : import {IsolationModeLogic} from './IsolationModeLogic.sol';
- 17 : :
- 18 : : /**
- 19 : : * @title BorrowLogic library
- 20 : : * @author Aave
- 21 : : * @notice Implements the base logic for all the actions related to borrowing
- 22 : : */
- 23 : : library BorrowLogic {
- 24 : : using ReserveLogic for DataTypes.ReserveCache;
- 25 : : using ReserveLogic for DataTypes.ReserveData;
- 26 : : using GPv2SafeERC20 for IERC20;
- 27 : : using UserConfiguration for DataTypes.UserConfigurationMap;
- 28 : : using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
- 29 : : using SafeCast for uint256;
- 30 : :
- 31 : : // See `IPool` for descriptions
- 32 : : event Borrow(
- 33 : : address indexed reserve,
- 34 : : address user,
- 35 : : address indexed onBehalfOf,
- 36 : : uint256 amount,
- 37 : : DataTypes.InterestRateMode interestRateMode,
- 38 : : uint256 borrowRate,
- 39 : : uint16 indexed referralCode
- 40 : : );
- 41 : : event Repay(
- 42 : : address indexed reserve,
- 43 : : address indexed user,
- 44 : : address indexed repayer,
- 45 : : uint256 amount,
- 46 : : bool useATokens
- 47 : : );
- 48 : : event RebalanceStableBorrowRate(address indexed reserve, address indexed user);
- 49 : : event SwapBorrowRateMode(
- 50 : : address indexed reserve,
- 51 : : address indexed user,
- 52 : : DataTypes.InterestRateMode interestRateMode
- 53 : : );
- 54 : : event IsolationModeTotalDebtUpdated(address indexed asset, uint256 totalDebt);
- 55 : : event ReserveUsedAsCollateralDisabled(address indexed reserve, address indexed user);
- 56 : :
- 57 : : /**
- 58 : : * @notice Implements the borrow feature. Borrowing allows users that provided collateral to draw liquidity from the
- 59 : : * Aave protocol proportionally to their collateralization power. For isolated positions, it also increases the
- 60 : : * isolated debt.
- 61 : : * @dev Emits the `Borrow()` event
- 62 : : * @param reservesData The state of all the reserves
- 63 : : * @param reservesList The addresses of all the active reserves
- 64 : : * @param eModeCategories The configuration of all the efficiency mode categories
- 65 : : * @param userConfig The user configuration mapping that tracks the supplied/borrowed assets
- 66 : : * @param params The additional parameters needed to execute the borrow function
- 67 : : */
- 68 : 9117 : function executeBorrow(
- 69 : : mapping(address => DataTypes.ReserveData) storage reservesData,
- 70 : : mapping(uint256 => address) storage reservesList,
- 71 : : mapping(uint8 => DataTypes.EModeCategory) storage eModeCategories,
- 72 : : DataTypes.UserConfigurationMap storage userConfig,
- 73 : : DataTypes.ExecuteBorrowParams memory params
- 74 : : ) public {
- 75 : 18234 : DataTypes.ReserveData storage reserve = reservesData[params.asset];
- 76 : 27351 : DataTypes.ReserveCache memory reserveCache = reserve.cache();
+ 7 : : import {IVariableDebtToken} from '../../../interfaces/IVariableDebtToken.sol';
+ 8 : : import {IAToken} from '../../../interfaces/IAToken.sol';
+ 9 : : import {UserConfiguration} from '../configuration/UserConfiguration.sol';
+ 10 : : import {ReserveConfiguration} from '../configuration/ReserveConfiguration.sol';
+ 11 : : import {DataTypes} from '../types/DataTypes.sol';
+ 12 : : import {ValidationLogic} from './ValidationLogic.sol';
+ 13 : : import {ReserveLogic} from './ReserveLogic.sol';
+ 14 : : import {IsolationModeLogic} from './IsolationModeLogic.sol';
+ 15 : :
+ 16 : : /**
+ 17 : : * @title BorrowLogic library
+ 18 : : * @author Aave
+ 19 : : * @notice Implements the base logic for all the actions related to borrowing
+ 20 : : */
+ 21 : : library BorrowLogic {
+ 22 : : using ReserveLogic for DataTypes.ReserveCache;
+ 23 : : using ReserveLogic for DataTypes.ReserveData;
+ 24 : : using GPv2SafeERC20 for IERC20;
+ 25 : : using UserConfiguration for DataTypes.UserConfigurationMap;
+ 26 : : using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
+ 27 : : using SafeCast for uint256;
+ 28 : :
+ 29 : : // See `IPool` for descriptions
+ 30 : : event Borrow(
+ 31 : : address indexed reserve,
+ 32 : : address user,
+ 33 : : address indexed onBehalfOf,
+ 34 : : uint256 amount,
+ 35 : : DataTypes.InterestRateMode interestRateMode,
+ 36 : : uint256 borrowRate,
+ 37 : : uint16 indexed referralCode
+ 38 : : );
+ 39 : : event Repay(
+ 40 : : address indexed reserve,
+ 41 : : address indexed user,
+ 42 : : address indexed repayer,
+ 43 : : uint256 amount,
+ 44 : : bool useATokens
+ 45 : : );
+ 46 : : event IsolationModeTotalDebtUpdated(address indexed asset, uint256 totalDebt);
+ 47 : : event ReserveUsedAsCollateralDisabled(address indexed reserve, address indexed user);
+ 48 : :
+ 49 : : /**
+ 50 : : * @notice Implements the borrow feature. Borrowing allows users that provided collateral to draw liquidity from the
+ 51 : : * Aave protocol proportionally to their collateralization power. For isolated positions, it also increases the
+ 52 : : * isolated debt.
+ 53 : : * @dev Emits the `Borrow()` event
+ 54 : : * @param reservesData The state of all the reserves
+ 55 : : * @param reservesList The addresses of all the active reserves
+ 56 : : * @param eModeCategories The configuration of all the efficiency mode categories
+ 57 : : * @param userConfig The user configuration mapping that tracks the supplied/borrowed assets
+ 58 : : * @param params The additional parameters needed to execute the borrow function
+ 59 : : */
+ 60 : : function executeBorrow(
+ 61 : : mapping(address => DataTypes.ReserveData) storage reservesData,
+ 62 : : mapping(uint256 => address) storage reservesList,
+ 63 : : mapping(uint8 => DataTypes.EModeCategory) storage eModeCategories,
+ 64 : : DataTypes.UserConfigurationMap storage userConfig,
+ 65 : : DataTypes.ExecuteBorrowParams memory params
+ 66 : : ) external {
+ 67 : 16110 : DataTypes.ReserveData storage reserve = reservesData[params.asset];
+ 68 : 16110 : DataTypes.ReserveCache memory reserveCache = reserve.cache();
+ 69 : :
+ 70 : 16110 : reserve.updateState(reserveCache);
+ 71 : :
+ 72 : 16110 : (
+ 73 : : bool isolationModeActive,
+ 74 : : address isolationModeCollateralAddress,
+ 75 : : uint256 isolationModeDebtCeiling
+ 76 : 16110 : ) = userConfig.getIsolationModeState(reservesData, reservesList);
77 : :
- 78 : 18234 : reserve.updateState(reserveCache);
- 79 : :
- 80 : 18234 : (
- 81 : : bool isolationModeActive,
- 82 : : address isolationModeCollateralAddress,
- 83 : : uint256 isolationModeDebtCeiling
- 84 : 18234 : ) = userConfig.getIsolationModeState(reservesData, reservesList);
- 85 : :
- 86 : 18234 : ValidationLogic.validateBorrow(
- 87 : : reservesData,
- 88 : : reservesList,
- 89 : : eModeCategories,
- 90 : : DataTypes.ValidateBorrowParams({
- 91 : : reserveCache: reserveCache,
- 92 : : userConfig: userConfig,
- 93 : : asset: params.asset,
- 94 : : userAddress: params.onBehalfOf,
- 95 : : amount: params.amount,
- 96 : : interestRateMode: params.interestRateMode,
- 97 : : maxStableLoanPercent: params.maxStableRateBorrowSizePercent,
- 98 : : reservesCount: params.reservesCount,
- 99 : : oracle: params.oracle,
- 100 : : userEModeCategory: params.userEModeCategory,
- 101 : : priceOracleSentinel: params.priceOracleSentinel,
- 102 : : isolationModeActive: isolationModeActive,
- 103 : : isolationModeCollateralAddress: isolationModeCollateralAddress,
- 104 : : isolationModeDebtCeiling: isolationModeDebtCeiling
- 105 : : })
- 106 : : );
- 107 : :
- 108 : 18192 : uint256 currentStableRate = 0;
- 109 : 18192 : bool isFirstBorrowing = false;
- 110 : :
- 111 : 18192 : if (params.interestRateMode == DataTypes.InterestRateMode.STABLE) {
- 112 : 2 : currentStableRate = reserve.currentStableBorrowRate;
- 113 : :
- 114 : 2 : (
- 115 : : isFirstBorrowing,
- 116 : : reserveCache.nextTotalStableDebt,
- 117 : : reserveCache.nextAvgStableBorrowRate
- 118 : : ) = IStableDebtToken(reserveCache.stableDebtTokenAddress).mint(
- 119 : : params.user,
- 120 : : params.onBehalfOf,
- 121 : : params.amount,
- 122 : : currentStableRate
- 123 : : );
- 124 : : } else {
- 125 : 18190 : (isFirstBorrowing, reserveCache.nextScaledVariableDebt) = IVariableDebtToken(
- 126 : : reserveCache.variableDebtTokenAddress
- 127 : : ).mint(params.user, params.onBehalfOf, params.amount, reserveCache.nextVariableBorrowIndex);
- 128 : : }
- 129 : :
- 130 : 9095 : if (isFirstBorrowing) {
- 131 : 18188 : userConfig.setBorrowing(reserve.id, true);
- 132 : : }
- 133 : :
- 134 : 9095 : if (isolationModeActive) {
- 135 : 24 : uint256 nextIsolationModeTotalDebt = reservesData[isolationModeCollateralAddress]
- 136 : : .isolationModeTotalDebt += (params.amount /
- 137 : : 10 **
- 138 : : (reserveCache.reserveConfiguration.getDecimals() -
- 139 : : ReserveConfiguration.DEBT_CEILING_DECIMALS)).toUint128();
- 140 : 16 : emit IsolationModeTotalDebtUpdated(
- 141 : : isolationModeCollateralAddress,
- 142 : : nextIsolationModeTotalDebt
- 143 : : );
- 144 : : }
- 145 : :
- 146 : 18190 : reserve.updateInterestRatesAndVirtualBalance(
- 147 : : reserveCache,
- 148 : : params.asset,
- 149 : : 0,
- 150 : : params.releaseUnderlying ? params.amount : 0
- 151 : : );
- 152 : :
- 153 : 9094 : if (params.releaseUnderlying) {
- 154 : 18186 : IAToken(reserveCache.aTokenAddress).transferUnderlyingTo(params.user, params.amount);
- 155 : : }
- 156 : :
- 157 : 18188 : emit Borrow(
- 158 : : params.asset,
- 159 : : params.user,
- 160 : : params.onBehalfOf,
- 161 : : params.amount,
- 162 : : params.interestRateMode,
- 163 : : params.interestRateMode == DataTypes.InterestRateMode.STABLE
- 164 : : ? currentStableRate
- 165 : : : reserve.currentVariableBorrowRate,
- 166 : : params.referralCode
- 167 : : );
- 168 : : }
- 169 : :
- 170 : : /**
- 171 : : * @notice Implements the repay feature. Repaying transfers the underlying back to the aToken and clears the
- 172 : : * equivalent amount of debt for the user by burning the corresponding debt token. For isolated positions, it also
- 173 : : * reduces the isolated debt.
- 174 : : * @dev Emits the `Repay()` event
- 175 : : * @param reservesData The state of all the reserves
- 176 : : * @param reservesList The addresses of all the active reserves
- 177 : : * @param userConfig The user configuration mapping that tracks the supplied/borrowed assets
- 178 : : * @param params The additional parameters needed to execute the repay function
- 179 : : * @return The actual amount being repaid
- 180 : : */
- 181 : 5029 : function executeRepay(
- 182 : : mapping(address => DataTypes.ReserveData) storage reservesData,
- 183 : : mapping(uint256 => address) storage reservesList,
- 184 : : DataTypes.UserConfigurationMap storage userConfig,
- 185 : : DataTypes.ExecuteRepayParams memory params
- 186 : : ) external returns (uint256) {
- 187 : 10058 : DataTypes.ReserveData storage reserve = reservesData[params.asset];
- 188 : 15087 : DataTypes.ReserveCache memory reserveCache = reserve.cache();
- 189 : 10058 : reserve.updateState(reserveCache);
- 190 : :
- 191 : 15087 : (uint256 stableDebt, uint256 variableDebt) = Helpers.getUserCurrentDebt(
- 192 : : params.onBehalfOf,
- 193 : : reserveCache
- 194 : : );
- 195 : :
- 196 : 10058 : ValidationLogic.validateRepay(
- 197 : : reserveCache,
- 198 : : params.amount,
- 199 : : params.interestRateMode,
- 200 : : params.onBehalfOf,
- 201 : : stableDebt,
- 202 : : variableDebt
- 203 : : );
- 204 : :
- 205 : 15072 : uint256 paybackAmount = params.interestRateMode == DataTypes.InterestRateMode.STABLE
- 206 : : ? stableDebt
- 207 : : : variableDebt;
+ 78 : 16110 : ValidationLogic.validateBorrow(
+ 79 : : reservesData,
+ 80 : : reservesList,
+ 81 : : eModeCategories,
+ 82 : : DataTypes.ValidateBorrowParams({
+ 83 : : reserveCache: reserveCache,
+ 84 : : userConfig: userConfig,
+ 85 : : asset: params.asset,
+ 86 : : userAddress: params.onBehalfOf,
+ 87 : : amount: params.amount,
+ 88 : : interestRateMode: params.interestRateMode,
+ 89 : : reservesCount: params.reservesCount,
+ 90 : : oracle: params.oracle,
+ 91 : : userEModeCategory: params.userEModeCategory,
+ 92 : : priceOracleSentinel: params.priceOracleSentinel,
+ 93 : : isolationModeActive: isolationModeActive,
+ 94 : : isolationModeCollateralAddress: isolationModeCollateralAddress,
+ 95 : : isolationModeDebtCeiling: isolationModeDebtCeiling
+ 96 : : })
+ 97 : : );
+ 98 : :
+ 99 : 15091 : bool isFirstBorrowing = false;
+ 100 : :
+ 101 : 15091 : (isFirstBorrowing, reserveCache.nextScaledVariableDebt) = IVariableDebtToken(
+ 102 : : reserveCache.variableDebtTokenAddress
+ 103 : : ).mint(params.user, params.onBehalfOf, params.amount, reserveCache.nextVariableBorrowIndex);
+ 104 : :
+ 105 : 15091 : if (isFirstBorrowing) {
+ 106 : 15090 : userConfig.setBorrowing(reserve.id, true);
+ 107 : : }
+ 108 : :
+ 109 : 15091 : if (isolationModeActive) {
+ 110 : 8 : uint256 nextIsolationModeTotalDebt = reservesData[isolationModeCollateralAddress]
+ 111 : : .isolationModeTotalDebt += (params.amount /
+ 112 : : 10 **
+ 113 : : (reserveCache.reserveConfiguration.getDecimals() -
+ 114 : : ReserveConfiguration.DEBT_CEILING_DECIMALS)).toUint128();
+ 115 : 8 : emit IsolationModeTotalDebtUpdated(
+ 116 : : isolationModeCollateralAddress,
+ 117 : : nextIsolationModeTotalDebt
+ 118 : : );
+ 119 : : }
+ 120 : :
+ 121 : 15091 : reserve.updateInterestRatesAndVirtualBalance(
+ 122 : : reserveCache,
+ 123 : : params.asset,
+ 124 : : 0,
+ 125 : : params.releaseUnderlying ? params.amount : 0
+ 126 : : );
+ 127 : :
+ 128 : 15090 : if (params.releaseUnderlying) {
+ 129 : 15089 : IAToken(reserveCache.aTokenAddress).transferUnderlyingTo(params.user, params.amount);
+ 130 : : }
+ 131 : :
+ 132 : 15090 : emit Borrow(
+ 133 : : params.asset,
+ 134 : : params.user,
+ 135 : : params.onBehalfOf,
+ 136 : : params.amount,
+ 137 : : DataTypes.InterestRateMode.VARIABLE,
+ 138 : : reserve.currentVariableBorrowRate,
+ 139 : : params.referralCode
+ 140 : : );
+ 141 : : }
+ 142 : :
+ 143 : : /**
+ 144 : : * @notice Implements the repay feature. Repaying transfers the underlying back to the aToken and clears the
+ 145 : : * equivalent amount of debt for the user by burning the corresponding debt token. For isolated positions, it also
+ 146 : : * reduces the isolated debt.
+ 147 : : * @dev Emits the `Repay()` event
+ 148 : : * @param reservesData The state of all the reserves
+ 149 : : * @param reservesList The addresses of all the active reserves
+ 150 : : * @param userConfig The user configuration mapping that tracks the supplied/borrowed assets
+ 151 : : * @param params The additional parameters needed to execute the repay function
+ 152 : : * @return The actual amount being repaid
+ 153 : : */
+ 154 : : function executeRepay(
+ 155 : : mapping(address => DataTypes.ReserveData) storage reservesData,
+ 156 : : mapping(uint256 => address) storage reservesList,
+ 157 : : DataTypes.UserConfigurationMap storage userConfig,
+ 158 : : DataTypes.ExecuteRepayParams memory params
+ 159 : : ) external returns (uint256) {
+ 160 : 5030 : DataTypes.ReserveData storage reserve = reservesData[params.asset];
+ 161 : 5030 : DataTypes.ReserveCache memory reserveCache = reserve.cache();
+ 162 : 5030 : reserve.updateState(reserveCache);
+ 163 : :
+ 164 : 5030 : uint256 variableDebt = IERC20(reserveCache.variableDebtTokenAddress).balanceOf(
+ 165 : : params.onBehalfOf
+ 166 : : );
+ 167 : :
+ 168 : 5030 : ValidationLogic.validateRepay(
+ 169 : : reserveCache,
+ 170 : : params.amount,
+ 171 : : params.interestRateMode,
+ 172 : : params.onBehalfOf,
+ 173 : : variableDebt
+ 174 : : );
+ 175 : :
+ 176 : 5024 : uint256 paybackAmount = variableDebt;
+ 177 : :
+ 178 : : // Allows a user to repay with aTokens without leaving dust from interest.
+ 179 : 5024 : if (params.useATokens && params.amount == type(uint256).max) {
+ 180 : 4 : params.amount = IAToken(reserveCache.aTokenAddress).balanceOf(msg.sender);
+ 181 : : }
+ 182 : :
+ 183 : 5024 : if (params.amount < paybackAmount) {
+ 184 : 4971 : paybackAmount = params.amount;
+ 185 : : }
+ 186 : :
+ 187 : 5024 : reserveCache.nextScaledVariableDebt = IVariableDebtToken(reserveCache.variableDebtTokenAddress)
+ 188 : : .burn(params.onBehalfOf, paybackAmount, reserveCache.nextVariableBorrowIndex);
+ 189 : :
+ 190 : 5024 : reserve.updateInterestRatesAndVirtualBalance(
+ 191 : : reserveCache,
+ 192 : : params.asset,
+ 193 : : params.useATokens ? 0 : paybackAmount,
+ 194 : : 0
+ 195 : : );
+ 196 : :
+ 197 : 5024 : if (variableDebt - paybackAmount == 0) {
+ 198 : 53 : userConfig.setBorrowing(reserve.id, false);
+ 199 : : }
+ 200 : :
+ 201 : 5024 : IsolationModeLogic.updateIsolatedDebtIfIsolated(
+ 202 : : reservesData,
+ 203 : : reservesList,
+ 204 : : userConfig,
+ 205 : : reserveCache,
+ 206 : : paybackAmount
+ 207 : : );
208 : :
- 209 : : // Allows a user to repay with aTokens without leaving dust from interest.
- 210 : 11054 : if (params.useATokens && params.amount == type(uint256).max) {
- 211 : 8 : params.amount = IAToken(reserveCache.aTokenAddress).balanceOf(msg.sender);
- 212 : : }
- 213 : :
- 214 : 10048 : if (params.amount < paybackAmount) {
- 215 : 9246 : paybackAmount = params.amount;
- 216 : : }
- 217 : :
- 218 : 10048 : if (params.interestRateMode == DataTypes.InterestRateMode.STABLE) {
- 219 : 0 : (reserveCache.nextTotalStableDebt, reserveCache.nextAvgStableBorrowRate) = IStableDebtToken(
- 220 : : reserveCache.stableDebtTokenAddress
- 221 : : ).burn(params.onBehalfOf, paybackAmount);
- 222 : : } else {
- 223 : 10048 : reserveCache.nextScaledVariableDebt = IVariableDebtToken(
- 224 : : reserveCache.variableDebtTokenAddress
- 225 : : ).burn(params.onBehalfOf, paybackAmount, reserveCache.nextVariableBorrowIndex);
- 226 : : }
- 227 : :
- 228 : 10048 : reserve.updateInterestRatesAndVirtualBalance(
- 229 : : reserveCache,
- 230 : : params.asset,
- 231 : : params.useATokens ? 0 : paybackAmount,
- 232 : : 0
- 233 : : );
- 234 : :
- 235 : 20096 : if (stableDebt + variableDebt - paybackAmount == 0) {
- 236 : 802 : userConfig.setBorrowing(reserve.id, false);
- 237 : : }
- 238 : :
- 239 : 10048 : IsolationModeLogic.updateIsolatedDebtIfIsolated(
- 240 : : reservesData,
- 241 : : reservesList,
- 242 : : userConfig,
- 243 : : reserveCache,
- 244 : : paybackAmount
- 245 : : );
- 246 : :
- 247 : 5024 : if (params.useATokens) {
- 248 : 2012 : IAToken(reserveCache.aTokenAddress).burn(
- 249 : : msg.sender,
- 250 : : reserveCache.aTokenAddress,
- 251 : : paybackAmount,
- 252 : : reserveCache.nextLiquidityIndex
- 253 : : );
- 254 : : // in case of aToken repayment the msg.sender must always repay on behalf of itself
- 255 : 3015 : if (IAToken(reserveCache.aTokenAddress).scaledBalanceOf(msg.sender) == 0) {
- 256 : 4 : userConfig.setUsingAsCollateral(reserve.id, false);
- 257 : 4 : emit ReserveUsedAsCollateralDisabled(params.asset, msg.sender);
- 258 : : }
- 259 : : } else {
- 260 : 8036 : IERC20(params.asset).safeTransferFrom(msg.sender, reserveCache.aTokenAddress, paybackAmount);
- 261 : 6036 : IAToken(reserveCache.aTokenAddress).handleRepayment(
- 262 : : msg.sender,
- 263 : : params.onBehalfOf,
- 264 : : paybackAmount
- 265 : : );
- 266 : : }
- 267 : :
- 268 : 8046 : emit Repay(params.asset, params.onBehalfOf, msg.sender, paybackAmount, params.useATokens);
- 269 : :
- 270 : 8046 : return paybackAmount;
- 271 : : }
- 272 : :
- 273 : : /**
- 274 : : * @notice Implements the rebalance stable borrow rate feature. In case of liquidity crunches on the protocol, stable
- 275 : : * rate borrows might need to be rebalanced to bring back equilibrium between the borrow and supply APYs.
- 276 : : * @dev The rules that define if a position can be rebalanced are implemented in `ValidationLogic.validateRebalanceStableBorrowRate()`
- 277 : : * @dev Emits the `RebalanceStableBorrowRate()` event
- 278 : : * @param reserve The state of the reserve of the asset being repaid
- 279 : : * @param asset The asset of the position being rebalanced
- 280 : : * @param user The user being rebalanced
- 281 : : */
- 282 : 5 : function executeRebalanceStableBorrowRate(
- 283 : : DataTypes.ReserveData storage reserve,
- 284 : : address asset,
- 285 : : address user
- 286 : : ) external {
- 287 : 15 : DataTypes.ReserveCache memory reserveCache = reserve.cache();
- 288 : 10 : reserve.updateState(reserveCache);
- 289 : :
- 290 : 10 : ValidationLogic.validateRebalanceStableBorrowRate(reserve, reserveCache, asset);
- 291 : :
- 292 : 6 : IStableDebtToken stableDebtToken = IStableDebtToken(reserveCache.stableDebtTokenAddress);
- 293 : 6 : uint256 stableDebt = IERC20(address(stableDebtToken)).balanceOf(user);
- 294 : :
- 295 : 4 : stableDebtToken.burn(user, stableDebt);
- 296 : :
- 297 : 0 : (, reserveCache.nextTotalStableDebt, reserveCache.nextAvgStableBorrowRate) = stableDebtToken
- 298 : : .mint(user, user, stableDebt, reserve.currentStableBorrowRate);
- 299 : :
- 300 : 0 : reserve.updateInterestRatesAndVirtualBalance(reserveCache, asset, 0, 0);
- 301 : :
- 302 : 0 : emit RebalanceStableBorrowRate(asset, user);
- 303 : : }
- 304 : :
- 305 : : /**
- 306 : : * @notice Implements the swap borrow rate feature. Borrowers can swap from variable to stable positions at any time.
- 307 : : * @dev Emits the `Swap()` event
- 308 : : * @param reserve The of the reserve of the asset being repaid
- 309 : : * @param userConfig The user configuration mapping that tracks the supplied/borrowed assets
- 310 : : * @param asset The asset of the position being swapped
- 311 : : * @param interestRateMode The current interest rate mode of the position being swapped
- 312 : : */
- 313 : 8 : function executeSwapBorrowRateMode(
- 314 : : DataTypes.ReserveData storage reserve,
- 315 : : DataTypes.UserConfigurationMap storage userConfig,
- 316 : : address asset,
- 317 : : address user,
- 318 : : DataTypes.InterestRateMode interestRateMode
- 319 : : ) external {
- 320 : 24 : DataTypes.ReserveCache memory reserveCache = reserve.cache();
- 321 : :
- 322 : 16 : reserve.updateState(reserveCache);
- 323 : :
- 324 : 24 : (uint256 stableDebt, uint256 variableDebt) = Helpers.getUserCurrentDebt(user, reserveCache);
- 325 : :
- 326 : 16 : ValidationLogic.validateSwapRateMode(
- 327 : : reserve,
- 328 : : reserveCache,
- 329 : : userConfig,
- 330 : : stableDebt,
- 331 : : variableDebt,
- 332 : : interestRateMode
- 333 : : );
- 334 : :
- 335 : 6 : if (interestRateMode == DataTypes.InterestRateMode.STABLE) {
- 336 : 0 : (reserveCache.nextTotalStableDebt, reserveCache.nextAvgStableBorrowRate) = IStableDebtToken(
- 337 : : reserveCache.stableDebtTokenAddress
- 338 : : ).burn(user, stableDebt);
- 339 : :
- 340 : 0 : (, reserveCache.nextScaledVariableDebt) = IVariableDebtToken(
- 341 : : reserveCache.variableDebtTokenAddress
- 342 : : ).mint(user, user, stableDebt, reserveCache.nextVariableBorrowIndex);
- 343 : : } else {
- 344 : 6 : reserveCache.nextScaledVariableDebt = IVariableDebtToken(
- 345 : : reserveCache.variableDebtTokenAddress
- 346 : : ).burn(user, variableDebt, reserveCache.nextVariableBorrowIndex);
- 347 : :
- 348 : 6 : (, reserveCache.nextTotalStableDebt, reserveCache.nextAvgStableBorrowRate) = IStableDebtToken(
- 349 : : reserveCache.stableDebtTokenAddress
- 350 : : ).mint(user, user, variableDebt, reserve.currentStableBorrowRate);
- 351 : : }
- 352 : :
- 353 : 0 : reserve.updateInterestRatesAndVirtualBalance(reserveCache, asset, 0, 0);
- 354 : :
- 355 : 0 : emit SwapBorrowRateMode(asset, user, interestRateMode);
- 356 : : }
- 357 : : }
+ 209 : 5024 : if (params.useATokens) {
+ 210 : 1006 : IAToken(reserveCache.aTokenAddress).burn(
+ 211 : : msg.sender,
+ 212 : : reserveCache.aTokenAddress,
+ 213 : : paybackAmount,
+ 214 : : reserveCache.nextLiquidityIndex
+ 215 : : );
+ 216 : : // in case of aToken repayment the msg.sender must always repay on behalf of itself
+ 217 : 1005 : if (IAToken(reserveCache.aTokenAddress).scaledBalanceOf(msg.sender) == 0) {
+ 218 : 2 : userConfig.setUsingAsCollateral(reserve.id, false);
+ 219 : 2 : emit ReserveUsedAsCollateralDisabled(params.asset, msg.sender);
+ 220 : : }
+ 221 : : } else {
+ 222 : 4018 : IERC20(params.asset).safeTransferFrom(msg.sender, reserveCache.aTokenAddress, paybackAmount);
+ 223 : 3018 : IAToken(reserveCache.aTokenAddress).handleRepayment(
+ 224 : : msg.sender,
+ 225 : : params.onBehalfOf,
+ 226 : : paybackAmount
+ 227 : : );
+ 228 : : }
+ 229 : :
+ 230 : 4023 : emit Repay(params.asset, params.onBehalfOf, msg.sender, paybackAmount, params.useATokens);
+ 231 : :
+ 232 : 4023 : return paybackAmount;
+ 233 : : }
+ 234 : : }
@@ -433,8 +310,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/BridgeLogic.sol.func-c.html b/report/protocol/libraries/logic/BridgeLogic.sol.func-c.html
similarity index 68%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/BridgeLogic.sol.func-c.html
rename to report/protocol/libraries/logic/BridgeLogic.sol.func-c.html
index bcdb3d86..7ef58872 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/BridgeLogic.sol.func-c.html
+++ b/report/protocol/libraries/logic/BridgeLogic.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/BridgeLogic.sol - functions
-
+ LCOV - lcov.info.p - protocol/libraries/logic/BridgeLogic.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -37,7 +37,7 @@
-
+
|
@@ -53,21 +53,21 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../glass.png) |
@@ -89,8 +89,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/BridgeLogic.sol.func.html b/report/protocol/libraries/logic/BridgeLogic.sol.func.html
similarity index 68%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/BridgeLogic.sol.func.html
rename to report/protocol/libraries/logic/BridgeLogic.sol.func.html
index b7642685..b66c60e4 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/BridgeLogic.sol.func.html
+++ b/report/protocol/libraries/logic/BridgeLogic.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/BridgeLogic.sol - functions
-
+ LCOV - lcov.info.p - protocol/libraries/logic/BridgeLogic.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -37,7 +37,7 @@
-
+
|
@@ -53,21 +53,21 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../updown.png) |
@@ -89,8 +89,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/BridgeLogic.sol.gcov.html b/report/protocol/libraries/logic/BridgeLogic.sol.gcov.html
similarity index 87%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/BridgeLogic.sol.gcov.html
rename to report/protocol/libraries/logic/BridgeLogic.sol.gcov.html
index aa403b76..572a41b7 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/BridgeLogic.sol.gcov.html
+++ b/report/protocol/libraries/logic/BridgeLogic.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/BridgeLogic.sol
-
+ LCOV - lcov.info.p - protocol/libraries/logic/BridgeLogic.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -37,7 +37,7 @@
-
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -120,7 +120,7 @@
49 : : * @param referralCode Code used to register the integrator originating the operation, for potential rewards.
50 : : * 0 if the action is executed directly by the user, without any middle-man
51 : : */
- 52 : 16 : function executeMintUnbacked(
+ 52 : : function executeMintUnbacked(
53 : : mapping(address => DataTypes.ReserveData) storage reservesData,
54 : : mapping(uint256 => address) storage reservesList,
55 : : DataTypes.UserConfigurationMap storage userConfig,
@@ -129,26 +129,26 @@
58 : : address onBehalfOf,
59 : : uint16 referralCode
60 : : ) external {
- 61 : 32 : DataTypes.ReserveData storage reserve = reservesData[asset];
- 62 : 48 : DataTypes.ReserveCache memory reserveCache = reserve.cache();
+ 61 : 16 : DataTypes.ReserveData storage reserve = reservesData[asset];
+ 62 : 16 : DataTypes.ReserveCache memory reserveCache = reserve.cache();
63 : :
- 64 : 32 : reserve.updateState(reserveCache);
+ 64 : 16 : reserve.updateState(reserveCache);
65 : :
- 66 : 32 : ValidationLogic.validateSupply(reserveCache, reserve, amount, onBehalfOf);
+ 66 : 16 : ValidationLogic.validateSupply(reserveCache, reserve, amount, onBehalfOf);
67 : :
- 68 : 48 : uint256 unbackedMintCap = reserveCache.reserveConfiguration.getUnbackedMintCap();
- 69 : 48 : uint256 reserveDecimals = reserveCache.reserveConfiguration.getDecimals();
+ 68 : 16 : uint256 unbackedMintCap = reserveCache.reserveConfiguration.getUnbackedMintCap();
+ 69 : 16 : uint256 reserveDecimals = reserveCache.reserveConfiguration.getDecimals();
70 : :
- 71 : 48 : uint256 unbacked = reserve.unbacked += amount.toUint128();
+ 71 : 16 : uint256 unbacked = reserve.unbacked += amount.toUint128();
72 : :
- 73 : 32 : require(
+ 73 : 16 : require(
74 : : unbacked <= unbackedMintCap * (10 ** reserveDecimals),
75 : : Errors.UNBACKED_MINT_CAP_EXCEEDED
76 : : );
77 : :
- 78 : 28 : reserve.updateInterestRatesAndVirtualBalance(reserveCache, asset, 0, 0);
+ 78 : 14 : reserve.updateInterestRatesAndVirtualBalance(reserveCache, asset, 0, 0);
79 : :
- 80 : 42 : bool isFirstSupply = IAToken(reserveCache.aTokenAddress).mint(
+ 80 : 14 : bool isFirstSupply = IAToken(reserveCache.aTokenAddress).mint(
81 : : msg.sender,
82 : : onBehalfOf,
83 : : amount,
@@ -157,7 +157,7 @@
86 : :
87 : 14 : if (isFirstSupply) {
88 : : if (
- 89 : 14 : ValidationLogic.validateAutomaticUseAsCollateral(
+ 89 : 7 : ValidationLogic.validateAutomaticUseAsCollateral(
90 : : reservesData,
91 : : reservesList,
92 : : userConfig,
@@ -165,12 +165,12 @@
94 : : reserveCache.aTokenAddress
95 : : )
96 : : ) {
- 97 : 14 : userConfig.setUsingAsCollateral(reserve.id, true);
- 98 : 14 : emit ReserveUsedAsCollateralEnabled(asset, onBehalfOf);
+ 97 : 7 : userConfig.setUsingAsCollateral(reserve.id, true);
+ 98 : 7 : emit ReserveUsedAsCollateralEnabled(asset, onBehalfOf);
99 : : }
100 : : }
101 : :
- 102 : 28 : emit MintUnbacked(asset, msg.sender, onBehalfOf, amount, referralCode);
+ 102 : 14 : emit MintUnbacked(asset, msg.sender, onBehalfOf, amount, referralCode);
103 : : }
104 : :
105 : : /**
@@ -184,39 +184,39 @@
113 : : * @param protocolFeeBps The fraction of fees in basis points paid to the protocol
114 : : * @return The backed amount
115 : : */
- 116 : 9 : function executeBackUnbacked(
+ 116 : : function executeBackUnbacked(
117 : : DataTypes.ReserveData storage reserve,
118 : : address asset,
119 : : uint256 amount,
120 : : uint256 fee,
121 : : uint256 protocolFeeBps
122 : : ) external returns (uint256) {
- 123 : 27 : DataTypes.ReserveCache memory reserveCache = reserve.cache();
+ 123 : 9 : DataTypes.ReserveCache memory reserveCache = reserve.cache();
124 : :
- 125 : 18 : reserve.updateState(reserveCache);
+ 125 : 9 : reserve.updateState(reserveCache);
126 : :
- 127 : 27 : uint256 backingAmount = (amount < reserve.unbacked) ? amount : reserve.unbacked;
+ 127 : 9 : uint256 backingAmount = (amount < reserve.unbacked) ? amount : reserve.unbacked;
128 : :
- 129 : 27 : uint256 feeToProtocol = fee.percentMul(protocolFeeBps);
- 130 : 27 : uint256 feeToLP = fee - feeToProtocol;
- 131 : 27 : uint256 added = backingAmount + fee;
+ 129 : 9 : uint256 feeToProtocol = fee.percentMul(protocolFeeBps);
+ 130 : 9 : uint256 feeToLP = fee - feeToProtocol;
+ 131 : 9 : uint256 added = backingAmount + fee;
132 : :
- 133 : 18 : reserveCache.nextLiquidityIndex = reserve.cumulateToLiquidityIndex(
+ 133 : 9 : reserveCache.nextLiquidityIndex = reserve.cumulateToLiquidityIndex(
134 : : IERC20(reserveCache.aTokenAddress).totalSupply() +
135 : : uint256(reserve.accruedToTreasury).rayMul(reserveCache.nextLiquidityIndex),
136 : : feeToLP
137 : : );
138 : :
- 139 : 18 : reserve.accruedToTreasury += feeToProtocol.rayDiv(reserveCache.nextLiquidityIndex).toUint128();
+ 139 : 9 : reserve.accruedToTreasury += feeToProtocol.rayDiv(reserveCache.nextLiquidityIndex).toUint128();
140 : :
- 141 : 18 : reserve.unbacked -= backingAmount.toUint128();
- 142 : 18 : reserve.updateInterestRatesAndVirtualBalance(reserveCache, asset, added, 0);
+ 141 : 9 : reserve.unbacked -= backingAmount.toUint128();
+ 142 : 9 : reserve.updateInterestRatesAndVirtualBalance(reserveCache, asset, added, 0);
143 : :
- 144 : 18 : IERC20(asset).safeTransferFrom(msg.sender, reserveCache.aTokenAddress, added);
+ 144 : 9 : IERC20(asset).safeTransferFrom(msg.sender, reserveCache.aTokenAddress, added);
145 : :
- 146 : 18 : emit BackUnbacked(asset, msg.sender, backingAmount, fee);
+ 146 : 9 : emit BackUnbacked(asset, msg.sender, backingAmount, fee);
147 : :
- 148 : 18 : return backingAmount;
+ 148 : 9 : return backingAmount;
149 : : }
150 : : }
@@ -226,8 +226,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/CalldataLogic.sol.func-c.html b/report/protocol/libraries/logic/CalldataLogic.sol.func-c.html
similarity index 65%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/CalldataLogic.sol.func-c.html
rename to report/protocol/libraries/logic/CalldataLogic.sol.func-c.html
index 086a5787..09c229f7 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/CalldataLogic.sol.func-c.html
+++ b/report/protocol/libraries/logic/CalldataLogic.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/CalldataLogic.sol - functions
-
+ LCOV - lcov.info.p - protocol/libraries/logic/CalldataLogic.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,47 +53,33 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../glass.png) |
- CalldataLogic.decodeLiquidationCallParams |
+ CalldataLogic.decodeLiquidationCallParams |
1 |
- CalldataLogic.decodeRebalanceStableBorrowRateParams |
-
- 1 |
-
-
-
-
- CalldataLogic.decodeSetUserUseReserveAsCollateralParams |
-
- 1 |
-
-
-
-
- CalldataLogic.decodeSwapBorrowRateModeParams |
+ CalldataLogic.decodeSetUserUseReserveAsCollateralParams |
1 |
@@ -145,8 +131,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/CalldataLogic.sol.func.html b/report/protocol/libraries/logic/CalldataLogic.sol.func.html
similarity index 65%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/CalldataLogic.sol.func.html
rename to report/protocol/libraries/logic/CalldataLogic.sol.func.html
index 7e5722ec..6ac13f15 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/CalldataLogic.sol.func.html
+++ b/report/protocol/libraries/logic/CalldataLogic.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/CalldataLogic.sol - functions
-
+ LCOV - lcov.info.p - protocol/libraries/logic/CalldataLogic.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,21 +53,21 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../updown.png) |
@@ -79,14 +79,7 @@
- CalldataLogic.decodeLiquidationCallParams |
-
- 1 |
-
-
-
-
- CalldataLogic.decodeRebalanceStableBorrowRateParams |
+ CalldataLogic.decodeLiquidationCallParams |
1 |
@@ -107,7 +100,7 @@
- CalldataLogic.decodeSetUserUseReserveAsCollateralParams |
+ CalldataLogic.decodeSetUserUseReserveAsCollateralParams |
1 |
@@ -126,13 +119,6 @@
1000 |
-
-
- CalldataLogic.decodeSwapBorrowRateModeParams |
-
- 1 |
-
-
CalldataLogic.decodeWithdrawParams |
@@ -145,8 +131,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/CalldataLogic.sol.gcov.html b/report/protocol/libraries/logic/CalldataLogic.sol.gcov.html
similarity index 70%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/CalldataLogic.sol.gcov.html
rename to report/protocol/libraries/logic/CalldataLogic.sol.gcov.html
index f8e61c0a..9e8e2849 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/CalldataLogic.sol.gcov.html
+++ b/report/protocol/libraries/logic/CalldataLogic.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/CalldataLogic.sol
-
+ LCOV - lcov.info.p - protocol/libraries/logic/CalldataLogic.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -86,20 +86,20 @@
15 : : * @return The amount to supply
16 : : * @return The referralCode
17 : : */
- 18 : 1007 : function decodeSupplyParams(
+ 18 : : function decodeSupplyParams(
19 : : mapping(uint256 => address) storage reservesList,
20 : : bytes32 args
21 : : ) internal view returns (address, uint256, uint16) {
- 22 : 2014 : uint16 assetId;
- 23 : 2014 : uint256 amount;
- 24 : 2014 : uint16 referralCode;
+ 22 : 1007 : uint16 assetId;
+ 23 : 1007 : uint256 amount;
+ 24 : 1007 : uint16 referralCode;
25 : :
26 : : assembly {
- 27 : 2014 : assetId := and(args, 0xFFFF)
- 28 : 2014 : amount := and(shr(16, args), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
- 29 : 2014 : referralCode := and(shr(144, args), 0xFFFF)
+ 27 : 1007 : assetId := and(args, 0xFFFF)
+ 28 : 1007 : amount := and(shr(16, args), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
+ 29 : 1007 : referralCode := and(shr(144, args), 0xFFFF)
30 : : }
- 31 : 2014 : return (reservesList[assetId], amount, referralCode);
+ 31 : 1007 : return (reservesList[assetId], amount, referralCode);
32 : : }
33 : :
34 : : /**
@@ -112,20 +112,20 @@
41 : : * @return The deadline of the permit
42 : : * @return The V value of the permit signature
43 : : */
- 44 : 1000 : function decodeSupplyWithPermitParams(
+ 44 : : function decodeSupplyWithPermitParams(
45 : : mapping(uint256 => address) storage reservesList,
46 : : bytes32 args
47 : : ) internal view returns (address, uint256, uint16, uint256, uint8) {
- 48 : 2000 : uint256 deadline;
- 49 : 2000 : uint8 permitV;
+ 48 : 1000 : uint256 deadline;
+ 49 : 1000 : uint8 permitV;
50 : :
51 : : assembly {
- 52 : 2000 : deadline := and(shr(160, args), 0xFFFFFFFF)
- 53 : 2000 : permitV := and(shr(192, args), 0xFF)
+ 52 : 1000 : deadline := and(shr(160, args), 0xFFFFFFFF)
+ 53 : 1000 : permitV := and(shr(192, args), 0xFF)
54 : : }
- 55 : 3000 : (address asset, uint256 amount, uint16 referralCode) = decodeSupplyParams(reservesList, args);
+ 55 : 1000 : (address asset, uint256 amount, uint16 referralCode) = decodeSupplyParams(reservesList, args);
56 : :
- 57 : 2000 : return (asset, amount, referralCode, deadline, permitV);
+ 57 : 1000 : return (asset, amount, referralCode, deadline, permitV);
58 : : }
59 : :
60 : : /**
@@ -135,20 +135,20 @@
64 : : * @return The address of the underlying reserve
65 : : * @return The amount to withdraw
66 : : */
- 67 : 2 : function decodeWithdrawParams(
+ 67 : : function decodeWithdrawParams(
68 : : mapping(uint256 => address) storage reservesList,
69 : : bytes32 args
70 : : ) internal view returns (address, uint256) {
- 71 : 4 : uint16 assetId;
- 72 : 4 : uint256 amount;
+ 71 : 2 : uint16 assetId;
+ 72 : 2 : uint256 amount;
73 : : assembly {
- 74 : 4 : assetId := and(args, 0xFFFF)
- 75 : 4 : amount := and(shr(16, args), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
+ 74 : 2 : assetId := and(args, 0xFFFF)
+ 75 : 2 : amount := and(shr(16, args), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
76 : : }
- 77 : 4 : if (amount == type(uint128).max) {
- 78 : 2 : amount = type(uint256).max;
+ 77 : 2 : if (amount == type(uint128).max) {
+ 78 : 1 : amount = type(uint256).max;
79 : : }
- 80 : 4 : return (reservesList[assetId], amount);
+ 80 : 2 : return (reservesList[assetId], amount);
81 : : }
82 : :
83 : : /**
@@ -157,26 +157,26 @@
86 : : * @param args The packed borrow params
87 : : * @return The address of the underlying reserve
88 : : * @return The amount to borrow
- 89 : : * @return The interestRateMode, 1 for stable or 2 for variable debt
+ 89 : : * @return The interestRateMode, 2 for variable debt, 1 is deprecated (changed on v3.2.0)
90 : : * @return The referralCode
91 : : */
- 92 : 3 : function decodeBorrowParams(
+ 92 : : function decodeBorrowParams(
93 : : mapping(uint256 => address) storage reservesList,
94 : : bytes32 args
95 : : ) internal view returns (address, uint256, uint256, uint16) {
- 96 : 6 : uint16 assetId;
- 97 : 6 : uint256 amount;
- 98 : 6 : uint256 interestRateMode;
- 99 : 6 : uint16 referralCode;
+ 96 : 3 : uint16 assetId;
+ 97 : 3 : uint256 amount;
+ 98 : 3 : uint256 interestRateMode;
+ 99 : 3 : uint16 referralCode;
100 : :
101 : : assembly {
- 102 : 6 : assetId := and(args, 0xFFFF)
- 103 : 6 : amount := and(shr(16, args), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
- 104 : 6 : interestRateMode := and(shr(144, args), 0xFF)
- 105 : 6 : referralCode := and(shr(152, args), 0xFFFF)
+ 102 : 3 : assetId := and(args, 0xFFFF)
+ 103 : 3 : amount := and(shr(16, args), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
+ 104 : 3 : interestRateMode := and(shr(144, args), 0xFF)
+ 105 : 3 : referralCode := and(shr(152, args), 0xFFFF)
106 : : }
107 : :
- 108 : 6 : return (reservesList[assetId], amount, interestRateMode, referralCode);
+ 108 : 3 : return (reservesList[assetId], amount, interestRateMode, referralCode);
109 : : }
110 : :
111 : : /**
@@ -185,27 +185,27 @@
114 : : * @param args The packed repay params
115 : : * @return The address of the underlying reserve
116 : : * @return The amount to repay
- 117 : : * @return The interestRateMode, 1 for stable or 2 for variable debt
+ 117 : : * @return The interestRateMode, 2 for variable debt, 1 is deprecated (changed on v3.2.0)
118 : : */
- 119 : 1002 : function decodeRepayParams(
+ 119 : : function decodeRepayParams(
120 : : mapping(uint256 => address) storage reservesList,
121 : : bytes32 args
122 : : ) internal view returns (address, uint256, uint256) {
- 123 : 2004 : uint16 assetId;
- 124 : 2004 : uint256 amount;
- 125 : 2004 : uint256 interestRateMode;
+ 123 : 1002 : uint16 assetId;
+ 124 : 1002 : uint256 amount;
+ 125 : 1002 : uint256 interestRateMode;
126 : :
127 : : assembly {
- 128 : 2004 : assetId := and(args, 0xFFFF)
- 129 : 2004 : amount := and(shr(16, args), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
- 130 : 2004 : interestRateMode := and(shr(144, args), 0xFF)
+ 128 : 1002 : assetId := and(args, 0xFFFF)
+ 129 : 1002 : amount := and(shr(16, args), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
+ 130 : 1002 : interestRateMode := and(shr(144, args), 0xFF)
131 : : }
132 : :
- 133 : 2004 : if (amount == type(uint128).max) {
- 134 : 4 : amount = type(uint256).max;
+ 133 : 1002 : if (amount == type(uint128).max) {
+ 134 : 2 : amount = type(uint256).max;
135 : : }
136 : :
- 137 : 2004 : return (reservesList[assetId], amount, interestRateMode);
+ 137 : 1002 : return (reservesList[assetId], amount, interestRateMode);
138 : : }
139 : :
140 : : /**
@@ -214,136 +214,94 @@
143 : : * @param args The packed repay with permit params
144 : : * @return The address of the underlying reserve
145 : : * @return The amount to repay
- 146 : : * @return The interestRateMode, 1 for stable or 2 for variable debt
+ 146 : : * @return The interestRateMode, 2 for variable debt, 1 is deprecated (changed on v3.2.0)
147 : : * @return The deadline of the permit
148 : : * @return The V value of the permit signature
149 : : */
- 150 : 1000 : function decodeRepayWithPermitParams(
+ 150 : : function decodeRepayWithPermitParams(
151 : : mapping(uint256 => address) storage reservesList,
152 : : bytes32 args
153 : : ) internal view returns (address, uint256, uint256, uint256, uint8) {
- 154 : 2000 : uint256 deadline;
- 155 : 2000 : uint8 permitV;
+ 154 : 1000 : uint256 deadline;
+ 155 : 1000 : uint8 permitV;
156 : :
- 157 : 3000 : (address asset, uint256 amount, uint256 interestRateMode) = decodeRepayParams(
+ 157 : 1000 : (address asset, uint256 amount, uint256 interestRateMode) = decodeRepayParams(
158 : : reservesList,
159 : : args
160 : : );
161 : :
162 : : assembly {
- 163 : 2000 : deadline := and(shr(152, args), 0xFFFFFFFF)
- 164 : 2000 : permitV := and(shr(184, args), 0xFF)
+ 163 : 1000 : deadline := and(shr(152, args), 0xFFFFFFFF)
+ 164 : 1000 : permitV := and(shr(184, args), 0xFF)
165 : : }
166 : :
- 167 : 2000 : return (asset, amount, interestRateMode, deadline, permitV);
+ 167 : 1000 : return (asset, amount, interestRateMode, deadline, permitV);
168 : : }
169 : :
170 : : /**
- 171 : : * @notice Decodes compressed swap borrow rate mode params to standard params
+ 171 : : * @notice Decodes compressed set user use reserve as collateral params to standard params
172 : : * @param reservesList The addresses of all the active reserves
- 173 : : * @param args The packed swap borrow rate mode params
+ 173 : : * @param args The packed set user use reserve as collateral params
174 : : * @return The address of the underlying reserve
- 175 : : * @return The interest rate mode, 1 for stable 2 for variable debt
+ 175 : : * @return True if to set using as collateral, false otherwise
176 : : */
- 177 : 1 : function decodeSwapBorrowRateModeParams(
+ 177 : : function decodeSetUserUseReserveAsCollateralParams(
178 : : mapping(uint256 => address) storage reservesList,
179 : : bytes32 args
- 180 : : ) internal view returns (address, uint256) {
- 181 : 2 : uint16 assetId;
- 182 : 2 : uint256 interestRateMode;
- 183 : :
- 184 : : assembly {
- 185 : 2 : assetId := and(args, 0xFFFF)
- 186 : 2 : interestRateMode := and(shr(16, args), 0xFF)
- 187 : : }
- 188 : :
- 189 : 2 : return (reservesList[assetId], interestRateMode);
- 190 : : }
- 191 : :
- 192 : : /**
- 193 : : * @notice Decodes compressed rebalance stable borrow rate params to standard params
- 194 : : * @param reservesList The addresses of all the active reserves
- 195 : : * @param args The packed rabalance stable borrow rate params
- 196 : : * @return The address of the underlying reserve
- 197 : : * @return The address of the user to rebalance
- 198 : : */
- 199 : 1 : function decodeRebalanceStableBorrowRateParams(
- 200 : : mapping(uint256 => address) storage reservesList,
- 201 : : bytes32 args
- 202 : : ) internal view returns (address, address) {
- 203 : 2 : uint16 assetId;
- 204 : 2 : address user;
- 205 : : assembly {
- 206 : 2 : assetId := and(args, 0xFFFF)
- 207 : 2 : user := and(shr(16, args), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
- 208 : : }
- 209 : 2 : return (reservesList[assetId], user);
- 210 : : }
+ 180 : : ) internal view returns (address, bool) {
+ 181 : 1 : uint16 assetId;
+ 182 : 1 : bool useAsCollateral;
+ 183 : : assembly {
+ 184 : 1 : assetId := and(args, 0xFFFF)
+ 185 : 1 : useAsCollateral := and(shr(16, args), 0x1)
+ 186 : : }
+ 187 : 1 : return (reservesList[assetId], useAsCollateral);
+ 188 : : }
+ 189 : :
+ 190 : : /**
+ 191 : : * @notice Decodes compressed liquidation call params to standard params
+ 192 : : * @param reservesList The addresses of all the active reserves
+ 193 : : * @param args1 The first half of packed liquidation call params
+ 194 : : * @param args2 The second half of the packed liquidation call params
+ 195 : : * @return The address of the underlying collateral asset
+ 196 : : * @return The address of the underlying debt asset
+ 197 : : * @return The address of the user to liquidate
+ 198 : : * @return The amount of debt to cover
+ 199 : : * @return True if receiving aTokens, false otherwise
+ 200 : : */
+ 201 : : function decodeLiquidationCallParams(
+ 202 : : mapping(uint256 => address) storage reservesList,
+ 203 : : bytes32 args1,
+ 204 : : bytes32 args2
+ 205 : : ) internal view returns (address, address, address, uint256, bool) {
+ 206 : 1 : uint16 collateralAssetId;
+ 207 : 1 : uint16 debtAssetId;
+ 208 : 1 : address user;
+ 209 : 1 : uint256 debtToCover;
+ 210 : 1 : bool receiveAToken;
211 : :
- 212 : : /**
- 213 : : * @notice Decodes compressed set user use reserve as collateral params to standard params
- 214 : : * @param reservesList The addresses of all the active reserves
- 215 : : * @param args The packed set user use reserve as collateral params
- 216 : : * @return The address of the underlying reserve
- 217 : : * @return True if to set using as collateral, false otherwise
- 218 : : */
- 219 : 1 : function decodeSetUserUseReserveAsCollateralParams(
- 220 : : mapping(uint256 => address) storage reservesList,
- 221 : : bytes32 args
- 222 : : ) internal view returns (address, bool) {
- 223 : 2 : uint16 assetId;
- 224 : 2 : bool useAsCollateral;
- 225 : : assembly {
- 226 : 2 : assetId := and(args, 0xFFFF)
- 227 : 2 : useAsCollateral := and(shr(16, args), 0x1)
- 228 : : }
- 229 : 2 : return (reservesList[assetId], useAsCollateral);
- 230 : : }
- 231 : :
- 232 : : /**
- 233 : : * @notice Decodes compressed liquidation call params to standard params
- 234 : : * @param reservesList The addresses of all the active reserves
- 235 : : * @param args1 The first half of packed liquidation call params
- 236 : : * @param args2 The second half of the packed liquidation call params
- 237 : : * @return The address of the underlying collateral asset
- 238 : : * @return The address of the underlying debt asset
- 239 : : * @return The address of the user to liquidate
- 240 : : * @return The amount of debt to cover
- 241 : : * @return True if receiving aTokens, false otherwise
- 242 : : */
- 243 : 1 : function decodeLiquidationCallParams(
- 244 : : mapping(uint256 => address) storage reservesList,
- 245 : : bytes32 args1,
- 246 : : bytes32 args2
- 247 : : ) internal view returns (address, address, address, uint256, bool) {
- 248 : 2 : uint16 collateralAssetId;
- 249 : 2 : uint16 debtAssetId;
- 250 : 2 : address user;
- 251 : 2 : uint256 debtToCover;
- 252 : 2 : bool receiveAToken;
- 253 : :
- 254 : : assembly {
- 255 : 2 : collateralAssetId := and(args1, 0xFFFF)
- 256 : 2 : debtAssetId := and(shr(16, args1), 0xFFFF)
- 257 : 2 : user := and(shr(32, args1), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
- 258 : :
- 259 : 2 : debtToCover := and(args2, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
- 260 : 2 : receiveAToken := and(shr(128, args2), 0x1)
- 261 : : }
- 262 : :
- 263 : 2 : if (debtToCover == type(uint128).max) {
- 264 : 2 : debtToCover = type(uint256).max;
- 265 : : }
- 266 : :
- 267 : 2 : return (
- 268 : : reservesList[collateralAssetId],
- 269 : : reservesList[debtAssetId],
- 270 : : user,
- 271 : : debtToCover,
- 272 : : receiveAToken
- 273 : : );
- 274 : : }
- 275 : : }
+ 212 : : assembly {
+ 213 : 1 : collateralAssetId := and(args1, 0xFFFF)
+ 214 : 1 : debtAssetId := and(shr(16, args1), 0xFFFF)
+ 215 : 1 : user := and(shr(32, args1), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
+ 216 : :
+ 217 : 1 : debtToCover := and(args2, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
+ 218 : 1 : receiveAToken := and(shr(128, args2), 0x1)
+ 219 : : }
+ 220 : :
+ 221 : 1 : if (debtToCover == type(uint128).max) {
+ 222 : 1 : debtToCover = type(uint256).max;
+ 223 : : }
+ 224 : :
+ 225 : 1 : return (
+ 226 : : reservesList[collateralAssetId],
+ 227 : : reservesList[debtAssetId],
+ 228 : : user,
+ 229 : : debtToCover,
+ 230 : : receiveAToken
+ 231 : : );
+ 232 : : }
+ 233 : : }
@@ -351,8 +309,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/ConfiguratorLogic.sol.func-c.html b/report/protocol/libraries/logic/ConfiguratorLogic.sol.func-c.html
similarity index 58%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/ConfiguratorLogic.sol.func-c.html
rename to report/protocol/libraries/logic/ConfiguratorLogic.sol.func-c.html
index 18a1b637..f02cd1f0 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/ConfiguratorLogic.sol.func-c.html
+++ b/report/protocol/libraries/logic/ConfiguratorLogic.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/ConfiguratorLogic.sol - functions
-
+ LCOV - lcov.info.p - protocol/libraries/logic/ConfiguratorLogic.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,63 +53,56 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../glass.png) |
- ConfiguratorLogic.executeUpdateAToken |
+ ConfiguratorLogic.executeUpdateAToken |
1 |
- ConfiguratorLogic.executeUpdateStableDebtToken |
+ ConfiguratorLogic.executeUpdateVariableDebtToken |
1 |
- ConfiguratorLogic.executeUpdateVariableDebtToken |
+ ConfiguratorLogic._upgradeTokenImplementation |
- 1 |
-
-
-
-
- ConfiguratorLogic._upgradeTokenImplementation |
-
- 3 |
+ 2 |
- ConfiguratorLogic.executeInitReserve |
+ ConfiguratorLogic.executeInitReserve |
- 2882 |
+ 167016 |
- ConfiguratorLogic._initTokenWithProxy |
+ ConfiguratorLogic._initTokenWithProxy |
- 8646 |
+ 332032 |
@@ -117,8 +110,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/ConfiguratorLogic.sol.func.html b/report/protocol/libraries/logic/ConfiguratorLogic.sol.func.html
similarity index 58%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/ConfiguratorLogic.sol.func.html
rename to report/protocol/libraries/logic/ConfiguratorLogic.sol.func.html
index 7c2a5362..a049e220 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/ConfiguratorLogic.sol.func.html
+++ b/report/protocol/libraries/logic/ConfiguratorLogic.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/ConfiguratorLogic.sol - functions
-
+ LCOV - lcov.info.p - protocol/libraries/logic/ConfiguratorLogic.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,61 +53,54 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../updown.png) |
- ConfiguratorLogic._initTokenWithProxy |
+ ConfiguratorLogic._initTokenWithProxy |
- 8646 |
+ 332032 |
- ConfiguratorLogic._upgradeTokenImplementation |
+ ConfiguratorLogic._upgradeTokenImplementation |
- 3 |
+ 2 |
- ConfiguratorLogic.executeInitReserve |
+ ConfiguratorLogic.executeInitReserve |
- 2882 |
+ 167016 |
- ConfiguratorLogic.executeUpdateAToken |
+ ConfiguratorLogic.executeUpdateAToken |
1 |
- ConfiguratorLogic.executeUpdateStableDebtToken |
-
- 1 |
-
-
-
-
- ConfiguratorLogic.executeUpdateVariableDebtToken |
+ ConfiguratorLogic.executeUpdateVariableDebtToken |
1 |
@@ -117,8 +110,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/ConfiguratorLogic.sol.gcov.html b/report/protocol/libraries/logic/ConfiguratorLogic.sol.gcov.html
similarity index 70%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/ConfiguratorLogic.sol.gcov.html
rename to report/protocol/libraries/logic/ConfiguratorLogic.sol.gcov.html
index 4fdc41b6..631f7a40 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/ConfiguratorLogic.sol.gcov.html
+++ b/report/protocol/libraries/logic/ConfiguratorLogic.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/ConfiguratorLogic.sol
-
+ LCOV - lcov.info.p - protocol/libraries/logic/ConfiguratorLogic.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -75,275 +75,223 @@
4 : : import {IPool} from '../../../interfaces/IPool.sol';
5 : : import {IInitializableAToken} from '../../../interfaces/IInitializableAToken.sol';
6 : : import {IInitializableDebtToken} from '../../../interfaces/IInitializableDebtToken.sol';
- 7 : : import {InitializableImmutableAdminUpgradeabilityProxy} from '../aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol';
+ 7 : : import {InitializableImmutableAdminUpgradeabilityProxy} from '../../../misc/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol';
8 : : import {IReserveInterestRateStrategy} from '../../../interfaces/IReserveInterestRateStrategy.sol';
9 : : import {ReserveConfiguration} from '../configuration/ReserveConfiguration.sol';
10 : : import {DataTypes} from '../types/DataTypes.sol';
- 11 : : import {ConfiguratorInputTypes} from '../types/ConfiguratorInputTypes.sol';
- 12 : :
- 13 : : /**
- 14 : : * @title ConfiguratorLogic library
- 15 : : * @author Aave
- 16 : : * @notice Implements the functions to initialize reserves and update aTokens and debtTokens
- 17 : : */
- 18 : : library ConfiguratorLogic {
- 19 : : using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
- 20 : :
- 21 : : // See `IPoolConfigurator` for descriptions
- 22 : : event ReserveInitialized(
- 23 : : address indexed asset,
- 24 : : address indexed aToken,
- 25 : : address stableDebtToken,
- 26 : : address variableDebtToken,
- 27 : : address interestRateStrategyAddress
- 28 : : );
- 29 : : event ATokenUpgraded(
- 30 : : address indexed asset,
- 31 : : address indexed proxy,
- 32 : : address indexed implementation
- 33 : : );
- 34 : : event StableDebtTokenUpgraded(
- 35 : : address indexed asset,
- 36 : : address indexed proxy,
- 37 : : address indexed implementation
- 38 : : );
- 39 : : event VariableDebtTokenUpgraded(
- 40 : : address indexed asset,
- 41 : : address indexed proxy,
- 42 : : address indexed implementation
- 43 : : );
- 44 : :
- 45 : : /**
- 46 : : * @notice Initialize a reserve by creating and initializing aToken, stable debt token and variable debt token
- 47 : : * @dev Emits the `ReserveInitialized` event
- 48 : : * @param pool The Pool in which the reserve will be initialized
- 49 : : * @param input The needed parameters for the initialization
- 50 : : */
- 51 : 2882 : function executeInitReserve(
- 52 : : IPool pool,
- 53 : : ConfiguratorInputTypes.InitReserveInput calldata input
- 54 : : ) public {
- 55 : 8646 : address aTokenProxyAddress = _initTokenWithProxy(
- 56 : : input.aTokenImpl,
- 57 : : abi.encodeWithSelector(
- 58 : : IInitializableAToken.initialize.selector,
- 59 : : pool,
- 60 : : input.treasury,
- 61 : : input.underlyingAsset,
- 62 : : input.incentivesController,
- 63 : : input.underlyingAssetDecimals,
- 64 : : input.aTokenName,
- 65 : : input.aTokenSymbol,
- 66 : : input.params
- 67 : : )
- 68 : : );
- 69 : :
- 70 : 8646 : address stableDebtTokenProxyAddress = _initTokenWithProxy(
- 71 : : input.stableDebtTokenImpl,
- 72 : : abi.encodeWithSelector(
- 73 : : IInitializableDebtToken.initialize.selector,
- 74 : : pool,
- 75 : : input.underlyingAsset,
- 76 : : input.incentivesController,
- 77 : : input.underlyingAssetDecimals,
- 78 : : input.stableDebtTokenName,
- 79 : : input.stableDebtTokenSymbol,
- 80 : : input.params
- 81 : : )
- 82 : : );
- 83 : :
- 84 : 8646 : address variableDebtTokenProxyAddress = _initTokenWithProxy(
- 85 : : input.variableDebtTokenImpl,
- 86 : : abi.encodeWithSelector(
- 87 : : IInitializableDebtToken.initialize.selector,
- 88 : : pool,
- 89 : : input.underlyingAsset,
- 90 : : input.incentivesController,
- 91 : : input.underlyingAssetDecimals,
- 92 : : input.variableDebtTokenName,
- 93 : : input.variableDebtTokenSymbol,
- 94 : : input.params
- 95 : : )
- 96 : : );
- 97 : :
- 98 : 5764 : pool.initReserve(
- 99 : : input.underlyingAsset,
- 100 : : aTokenProxyAddress,
- 101 : : stableDebtTokenProxyAddress,
- 102 : : variableDebtTokenProxyAddress,
- 103 : : input.interestRateStrategyAddress
- 104 : : );
- 105 : :
- 106 : 8643 : DataTypes.ReserveConfigurationMap memory currentConfig = DataTypes.ReserveConfigurationMap(0);
+ 11 : : import {Errors} from '../helpers/Errors.sol';
+ 12 : : import {ConfiguratorInputTypes} from '../types/ConfiguratorInputTypes.sol';
+ 13 : : import {IERC20Detailed} from '../../../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
+ 14 : :
+ 15 : : /**
+ 16 : : * @title ConfiguratorLogic library
+ 17 : : * @author Aave
+ 18 : : * @notice Implements the functions to initialize reserves and update aTokens and debtTokens
+ 19 : : */
+ 20 : : library ConfiguratorLogic {
+ 21 : : using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
+ 22 : :
+ 23 : : // See `IPoolConfigurator` for descriptions
+ 24 : : event ReserveInitialized(
+ 25 : : address indexed asset,
+ 26 : : address indexed aToken,
+ 27 : : address stableDebtToken,
+ 28 : : address variableDebtToken,
+ 29 : : address interestRateStrategyAddress
+ 30 : : );
+ 31 : : event ATokenUpgraded(
+ 32 : : address indexed asset,
+ 33 : : address indexed proxy,
+ 34 : : address indexed implementation
+ 35 : : );
+ 36 : : event VariableDebtTokenUpgraded(
+ 37 : : address indexed asset,
+ 38 : : address indexed proxy,
+ 39 : : address indexed implementation
+ 40 : : );
+ 41 : :
+ 42 : : /**
+ 43 : : * @notice Initialize a reserve by creating and initializing aToken and variable debt token
+ 44 : : * @dev Emits the `ReserveInitialized` event
+ 45 : : * @param pool The Pool in which the reserve will be initialized
+ 46 : : * @param input The needed parameters for the initialization
+ 47 : : */
+ 48 : : function executeInitReserve(
+ 49 : : IPool pool,
+ 50 : : ConfiguratorInputTypes.InitReserveInput calldata input
+ 51 : : ) external {
+ 52 : : // It is an assumption that the asset listed is non-malicious, and the external call doesn't create re-entrancies
+ 53 : 167016 : uint8 underlyingAssetDecimals = IERC20Detailed(input.underlyingAsset).decimals();
+ 54 : 167016 : require(underlyingAssetDecimals > 5, Errors.INVALID_DECIMALS);
+ 55 : :
+ 56 : 166016 : address aTokenProxyAddress = _initTokenWithProxy(
+ 57 : : input.aTokenImpl,
+ 58 : : abi.encodeWithSelector(
+ 59 : : IInitializableAToken.initialize.selector,
+ 60 : : pool,
+ 61 : : input.treasury,
+ 62 : : input.underlyingAsset,
+ 63 : : input.incentivesController,
+ 64 : : underlyingAssetDecimals,
+ 65 : : input.aTokenName,
+ 66 : : input.aTokenSymbol,
+ 67 : : input.params
+ 68 : : )
+ 69 : : );
+ 70 : :
+ 71 : 166016 : address variableDebtTokenProxyAddress = _initTokenWithProxy(
+ 72 : : input.variableDebtTokenImpl,
+ 73 : : abi.encodeWithSelector(
+ 74 : : IInitializableDebtToken.initialize.selector,
+ 75 : : pool,
+ 76 : : input.underlyingAsset,
+ 77 : : input.incentivesController,
+ 78 : : underlyingAssetDecimals,
+ 79 : : input.variableDebtTokenName,
+ 80 : : input.variableDebtTokenSymbol,
+ 81 : : input.params
+ 82 : : )
+ 83 : : );
+ 84 : :
+ 85 : 166016 : pool.initReserve(
+ 86 : : input.underlyingAsset,
+ 87 : : aTokenProxyAddress,
+ 88 : : variableDebtTokenProxyAddress,
+ 89 : : input.interestRateStrategyAddress
+ 90 : : );
+ 91 : :
+ 92 : 165016 : DataTypes.ReserveConfigurationMap memory currentConfig = DataTypes.ReserveConfigurationMap(0);
+ 93 : :
+ 94 : 165016 : currentConfig.setDecimals(underlyingAssetDecimals);
+ 95 : :
+ 96 : 165016 : currentConfig.setActive(true);
+ 97 : 165016 : currentConfig.setPaused(false);
+ 98 : 165016 : currentConfig.setFrozen(false);
+ 99 : 165016 : currentConfig.setVirtualAccActive(input.useVirtualBalance);
+ 100 : :
+ 101 : 165016 : pool.setConfiguration(input.underlyingAsset, currentConfig);
+ 102 : :
+ 103 : 165016 : IReserveInterestRateStrategy(input.interestRateStrategyAddress).setInterestRateParams(
+ 104 : : input.underlyingAsset,
+ 105 : : input.interestRateData
+ 106 : : );
107 : :
- 108 : 5762 : currentConfig.setDecimals(input.underlyingAssetDecimals);
- 109 : :
- 110 : 5762 : currentConfig.setActive(true);
- 111 : 5762 : currentConfig.setPaused(false);
- 112 : 5762 : currentConfig.setFrozen(false);
- 113 : 5762 : currentConfig.setVirtualAccActive(input.useVirtualBalance);
- 114 : :
- 115 : 5762 : pool.setConfiguration(input.underlyingAsset, currentConfig);
+ 108 : 165016 : emit ReserveInitialized(
+ 109 : : input.underlyingAsset,
+ 110 : : aTokenProxyAddress,
+ 111 : : address(0),
+ 112 : : variableDebtTokenProxyAddress,
+ 113 : : input.interestRateStrategyAddress
+ 114 : : );
+ 115 : : }
116 : :
- 117 : 5762 : IReserveInterestRateStrategy(input.interestRateStrategyAddress).setInterestRateParams(
- 118 : : input.underlyingAsset,
- 119 : : input.interestRateData
- 120 : : );
- 121 : :
- 122 : 5762 : emit ReserveInitialized(
- 123 : : input.underlyingAsset,
- 124 : : aTokenProxyAddress,
- 125 : : stableDebtTokenProxyAddress,
- 126 : : variableDebtTokenProxyAddress,
- 127 : : input.interestRateStrategyAddress
- 128 : : );
- 129 : : }
+ 117 : : /**
+ 118 : : * @notice Updates the aToken implementation and initializes it
+ 119 : : * @dev Emits the `ATokenUpgraded` event
+ 120 : : * @param cachedPool The Pool containing the reserve with the aToken
+ 121 : : * @param input The parameters needed for the initialize call
+ 122 : : */
+ 123 : : function executeUpdateAToken(
+ 124 : : IPool cachedPool,
+ 125 : : ConfiguratorInputTypes.UpdateATokenInput calldata input
+ 126 : : ) external {
+ 127 : 1 : DataTypes.ReserveDataLegacy memory reserveData = cachedPool.getReserveData(input.asset);
+ 128 : :
+ 129 : 1 : (, , , uint256 decimals, ) = cachedPool.getConfiguration(input.asset).getParams();
130 : :
- 131 : : /**
- 132 : : * @notice Updates the aToken implementation and initializes it
- 133 : : * @dev Emits the `ATokenUpgraded` event
- 134 : : * @param cachedPool The Pool containing the reserve with the aToken
- 135 : : * @param input The parameters needed for the initialize call
- 136 : : */
- 137 : 1 : function executeUpdateAToken(
- 138 : : IPool cachedPool,
- 139 : : ConfiguratorInputTypes.UpdateATokenInput calldata input
- 140 : : ) public {
- 141 : 3 : DataTypes.ReserveDataLegacy memory reserveData = cachedPool.getReserveData(input.asset);
+ 131 : 1 : bytes memory encodedCall = abi.encodeWithSelector(
+ 132 : : IInitializableAToken.initialize.selector,
+ 133 : : cachedPool,
+ 134 : : input.treasury,
+ 135 : : input.asset,
+ 136 : : input.incentivesController,
+ 137 : : decimals,
+ 138 : : input.name,
+ 139 : : input.symbol,
+ 140 : : input.params
+ 141 : : );
142 : :
- 143 : 3 : (, , , uint256 decimals, , ) = cachedPool.getConfiguration(input.asset).getParams();
+ 143 : 1 : _upgradeTokenImplementation(reserveData.aTokenAddress, input.implementation, encodedCall);
144 : :
- 145 : 3 : bytes memory encodedCall = abi.encodeWithSelector(
- 146 : : IInitializableAToken.initialize.selector,
- 147 : : cachedPool,
- 148 : : input.treasury,
- 149 : : input.asset,
- 150 : : input.incentivesController,
- 151 : : decimals,
- 152 : : input.name,
- 153 : : input.symbol,
- 154 : : input.params
- 155 : : );
- 156 : :
- 157 : 2 : _upgradeTokenImplementation(reserveData.aTokenAddress, input.implementation, encodedCall);
- 158 : :
- 159 : 2 : emit ATokenUpgraded(input.asset, reserveData.aTokenAddress, input.implementation);
- 160 : : }
+ 145 : 1 : emit ATokenUpgraded(input.asset, reserveData.aTokenAddress, input.implementation);
+ 146 : : }
+ 147 : :
+ 148 : : /**
+ 149 : : * @notice Updates the variable debt token implementation and initializes it
+ 150 : : * @dev Emits the `VariableDebtTokenUpgraded` event
+ 151 : : * @param cachedPool The Pool containing the reserve with the variable debt token
+ 152 : : * @param input The parameters needed for the initialize call
+ 153 : : */
+ 154 : : function executeUpdateVariableDebtToken(
+ 155 : : IPool cachedPool,
+ 156 : : ConfiguratorInputTypes.UpdateDebtTokenInput calldata input
+ 157 : : ) external {
+ 158 : 1 : DataTypes.ReserveDataLegacy memory reserveData = cachedPool.getReserveData(input.asset);
+ 159 : :
+ 160 : 1 : (, , , uint256 decimals, ) = cachedPool.getConfiguration(input.asset).getParams();
161 : :
- 162 : : /**
- 163 : : * @notice Updates the stable debt token implementation and initializes it
- 164 : : * @dev Emits the `StableDebtTokenUpgraded` event
- 165 : : * @param cachedPool The Pool containing the reserve with the stable debt token
- 166 : : * @param input The parameters needed for the initialize call
- 167 : : */
- 168 : 1 : function executeUpdateStableDebtToken(
- 169 : : IPool cachedPool,
- 170 : : ConfiguratorInputTypes.UpdateDebtTokenInput calldata input
- 171 : : ) public {
- 172 : 3 : DataTypes.ReserveDataLegacy memory reserveData = cachedPool.getReserveData(input.asset);
- 173 : :
- 174 : 3 : (, , , uint256 decimals, , ) = cachedPool.getConfiguration(input.asset).getParams();
- 175 : :
- 176 : 3 : bytes memory encodedCall = abi.encodeWithSelector(
- 177 : : IInitializableDebtToken.initialize.selector,
- 178 : : cachedPool,
- 179 : : input.asset,
- 180 : : input.incentivesController,
- 181 : : decimals,
- 182 : : input.name,
- 183 : : input.symbol,
- 184 : : input.params
- 185 : : );
- 186 : :
- 187 : 2 : _upgradeTokenImplementation(
- 188 : : reserveData.stableDebtTokenAddress,
- 189 : : input.implementation,
- 190 : : encodedCall
- 191 : : );
- 192 : :
- 193 : 2 : emit StableDebtTokenUpgraded(
- 194 : : input.asset,
- 195 : : reserveData.stableDebtTokenAddress,
- 196 : : input.implementation
- 197 : : );
- 198 : : }
+ 162 : 1 : bytes memory encodedCall = abi.encodeWithSelector(
+ 163 : : IInitializableDebtToken.initialize.selector,
+ 164 : : cachedPool,
+ 165 : : input.asset,
+ 166 : : input.incentivesController,
+ 167 : : decimals,
+ 168 : : input.name,
+ 169 : : input.symbol,
+ 170 : : input.params
+ 171 : : );
+ 172 : :
+ 173 : 1 : _upgradeTokenImplementation(
+ 174 : : reserveData.variableDebtTokenAddress,
+ 175 : : input.implementation,
+ 176 : : encodedCall
+ 177 : : );
+ 178 : :
+ 179 : 1 : emit VariableDebtTokenUpgraded(
+ 180 : : input.asset,
+ 181 : : reserveData.variableDebtTokenAddress,
+ 182 : : input.implementation
+ 183 : : );
+ 184 : : }
+ 185 : :
+ 186 : : /**
+ 187 : : * @notice Creates a new proxy and initializes the implementation
+ 188 : : * @param implementation The address of the implementation
+ 189 : : * @param initParams The parameters that is passed to the implementation to initialize
+ 190 : : * @return The address of initialized proxy
+ 191 : : */
+ 192 : : function _initTokenWithProxy(
+ 193 : : address implementation,
+ 194 : : bytes memory initParams
+ 195 : : ) internal returns (address) {
+ 196 : 332032 : InitializableImmutableAdminUpgradeabilityProxy proxy = new InitializableImmutableAdminUpgradeabilityProxy(
+ 197 : : address(this)
+ 198 : : );
199 : :
- 200 : : /**
- 201 : : * @notice Updates the variable debt token implementation and initializes it
- 202 : : * @dev Emits the `VariableDebtTokenUpgraded` event
- 203 : : * @param cachedPool The Pool containing the reserve with the variable debt token
- 204 : : * @param input The parameters needed for the initialize call
- 205 : : */
- 206 : 1 : function executeUpdateVariableDebtToken(
- 207 : : IPool cachedPool,
- 208 : : ConfiguratorInputTypes.UpdateDebtTokenInput calldata input
- 209 : : ) public {
- 210 : 3 : DataTypes.ReserveDataLegacy memory reserveData = cachedPool.getReserveData(input.asset);
- 211 : :
- 212 : 3 : (, , , uint256 decimals, , ) = cachedPool.getConfiguration(input.asset).getParams();
- 213 : :
- 214 : 3 : bytes memory encodedCall = abi.encodeWithSelector(
- 215 : : IInitializableDebtToken.initialize.selector,
- 216 : : cachedPool,
- 217 : : input.asset,
- 218 : : input.incentivesController,
- 219 : : decimals,
- 220 : : input.name,
- 221 : : input.symbol,
- 222 : : input.params
- 223 : : );
- 224 : :
- 225 : 2 : _upgradeTokenImplementation(
- 226 : : reserveData.variableDebtTokenAddress,
- 227 : : input.implementation,
- 228 : : encodedCall
- 229 : : );
- 230 : :
- 231 : 2 : emit VariableDebtTokenUpgraded(
- 232 : : input.asset,
- 233 : : reserveData.variableDebtTokenAddress,
- 234 : : input.implementation
- 235 : : );
- 236 : : }
- 237 : :
- 238 : : /**
- 239 : : * @notice Creates a new proxy and initializes the implementation
- 240 : : * @param implementation The address of the implementation
- 241 : : * @param initParams The parameters that is passed to the implementation to initialize
- 242 : : * @return The address of initialized proxy
- 243 : : */
- 244 : 8646 : function _initTokenWithProxy(
- 245 : : address implementation,
- 246 : : bytes memory initParams
- 247 : : ) internal returns (address) {
- 248 : 25938 : InitializableImmutableAdminUpgradeabilityProxy proxy = new InitializableImmutableAdminUpgradeabilityProxy(
- 249 : : address(this)
- 250 : : );
- 251 : :
- 252 : 17292 : proxy.initialize(implementation, initParams);
- 253 : :
- 254 : 25938 : return address(proxy);
- 255 : : }
- 256 : :
- 257 : : /**
- 258 : : * @notice Upgrades the implementation and makes call to the proxy
- 259 : : * @dev The call is used to initialize the new implementation.
- 260 : : * @param proxyAddress The address of the proxy
- 261 : : * @param implementation The address of the new implementation
- 262 : : * @param initParams The parameters to the call after the upgrade
- 263 : : */
- 264 : 3 : function _upgradeTokenImplementation(
- 265 : : address proxyAddress,
- 266 : : address implementation,
- 267 : : bytes memory initParams
- 268 : : ) internal {
- 269 : 9 : InitializableImmutableAdminUpgradeabilityProxy proxy = InitializableImmutableAdminUpgradeabilityProxy(
- 270 : : payable(proxyAddress)
- 271 : : );
- 272 : :
- 273 : 6 : proxy.upgradeToAndCall(implementation, initParams);
- 274 : : }
- 275 : : }
+ 200 : 332032 : proxy.initialize(implementation, initParams);
+ 201 : :
+ 202 : 332032 : return address(proxy);
+ 203 : : }
+ 204 : :
+ 205 : : /**
+ 206 : : * @notice Upgrades the implementation and makes call to the proxy
+ 207 : : * @dev The call is used to initialize the new implementation.
+ 208 : : * @param proxyAddress The address of the proxy
+ 209 : : * @param implementation The address of the new implementation
+ 210 : : * @param initParams The parameters to the call after the upgrade
+ 211 : : */
+ 212 : : function _upgradeTokenImplementation(
+ 213 : : address proxyAddress,
+ 214 : : address implementation,
+ 215 : : bytes memory initParams
+ 216 : : ) internal {
+ 217 : 2 : InitializableImmutableAdminUpgradeabilityProxy proxy = InitializableImmutableAdminUpgradeabilityProxy(
+ 218 : : payable(proxyAddress)
+ 219 : : );
+ 220 : :
+ 221 : 2 : proxy.upgradeToAndCall(implementation, initParams);
+ 222 : : }
+ 223 : : }
@@ -351,8 +299,8 @@
diff --git a/report/core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers/Helpers.sol.func-c.html b/report/protocol/libraries/logic/EModeLogic.sol.func-c.html
similarity index 61%
rename from report/core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers/Helpers.sol.func-c.html
rename to report/protocol/libraries/logic/EModeLogic.sol.func-c.html
index a08c245a..b91e86f1 100644
--- a/report/core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers/Helpers.sol.func-c.html
+++ b/report/protocol/libraries/logic/EModeLogic.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers/Helpers.sol - functions
-
+ LCOV - lcov.info.p - protocol/libraries/logic/EModeLogic.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,12 +32,12 @@
|
-
-
+
+
-
+
|
@@ -53,28 +53,28 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../glass.png) |
- Helpers.getUserCurrentDebt |
+ EModeLogic.executeSetUserEMode |
- 16329 |
+ 10023 |
@@ -82,8 +82,8 @@
diff --git a/report/core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers/Helpers.sol.func.html b/report/protocol/libraries/logic/EModeLogic.sol.func.html
similarity index 61%
rename from report/core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers/Helpers.sol.func.html
rename to report/protocol/libraries/logic/EModeLogic.sol.func.html
index 19e5c2c8..da8b6f51 100644
--- a/report/core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers/Helpers.sol.func.html
+++ b/report/protocol/libraries/logic/EModeLogic.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/helpers/src/core/contracts/protocol/libraries/helpers/Helpers.sol - functions
-
+ LCOV - lcov.info.p - protocol/libraries/logic/EModeLogic.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,12 +32,12 @@
|
-
-
+
+
-
+
|
@@ -53,28 +53,28 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../updown.png) |
- Helpers.getUserCurrentDebt |
+ EModeLogic.executeSetUserEMode |
- 16329 |
+ 10023 |
@@ -82,8 +82,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/EModeLogic.sol.gcov.html b/report/protocol/libraries/logic/EModeLogic.sol.gcov.html
similarity index 58%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/EModeLogic.sol.gcov.html
rename to report/protocol/libraries/logic/EModeLogic.sol.gcov.html
index 384dd6a1..8a40b95b 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/EModeLogic.sol.gcov.html
+++ b/report/protocol/libraries/logic/EModeLogic.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/EModeLogic.sol
-
+ LCOV - lcov.info.p - protocol/libraries/logic/EModeLogic.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -76,111 +76,71 @@
5 : : import {IERC20} from '../../../dependencies/openzeppelin/contracts/IERC20.sol';
6 : : import {IPriceOracleGetter} from '../../../interfaces/IPriceOracleGetter.sol';
7 : : import {UserConfiguration} from '../configuration/UserConfiguration.sol';
- 8 : : import {Errors} from '../helpers/Errors.sol';
- 9 : : import {WadRayMath} from '../math/WadRayMath.sol';
- 10 : : import {PercentageMath} from '../math/PercentageMath.sol';
- 11 : : import {DataTypes} from '../types/DataTypes.sol';
- 12 : : import {ValidationLogic} from './ValidationLogic.sol';
- 13 : : import {ReserveLogic} from './ReserveLogic.sol';
- 14 : :
- 15 : : /**
- 16 : : * @title EModeLogic library
- 17 : : * @author Aave
- 18 : : * @notice Implements the base logic for all the actions related to the eMode
- 19 : : */
- 20 : : library EModeLogic {
- 21 : : using ReserveLogic for DataTypes.ReserveCache;
- 22 : : using ReserveLogic for DataTypes.ReserveData;
- 23 : : using GPv2SafeERC20 for IERC20;
- 24 : : using UserConfiguration for DataTypes.UserConfigurationMap;
- 25 : : using WadRayMath for uint256;
- 26 : : using PercentageMath for uint256;
- 27 : :
- 28 : : // See `IPool` for descriptions
- 29 : : event UserEModeSet(address indexed user, uint8 categoryId);
- 30 : :
- 31 : : /**
- 32 : : * @notice Updates the user efficiency mode category
- 33 : : * @dev Will revert if user is borrowing non-compatible asset or change will drop HF < HEALTH_FACTOR_LIQUIDATION_THRESHOLD
- 34 : : * @dev Emits the `UserEModeSet` event
- 35 : : * @param reservesData The state of all the reserves
- 36 : : * @param reservesList The addresses of all the active reserves
- 37 : : * @param eModeCategories The configuration of all the efficiency mode categories
- 38 : : * @param usersEModeCategory The state of all users efficiency mode category
- 39 : : * @param userConfig The user configuration mapping that tracks the supplied/borrowed assets
- 40 : : * @param params The additional parameters needed to execute the setUserEMode function
- 41 : : */
- 42 : 17 : function executeSetUserEMode(
- 43 : : mapping(address => DataTypes.ReserveData) storage reservesData,
- 44 : : mapping(uint256 => address) storage reservesList,
- 45 : : mapping(uint8 => DataTypes.EModeCategory) storage eModeCategories,
- 46 : : mapping(address => uint8) storage usersEModeCategory,
- 47 : : DataTypes.UserConfigurationMap storage userConfig,
- 48 : : DataTypes.ExecuteSetUserEModeParams memory params
- 49 : : ) external {
- 50 : 34 : ValidationLogic.validateSetUserEMode(
- 51 : : reservesData,
- 52 : : reservesList,
- 53 : : eModeCategories,
- 54 : : userConfig,
- 55 : : params.reservesCount,
- 56 : : params.categoryId
- 57 : : );
- 58 : :
- 59 : 30 : uint8 prevCategoryId = usersEModeCategory[msg.sender];
- 60 : 30 : usersEModeCategory[msg.sender] = params.categoryId;
- 61 : :
- 62 : 30 : if (prevCategoryId != 0) {
- 63 : 8 : ValidationLogic.validateHealthFactor(
- 64 : : reservesData,
- 65 : : reservesList,
- 66 : : eModeCategories,
- 67 : : userConfig,
- 68 : : msg.sender,
- 69 : : params.categoryId,
- 70 : : params.reservesCount,
- 71 : : params.oracle
- 72 : : );
- 73 : : }
- 74 : 26 : emit UserEModeSet(msg.sender, params.categoryId);
- 75 : : }
- 76 : :
- 77 : : /**
- 78 : : * @notice Gets the eMode configuration and calculates the eMode asset price if a custom oracle is configured
- 79 : : * @dev The eMode asset price returned is 0 if no oracle is specified
- 80 : : * @param category The user eMode category
- 81 : : * @param oracle The price oracle
- 82 : : * @return The eMode ltv
- 83 : : * @return The eMode liquidation threshold
- 84 : : * @return The eMode asset price
- 85 : : */
- 86 : 10 : function getEModeConfiguration(
- 87 : : DataTypes.EModeCategory storage category,
- 88 : : IPriceOracleGetter oracle
- 89 : : ) internal view returns (uint256, uint256, uint256) {
- 90 : 20 : uint256 eModeAssetPrice = 0;
- 91 : 20 : address eModePriceSource = category.priceSource;
- 92 : :
- 93 : 30 : if (eModePriceSource != address(0)) {
- 94 : 6 : eModeAssetPrice = oracle.getAssetPrice(eModePriceSource);
- 95 : : }
- 96 : :
- 97 : 20 : return (category.ltv, category.liquidationThreshold, eModeAssetPrice);
- 98 : : }
- 99 : :
- 100 : : /**
- 101 : : * @notice Checks if eMode is active for a user and if yes, if the asset belongs to the eMode category chosen
- 102 : : * @param eModeUserCategory The user eMode category
- 103 : : * @param eModeAssetCategory The asset eMode category
- 104 : : * @return True if eMode is active and the asset belongs to the eMode category chosen by the user, false otherwise
- 105 : : */
- 106 : 25421 : function isInEModeCategory(
- 107 : : uint256 eModeUserCategory,
- 108 : : uint256 eModeAssetCategory
- 109 : : ) internal pure returns (bool) {
- 110 : 50842 : return (eModeUserCategory != 0 && eModeAssetCategory == eModeUserCategory);
- 111 : : }
- 112 : : }
+ 8 : : import {WadRayMath} from '../math/WadRayMath.sol';
+ 9 : : import {PercentageMath} from '../math/PercentageMath.sol';
+ 10 : : import {DataTypes} from '../types/DataTypes.sol';
+ 11 : : import {ValidationLogic} from './ValidationLogic.sol';
+ 12 : : import {ReserveLogic} from './ReserveLogic.sol';
+ 13 : :
+ 14 : : /**
+ 15 : : * @title EModeLogic library
+ 16 : : * @author Aave
+ 17 : : * @notice Implements the base logic for all the actions related to the eMode
+ 18 : : */
+ 19 : : library EModeLogic {
+ 20 : : using ReserveLogic for DataTypes.ReserveCache;
+ 21 : : using ReserveLogic for DataTypes.ReserveData;
+ 22 : : using GPv2SafeERC20 for IERC20;
+ 23 : : using UserConfiguration for DataTypes.UserConfigurationMap;
+ 24 : : using WadRayMath for uint256;
+ 25 : : using PercentageMath for uint256;
+ 26 : :
+ 27 : : // See `IPool` for descriptions
+ 28 : : event UserEModeSet(address indexed user, uint8 categoryId);
+ 29 : :
+ 30 : : /**
+ 31 : : * @notice Updates the user efficiency mode category
+ 32 : : * @dev Will revert if user is borrowing non-compatible asset or change will drop HF < HEALTH_FACTOR_LIQUIDATION_THRESHOLD
+ 33 : : * @dev Emits the `UserEModeSet` event
+ 34 : : * @param reservesData The state of all the reserves
+ 35 : : * @param reservesList The addresses of all the active reserves
+ 36 : : * @param eModeCategories The configuration of all the efficiency mode categories
+ 37 : : * @param usersEModeCategory The state of all users efficiency mode category
+ 38 : : * @param userConfig The user configuration mapping that tracks the supplied/borrowed assets
+ 39 : : * @param params The additional parameters needed to execute the setUserEMode function
+ 40 : : */
+ 41 : : function executeSetUserEMode(
+ 42 : : mapping(address => DataTypes.ReserveData) storage reservesData,
+ 43 : : mapping(uint256 => address) storage reservesList,
+ 44 : : mapping(uint8 => DataTypes.EModeCategory) storage eModeCategories,
+ 45 : : mapping(address => uint8) storage usersEModeCategory,
+ 46 : : DataTypes.UserConfigurationMap storage userConfig,
+ 47 : : DataTypes.ExecuteSetUserEModeParams memory params
+ 48 : : ) external {
+ 49 : 10023 : if (usersEModeCategory[msg.sender] == params.categoryId) return;
+ 50 : :
+ 51 : 9617 : ValidationLogic.validateSetUserEMode(
+ 52 : : eModeCategories,
+ 53 : : userConfig,
+ 54 : : params.reservesCount,
+ 55 : : params.categoryId
+ 56 : : );
+ 57 : :
+ 58 : 8614 : usersEModeCategory[msg.sender] = params.categoryId;
+ 59 : :
+ 60 : 8614 : ValidationLogic.validateHealthFactor(
+ 61 : : reservesData,
+ 62 : : reservesList,
+ 63 : : eModeCategories,
+ 64 : : userConfig,
+ 65 : : msg.sender,
+ 66 : : params.categoryId,
+ 67 : : params.reservesCount,
+ 68 : : params.oracle
+ 69 : : );
+ 70 : 7612 : emit UserEModeSet(msg.sender, params.categoryId);
+ 71 : : }
+ 72 : : }
@@ -188,8 +148,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/FlashLoanLogic.sol.func-c.html b/report/protocol/libraries/logic/FlashLoanLogic.sol.func-c.html
similarity index 64%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/FlashLoanLogic.sol.func-c.html
rename to report/protocol/libraries/logic/FlashLoanLogic.sol.func-c.html
index 0c15f6b5..7b2a86e7 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/FlashLoanLogic.sol.func-c.html
+++ b/report/protocol/libraries/logic/FlashLoanLogic.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/FlashLoanLogic.sol - functions
-
+ LCOV - lcov.info.p - protocol/libraries/logic/FlashLoanLogic.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -37,7 +37,7 @@
-
+
|
@@ -53,42 +53,42 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../glass.png) |
- FlashLoanLogic._handleFlashLoanRepayment |
+ FlashLoanLogic._handleFlashLoanRepayment |
9 |
- FlashLoanLogic.executeFlashLoan |
+ FlashLoanLogic.executeFlashLoanSimple |
- 10 |
+ 11 |
- FlashLoanLogic.executeFlashLoanSimple |
+ FlashLoanLogic.executeFlashLoan |
- 10 |
+ 1011 |
@@ -96,8 +96,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/FlashLoanLogic.sol.func.html b/report/protocol/libraries/logic/FlashLoanLogic.sol.func.html
similarity index 64%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/FlashLoanLogic.sol.func.html
rename to report/protocol/libraries/logic/FlashLoanLogic.sol.func.html
index 109511c1..8a6facb9 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/FlashLoanLogic.sol.func.html
+++ b/report/protocol/libraries/logic/FlashLoanLogic.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/FlashLoanLogic.sol - functions
-
+ LCOV - lcov.info.p - protocol/libraries/logic/FlashLoanLogic.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -37,7 +37,7 @@
-
+
|
@@ -53,42 +53,42 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../updown.png) |
- FlashLoanLogic._handleFlashLoanRepayment |
+ FlashLoanLogic._handleFlashLoanRepayment |
9 |
- FlashLoanLogic.executeFlashLoan |
+ FlashLoanLogic.executeFlashLoan |
- 10 |
+ 1011 |
- FlashLoanLogic.executeFlashLoanSimple |
+ FlashLoanLogic.executeFlashLoanSimple |
- 10 |
+ 11 |
@@ -96,8 +96,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/FlashLoanLogic.sol.gcov.html b/report/protocol/libraries/logic/FlashLoanLogic.sol.gcov.html
similarity index 86%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/FlashLoanLogic.sol.gcov.html
rename to report/protocol/libraries/logic/FlashLoanLogic.sol.gcov.html
index e1f8cbf5..fe13e711 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/FlashLoanLogic.sol.gcov.html
+++ b/report/protocol/libraries/logic/FlashLoanLogic.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/FlashLoanLogic.sol
-
+ LCOV - lcov.info.p - protocol/libraries/logic/FlashLoanLogic.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -37,7 +37,7 @@
-
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -77,282 +77,275 @@
6 : : import {IERC20} from '../../../dependencies/openzeppelin/contracts/IERC20.sol';
7 : : import {IAToken} from '../../../interfaces/IAToken.sol';
8 : : import {IPool} from '../../../interfaces/IPool.sol';
- 9 : : import {IFlashLoanReceiver} from '../../../flashloan/interfaces/IFlashLoanReceiver.sol';
- 10 : : import {IFlashLoanSimpleReceiver} from '../../../flashloan/interfaces/IFlashLoanSimpleReceiver.sol';
+ 9 : : import {IFlashLoanReceiver} from '../../../misc/flashloan/interfaces/IFlashLoanReceiver.sol';
+ 10 : : import {IFlashLoanSimpleReceiver} from '../../../misc/flashloan/interfaces/IFlashLoanSimpleReceiver.sol';
11 : : import {IPoolAddressesProvider} from '../../../interfaces/IPoolAddressesProvider.sol';
- 12 : : import {UserConfiguration} from '../configuration/UserConfiguration.sol';
- 13 : : import {ReserveConfiguration} from '../configuration/ReserveConfiguration.sol';
- 14 : : import {Errors} from '../helpers/Errors.sol';
- 15 : : import {WadRayMath} from '../math/WadRayMath.sol';
- 16 : : import {PercentageMath} from '../math/PercentageMath.sol';
- 17 : : import {DataTypes} from '../types/DataTypes.sol';
- 18 : : import {ValidationLogic} from './ValidationLogic.sol';
- 19 : : import {BorrowLogic} from './BorrowLogic.sol';
- 20 : : import {ReserveLogic} from './ReserveLogic.sol';
- 21 : :
- 22 : : /**
- 23 : : * @title FlashLoanLogic library
- 24 : : * @author Aave
- 25 : : * @notice Implements the logic for the flash loans
- 26 : : */
- 27 : : library FlashLoanLogic {
- 28 : : using ReserveLogic for DataTypes.ReserveCache;
- 29 : : using ReserveLogic for DataTypes.ReserveData;
- 30 : : using GPv2SafeERC20 for IERC20;
- 31 : : using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
- 32 : : using WadRayMath for uint256;
- 33 : : using PercentageMath for uint256;
- 34 : : using SafeCast for uint256;
- 35 : :
- 36 : : // See `IPool` for descriptions
- 37 : : event FlashLoan(
- 38 : : address indexed target,
- 39 : : address initiator,
- 40 : : address indexed asset,
- 41 : : uint256 amount,
- 42 : : DataTypes.InterestRateMode interestRateMode,
- 43 : : uint256 premium,
- 44 : : uint16 indexed referralCode
- 45 : : );
- 46 : :
- 47 : : // Helper struct for internal variables used in the `executeFlashLoan` function
- 48 : : struct FlashLoanLocalVars {
- 49 : : IFlashLoanReceiver receiver;
- 50 : : uint256 i;
- 51 : : address currentAsset;
- 52 : : uint256 currentAmount;
- 53 : : uint256[] totalPremiums;
- 54 : : uint256 flashloanPremiumTotal;
- 55 : : uint256 flashloanPremiumToProtocol;
- 56 : : }
- 57 : :
- 58 : : /**
- 59 : : * @notice Implements the flashloan feature that allow users to access liquidity of the pool for one transaction
- 60 : : * as long as the amount taken plus fee is returned or debt is opened.
- 61 : : * @dev For authorized flashborrowers the fee is waived
- 62 : : * @dev At the end of the transaction the pool will pull amount borrowed + fee from the receiver,
- 63 : : * if the receiver have not approved the pool the transaction will revert.
- 64 : : * @dev Emits the `FlashLoan()` event
- 65 : : * @param reservesData The state of all the reserves
- 66 : : * @param reservesList The addresses of all the active reserves
- 67 : : * @param eModeCategories The configuration of all the efficiency mode categories
- 68 : : * @param userConfig The user configuration mapping that tracks the supplied/borrowed assets
- 69 : : * @param params The additional parameters needed to execute the flashloan function
- 70 : : */
- 71 : 10 : function executeFlashLoan(
- 72 : : mapping(address => DataTypes.ReserveData) storage reservesData,
- 73 : : mapping(uint256 => address) storage reservesList,
- 74 : : mapping(uint8 => DataTypes.EModeCategory) storage eModeCategories,
- 75 : : DataTypes.UserConfigurationMap storage userConfig,
- 76 : : DataTypes.FlashloanParams memory params
- 77 : : ) external {
- 78 : : // The usual action flow (cache -> updateState -> validation -> changeState -> updateRates)
- 79 : : // is altered to (validation -> user payload -> cache -> updateState -> changeState -> updateRates) for flashloans.
- 80 : : // This is done to protect against reentrance and rate manipulation within the user specified payload.
+ 12 : : import {ReserveConfiguration} from '../configuration/ReserveConfiguration.sol';
+ 13 : : import {Errors} from '../helpers/Errors.sol';
+ 14 : : import {WadRayMath} from '../math/WadRayMath.sol';
+ 15 : : import {PercentageMath} from '../math/PercentageMath.sol';
+ 16 : : import {DataTypes} from '../types/DataTypes.sol';
+ 17 : : import {ValidationLogic} from './ValidationLogic.sol';
+ 18 : : import {BorrowLogic} from './BorrowLogic.sol';
+ 19 : : import {ReserveLogic} from './ReserveLogic.sol';
+ 20 : :
+ 21 : : /**
+ 22 : : * @title FlashLoanLogic library
+ 23 : : * @author Aave
+ 24 : : * @notice Implements the logic for the flash loans
+ 25 : : */
+ 26 : : library FlashLoanLogic {
+ 27 : : using ReserveLogic for DataTypes.ReserveCache;
+ 28 : : using ReserveLogic for DataTypes.ReserveData;
+ 29 : : using GPv2SafeERC20 for IERC20;
+ 30 : : using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
+ 31 : : using WadRayMath for uint256;
+ 32 : : using PercentageMath for uint256;
+ 33 : : using SafeCast for uint256;
+ 34 : :
+ 35 : : // See `IPool` for descriptions
+ 36 : : event FlashLoan(
+ 37 : : address indexed target,
+ 38 : : address initiator,
+ 39 : : address indexed asset,
+ 40 : : uint256 amount,
+ 41 : : DataTypes.InterestRateMode interestRateMode,
+ 42 : : uint256 premium,
+ 43 : : uint16 indexed referralCode
+ 44 : : );
+ 45 : :
+ 46 : : // Helper struct for internal variables used in the `executeFlashLoan` function
+ 47 : : struct FlashLoanLocalVars {
+ 48 : : IFlashLoanReceiver receiver;
+ 49 : : address currentAsset;
+ 50 : : uint256 currentAmount;
+ 51 : : uint256[] totalPremiums;
+ 52 : : uint256 flashloanPremiumTotal;
+ 53 : : uint256 flashloanPremiumToProtocol;
+ 54 : : }
+ 55 : :
+ 56 : : /**
+ 57 : : * @notice Implements the flashloan feature that allow users to access liquidity of the pool for one transaction
+ 58 : : * as long as the amount taken plus fee is returned or debt is opened.
+ 59 : : * @dev For authorized flashborrowers the fee is waived
+ 60 : : * @dev At the end of the transaction the pool will pull amount borrowed + fee from the receiver,
+ 61 : : * if the receiver have not approved the pool the transaction will revert.
+ 62 : : * @dev Emits the `FlashLoan()` event
+ 63 : : * @param reservesData The state of all the reserves
+ 64 : : * @param reservesList The addresses of all the active reserves
+ 65 : : * @param eModeCategories The configuration of all the efficiency mode categories
+ 66 : : * @param userConfig The user configuration mapping that tracks the supplied/borrowed assets
+ 67 : : * @param params The additional parameters needed to execute the flashloan function
+ 68 : : */
+ 69 : : function executeFlashLoan(
+ 70 : : mapping(address => DataTypes.ReserveData) storage reservesData,
+ 71 : : mapping(uint256 => address) storage reservesList,
+ 72 : : mapping(uint8 => DataTypes.EModeCategory) storage eModeCategories,
+ 73 : : DataTypes.UserConfigurationMap storage userConfig,
+ 74 : : DataTypes.FlashloanParams memory params
+ 75 : : ) external {
+ 76 : : // The usual action flow (cache -> updateState -> validation -> changeState -> updateRates)
+ 77 : : // is altered to (validation -> user payload -> cache -> updateState -> changeState -> updateRates) for flashloans.
+ 78 : : // This is done to protect against reentrance and rate manipulation within the user specified payload.
+ 79 : :
+ 80 : 1011 : ValidationLogic.validateFlashloan(reservesData, params.assets, params.amounts);
81 : :
- 82 : 20 : ValidationLogic.validateFlashloan(reservesData, params.assets, params.amounts);
+ 82 : 7 : FlashLoanLocalVars memory vars;
83 : :
- 84 : 12 : FlashLoanLocalVars memory vars;
+ 84 : 7 : vars.totalPremiums = new uint256[](params.assets.length);
85 : :
- 86 : 12 : vars.totalPremiums = new uint256[](params.assets.length);
- 87 : :
- 88 : 12 : vars.receiver = IFlashLoanReceiver(params.receiverAddress);
- 89 : 12 : (vars.flashloanPremiumTotal, vars.flashloanPremiumToProtocol) = params.isAuthorizedFlashBorrower
- 90 : : ? (0, 0)
- 91 : : : (params.flashLoanPremiumTotal, params.flashLoanPremiumToProtocol);
- 92 : :
- 93 : 32 : for (vars.i = 0; vars.i < params.assets.length; vars.i++) {
- 94 : 14 : vars.currentAmount = params.amounts[vars.i];
- 95 : 14 : vars.totalPremiums[vars.i] = DataTypes.InterestRateMode(params.interestRateModes[vars.i]) ==
- 96 : : DataTypes.InterestRateMode.NONE
- 97 : : ? vars.currentAmount.percentMul(vars.flashloanPremiumTotal)
- 98 : : : 0;
- 99 : :
- 100 : 14 : if (reservesData[params.assets[vars.i]].configuration.getIsVirtualAccActive()) {
- 101 : 14 : reservesData[params.assets[vars.i]].virtualUnderlyingBalance -= vars
- 102 : : .currentAmount
- 103 : : .toUint128();
- 104 : : }
- 105 : :
- 106 : 14 : IAToken(reservesData[params.assets[vars.i]].aTokenAddress).transferUnderlyingTo(
- 107 : : params.receiverAddress,
- 108 : : vars.currentAmount
- 109 : : );
- 110 : : }
- 111 : :
- 112 : 12 : require(
- 113 : : vars.receiver.executeOperation(
- 114 : : params.assets,
- 115 : : params.amounts,
- 116 : : vars.totalPremiums,
- 117 : : msg.sender,
- 118 : : params.params
- 119 : : ),
- 120 : : Errors.INVALID_FLASHLOAN_EXECUTOR_RETURN
- 121 : : );
+ 86 : 7 : vars.receiver = IFlashLoanReceiver(params.receiverAddress);
+ 87 : 7 : (vars.flashloanPremiumTotal, vars.flashloanPremiumToProtocol) = params.isAuthorizedFlashBorrower
+ 88 : : ? (0, 0)
+ 89 : : : (params.flashLoanPremiumTotal, params.flashLoanPremiumToProtocol);
+ 90 : :
+ 91 : 7 : for (uint256 i = 0; i < params.assets.length; i++) {
+ 92 : 8 : vars.currentAmount = params.amounts[i];
+ 93 : 8 : vars.totalPremiums[i] = DataTypes.InterestRateMode(params.interestRateModes[i]) ==
+ 94 : : DataTypes.InterestRateMode.NONE
+ 95 : : ? vars.currentAmount.percentMul(vars.flashloanPremiumTotal)
+ 96 : : : 0;
+ 97 : :
+ 98 : 8 : if (reservesData[params.assets[i]].configuration.getIsVirtualAccActive()) {
+ 99 : 8 : reservesData[params.assets[i]].virtualUnderlyingBalance -= vars.currentAmount.toUint128();
+ 100 : : }
+ 101 : :
+ 102 : 8 : IAToken(reservesData[params.assets[i]].aTokenAddress).transferUnderlyingTo(
+ 103 : : params.receiverAddress,
+ 104 : : vars.currentAmount
+ 105 : : );
+ 106 : : }
+ 107 : :
+ 108 : 7 : require(
+ 109 : : vars.receiver.executeOperation(
+ 110 : : params.assets,
+ 111 : : params.amounts,
+ 112 : : vars.totalPremiums,
+ 113 : : msg.sender,
+ 114 : : params.params
+ 115 : : ),
+ 116 : : Errors.INVALID_FLASHLOAN_EXECUTOR_RETURN
+ 117 : : );
+ 118 : :
+ 119 : 4 : for (uint256 i = 0; i < params.assets.length; i++) {
+ 120 : 5 : vars.currentAsset = params.assets[i];
+ 121 : 5 : vars.currentAmount = params.amounts[i];
122 : :
- 123 : 17 : for (vars.i = 0; vars.i < params.assets.length; vars.i++) {
- 124 : 8 : vars.currentAsset = params.assets[vars.i];
- 125 : 8 : vars.currentAmount = params.amounts[vars.i];
- 126 : :
- 127 : : if (
- 128 : 12 : DataTypes.InterestRateMode(params.interestRateModes[vars.i]) ==
- 129 : : DataTypes.InterestRateMode.NONE
- 130 : : ) {
- 131 : 6 : _handleFlashLoanRepayment(
- 132 : : reservesData[vars.currentAsset],
- 133 : : DataTypes.FlashLoanRepaymentParams({
- 134 : : asset: vars.currentAsset,
- 135 : : receiverAddress: params.receiverAddress,
- 136 : : amount: vars.currentAmount,
- 137 : : totalPremium: vars.totalPremiums[vars.i],
- 138 : : flashLoanPremiumToProtocol: vars.flashloanPremiumToProtocol,
- 139 : : referralCode: params.referralCode
- 140 : : })
- 141 : : );
- 142 : : } else {
- 143 : : // If the user chose to not return the funds, the system checks if there is enough collateral and
- 144 : : // eventually opens a debt position
- 145 : 2 : BorrowLogic.executeBorrow(
- 146 : : reservesData,
- 147 : : reservesList,
- 148 : : eModeCategories,
- 149 : : userConfig,
- 150 : : DataTypes.ExecuteBorrowParams({
- 151 : : asset: vars.currentAsset,
- 152 : : user: msg.sender,
- 153 : : onBehalfOf: params.onBehalfOf,
- 154 : : amount: vars.currentAmount,
- 155 : : interestRateMode: DataTypes.InterestRateMode(params.interestRateModes[vars.i]),
- 156 : : referralCode: params.referralCode,
- 157 : : releaseUnderlying: false,
- 158 : : maxStableRateBorrowSizePercent: IPool(params.pool)
- 159 : : .MAX_STABLE_RATE_BORROW_SIZE_PERCENT(),
- 160 : : reservesCount: IPool(params.pool).getReservesCount(),
- 161 : : oracle: IPoolAddressesProvider(params.addressesProvider).getPriceOracle(),
- 162 : : userEModeCategory: IPool(params.pool).getUserEMode(params.onBehalfOf).toUint8(),
- 163 : : priceOracleSentinel: IPoolAddressesProvider(params.addressesProvider)
- 164 : : .getPriceOracleSentinel()
- 165 : : })
- 166 : : );
- 167 : : // no premium is paid when taking on the flashloan as debt
- 168 : 2 : emit FlashLoan(
- 169 : : params.receiverAddress,
- 170 : : msg.sender,
- 171 : : vars.currentAsset,
- 172 : : vars.currentAmount,
- 173 : : DataTypes.InterestRateMode(params.interestRateModes[vars.i]),
- 174 : : 0,
- 175 : : params.referralCode
- 176 : : );
- 177 : : }
- 178 : : }
- 179 : : }
- 180 : :
- 181 : : /**
- 182 : : * @notice Implements the simple flashloan feature that allow users to access liquidity of ONE reserve for one
- 183 : : * transaction as long as the amount taken plus fee is returned.
- 184 : : * @dev Does not waive fee for approved flashborrowers nor allow taking on debt instead of repaying to save gas
- 185 : : * @dev At the end of the transaction the pool will pull amount borrowed + fee from the receiver,
- 186 : : * if the receiver have not approved the pool the transaction will revert.
- 187 : : * @dev Emits the `FlashLoan()` event
- 188 : : * @param reserve The state of the flashloaned reserve
- 189 : : * @param params The additional parameters needed to execute the simple flashloan function
- 190 : : */
- 191 : 10 : function executeFlashLoanSimple(
- 192 : : DataTypes.ReserveData storage reserve,
- 193 : : DataTypes.FlashloanSimpleParams memory params
- 194 : : ) external {
- 195 : : // The usual action flow (cache -> updateState -> validation -> changeState -> updateRates)
- 196 : : // is altered to (validation -> user payload -> cache -> updateState -> changeState -> updateRates) for flashloans.
- 197 : : // This is done to protect against reentrance and rate manipulation within the user specified payload.
- 198 : :
- 199 : 20 : ValidationLogic.validateFlashloanSimple(reserve, params.amount);
+ 123 : : if (
+ 124 : 5 : DataTypes.InterestRateMode(params.interestRateModes[i]) == DataTypes.InterestRateMode.NONE
+ 125 : : ) {
+ 126 : 3 : _handleFlashLoanRepayment(
+ 127 : : reservesData[vars.currentAsset],
+ 128 : : DataTypes.FlashLoanRepaymentParams({
+ 129 : : asset: vars.currentAsset,
+ 130 : : receiverAddress: params.receiverAddress,
+ 131 : : amount: vars.currentAmount,
+ 132 : : totalPremium: vars.totalPremiums[i],
+ 133 : : flashLoanPremiumToProtocol: vars.flashloanPremiumToProtocol,
+ 134 : : referralCode: params.referralCode
+ 135 : : })
+ 136 : : );
+ 137 : : } else {
+ 138 : : // If the user chose to not return the funds, the system checks if there is enough collateral and
+ 139 : : // eventually opens a debt position
+ 140 : 2 : BorrowLogic.executeBorrow(
+ 141 : : reservesData,
+ 142 : : reservesList,
+ 143 : : eModeCategories,
+ 144 : : userConfig,
+ 145 : : DataTypes.ExecuteBorrowParams({
+ 146 : : asset: vars.currentAsset,
+ 147 : : user: msg.sender,
+ 148 : : onBehalfOf: params.onBehalfOf,
+ 149 : : amount: vars.currentAmount,
+ 150 : : interestRateMode: DataTypes.InterestRateMode(params.interestRateModes[i]),
+ 151 : : referralCode: params.referralCode,
+ 152 : : releaseUnderlying: false,
+ 153 : : reservesCount: IPool(params.pool).getReservesCount(),
+ 154 : : oracle: IPoolAddressesProvider(params.addressesProvider).getPriceOracle(),
+ 155 : : userEModeCategory: IPool(params.pool).getUserEMode(params.onBehalfOf).toUint8(),
+ 156 : : priceOracleSentinel: IPoolAddressesProvider(params.addressesProvider)
+ 157 : : .getPriceOracleSentinel()
+ 158 : : })
+ 159 : : );
+ 160 : : // no premium is paid when taking on the flashloan as debt
+ 161 : 1 : emit FlashLoan(
+ 162 : : params.receiverAddress,
+ 163 : : msg.sender,
+ 164 : : vars.currentAsset,
+ 165 : : vars.currentAmount,
+ 166 : : DataTypes.InterestRateMode(params.interestRateModes[i]),
+ 167 : : 0,
+ 168 : : params.referralCode
+ 169 : : );
+ 170 : : }
+ 171 : : }
+ 172 : : }
+ 173 : :
+ 174 : : /**
+ 175 : : * @notice Implements the simple flashloan feature that allow users to access liquidity of ONE reserve for one
+ 176 : : * transaction as long as the amount taken plus fee is returned.
+ 177 : : * @dev Does not waive fee for approved flashborrowers nor allow taking on debt instead of repaying to save gas
+ 178 : : * @dev At the end of the transaction the pool will pull amount borrowed + fee from the receiver,
+ 179 : : * if the receiver have not approved the pool the transaction will revert.
+ 180 : : * @dev Emits the `FlashLoan()` event
+ 181 : : * @param reserve The state of the flashloaned reserve
+ 182 : : * @param params The additional parameters needed to execute the simple flashloan function
+ 183 : : */
+ 184 : : function executeFlashLoanSimple(
+ 185 : : DataTypes.ReserveData storage reserve,
+ 186 : : DataTypes.FlashloanSimpleParams memory params
+ 187 : : ) external {
+ 188 : : // The usual action flow (cache -> updateState -> validation -> changeState -> updateRates)
+ 189 : : // is altered to (validation -> user payload -> cache -> updateState -> changeState -> updateRates) for flashloans.
+ 190 : : // This is done to protect against reentrance and rate manipulation within the user specified payload.
+ 191 : :
+ 192 : 11 : ValidationLogic.validateFlashloanSimple(reserve, params.amount);
+ 193 : :
+ 194 : 10 : IFlashLoanSimpleReceiver receiver = IFlashLoanSimpleReceiver(params.receiverAddress);
+ 195 : 10 : uint256 totalPremium = params.amount.percentMul(params.flashLoanPremiumTotal);
+ 196 : :
+ 197 : 10 : if (reserve.configuration.getIsVirtualAccActive()) {
+ 198 : 10 : reserve.virtualUnderlyingBalance -= params.amount.toUint128();
+ 199 : : }
200 : :
- 201 : 27 : IFlashLoanSimpleReceiver receiver = IFlashLoanSimpleReceiver(params.receiverAddress);
- 202 : 27 : uint256 totalPremium = params.amount.percentMul(params.flashLoanPremiumTotal);
- 203 : :
- 204 : 18 : if (reserve.configuration.getIsVirtualAccActive()) {
- 205 : 18 : reserve.virtualUnderlyingBalance -= params.amount.toUint128();
- 206 : : }
- 207 : :
- 208 : 18 : IAToken(reserve.aTokenAddress).transferUnderlyingTo(params.receiverAddress, params.amount);
- 209 : :
- 210 : 18 : require(
- 211 : : receiver.executeOperation(
- 212 : : params.asset,
- 213 : : params.amount,
- 214 : : totalPremium,
- 215 : : msg.sender,
- 216 : : params.params
- 217 : : ),
- 218 : : Errors.INVALID_FLASHLOAN_EXECUTOR_RETURN
- 219 : : );
- 220 : :
- 221 : 12 : _handleFlashLoanRepayment(
- 222 : : reserve,
- 223 : : DataTypes.FlashLoanRepaymentParams({
- 224 : : asset: params.asset,
- 225 : : receiverAddress: params.receiverAddress,
- 226 : : amount: params.amount,
- 227 : : totalPremium: totalPremium,
- 228 : : flashLoanPremiumToProtocol: params.flashLoanPremiumToProtocol,
- 229 : : referralCode: params.referralCode
- 230 : : })
- 231 : : );
- 232 : : }
- 233 : :
- 234 : : /**
- 235 : : * @notice Handles repayment of flashloaned assets + premium
- 236 : : * @dev Will pull the amount + premium from the receiver, so must have approved pool
- 237 : : * @param reserve The state of the flashloaned reserve
- 238 : : * @param params The additional parameters needed to execute the repayment function
- 239 : : */
- 240 : 9 : function _handleFlashLoanRepayment(
- 241 : : DataTypes.ReserveData storage reserve,
- 242 : : DataTypes.FlashLoanRepaymentParams memory params
- 243 : : ) internal {
- 244 : 27 : uint256 premiumToProtocol = params.totalPremium.percentMul(params.flashLoanPremiumToProtocol);
- 245 : 27 : uint256 premiumToLP = params.totalPremium - premiumToProtocol;
- 246 : 27 : uint256 amountPlusPremium = params.amount + params.totalPremium;
- 247 : :
- 248 : 27 : DataTypes.ReserveCache memory reserveCache = reserve.cache();
- 249 : 18 : reserve.updateState(reserveCache);
- 250 : 18 : reserveCache.nextLiquidityIndex = reserve.cumulateToLiquidityIndex(
- 251 : : IERC20(reserveCache.aTokenAddress).totalSupply() +
- 252 : : uint256(reserve.accruedToTreasury).rayMul(reserveCache.nextLiquidityIndex),
- 253 : : premiumToLP
- 254 : : );
- 255 : :
- 256 : 18 : reserve.accruedToTreasury += premiumToProtocol
- 257 : : .rayDiv(reserveCache.nextLiquidityIndex)
- 258 : : .toUint128();
- 259 : :
- 260 : 18 : reserve.updateInterestRatesAndVirtualBalance(reserveCache, params.asset, amountPlusPremium, 0);
- 261 : :
- 262 : 18 : IERC20(params.asset).safeTransferFrom(
+ 201 : 10 : IAToken(reserve.aTokenAddress).transferUnderlyingTo(params.receiverAddress, params.amount);
+ 202 : :
+ 203 : 10 : require(
+ 204 : : receiver.executeOperation(
+ 205 : : params.asset,
+ 206 : : params.amount,
+ 207 : : totalPremium,
+ 208 : : msg.sender,
+ 209 : : params.params
+ 210 : : ),
+ 211 : : Errors.INVALID_FLASHLOAN_EXECUTOR_RETURN
+ 212 : : );
+ 213 : :
+ 214 : 6 : _handleFlashLoanRepayment(
+ 215 : : reserve,
+ 216 : : DataTypes.FlashLoanRepaymentParams({
+ 217 : : asset: params.asset,
+ 218 : : receiverAddress: params.receiverAddress,
+ 219 : : amount: params.amount,
+ 220 : : totalPremium: totalPremium,
+ 221 : : flashLoanPremiumToProtocol: params.flashLoanPremiumToProtocol,
+ 222 : : referralCode: params.referralCode
+ 223 : : })
+ 224 : : );
+ 225 : : }
+ 226 : :
+ 227 : : /**
+ 228 : : * @notice Handles repayment of flashloaned assets + premium
+ 229 : : * @dev Will pull the amount + premium from the receiver, so must have approved pool
+ 230 : : * @param reserve The state of the flashloaned reserve
+ 231 : : * @param params The additional parameters needed to execute the repayment function
+ 232 : : */
+ 233 : : function _handleFlashLoanRepayment(
+ 234 : : DataTypes.ReserveData storage reserve,
+ 235 : : DataTypes.FlashLoanRepaymentParams memory params
+ 236 : : ) internal {
+ 237 : 9 : uint256 premiumToProtocol = params.totalPremium.percentMul(params.flashLoanPremiumToProtocol);
+ 238 : 9 : uint256 premiumToLP = params.totalPremium - premiumToProtocol;
+ 239 : 9 : uint256 amountPlusPremium = params.amount + params.totalPremium;
+ 240 : :
+ 241 : 9 : DataTypes.ReserveCache memory reserveCache = reserve.cache();
+ 242 : 9 : reserve.updateState(reserveCache);
+ 243 : 9 : reserveCache.nextLiquidityIndex = reserve.cumulateToLiquidityIndex(
+ 244 : : IERC20(reserveCache.aTokenAddress).totalSupply() +
+ 245 : : uint256(reserve.accruedToTreasury).rayMul(reserveCache.nextLiquidityIndex),
+ 246 : : premiumToLP
+ 247 : : );
+ 248 : :
+ 249 : 9 : reserve.accruedToTreasury += premiumToProtocol
+ 250 : : .rayDiv(reserveCache.nextLiquidityIndex)
+ 251 : : .toUint128();
+ 252 : :
+ 253 : 9 : reserve.updateInterestRatesAndVirtualBalance(reserveCache, params.asset, amountPlusPremium, 0);
+ 254 : :
+ 255 : 9 : IERC20(params.asset).safeTransferFrom(
+ 256 : : params.receiverAddress,
+ 257 : : reserveCache.aTokenAddress,
+ 258 : : amountPlusPremium
+ 259 : : );
+ 260 : :
+ 261 : 9 : IAToken(reserveCache.aTokenAddress).handleRepayment(
+ 262 : : params.receiverAddress,
263 : : params.receiverAddress,
- 264 : : reserveCache.aTokenAddress,
- 265 : : amountPlusPremium
- 266 : : );
- 267 : :
- 268 : 18 : IAToken(reserveCache.aTokenAddress).handleRepayment(
- 269 : : params.receiverAddress,
- 270 : : params.receiverAddress,
- 271 : : amountPlusPremium
- 272 : : );
- 273 : :
- 274 : 18 : emit FlashLoan(
- 275 : : params.receiverAddress,
- 276 : : msg.sender,
- 277 : : params.asset,
- 278 : : params.amount,
- 279 : : DataTypes.InterestRateMode(0),
- 280 : : params.totalPremium,
- 281 : : params.referralCode
- 282 : : );
- 283 : : }
- 284 : : }
+ 264 : : amountPlusPremium
+ 265 : : );
+ 266 : :
+ 267 : 9 : emit FlashLoan(
+ 268 : : params.receiverAddress,
+ 269 : : msg.sender,
+ 270 : : params.asset,
+ 271 : : params.amount,
+ 272 : : DataTypes.InterestRateMode.NONE,
+ 273 : : params.totalPremium,
+ 274 : : params.referralCode
+ 275 : : );
+ 276 : : }
+ 277 : : }
@@ -360,8 +353,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/IsolationModeLogic.sol.func-c.html b/report/protocol/libraries/logic/IsolationModeLogic.sol.func-c.html
similarity index 65%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/IsolationModeLogic.sol.func-c.html
rename to report/protocol/libraries/logic/IsolationModeLogic.sol.func-c.html
index c37d4afa..529e0686 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/IsolationModeLogic.sol.func-c.html
+++ b/report/protocol/libraries/logic/IsolationModeLogic.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/IsolationModeLogic.sol - functions
-
+ LCOV - lcov.info.p - protocol/libraries/logic/IsolationModeLogic.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -37,7 +37,7 @@
-
+
|
@@ -53,28 +53,28 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../glass.png) |
IsolationModeLogic.updateIsolatedDebtIfIsolated |
- 11036 |
+ 13035 |
@@ -82,8 +82,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/IsolationModeLogic.sol.func.html b/report/protocol/libraries/logic/IsolationModeLogic.sol.func.html
similarity index 65%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/IsolationModeLogic.sol.func.html
rename to report/protocol/libraries/logic/IsolationModeLogic.sol.func.html
index b92f61c3..0568d3b2 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/IsolationModeLogic.sol.func.html
+++ b/report/protocol/libraries/logic/IsolationModeLogic.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/IsolationModeLogic.sol - functions
-
+ LCOV - lcov.info.p - protocol/libraries/logic/IsolationModeLogic.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -37,7 +37,7 @@
-
+
|
@@ -53,28 +53,28 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../updown.png) |
IsolationModeLogic.updateIsolatedDebtIfIsolated |
- 11036 |
+ 13035 |
@@ -82,8 +82,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/IsolationModeLogic.sol.gcov.html b/report/protocol/libraries/logic/IsolationModeLogic.sol.gcov.html
similarity index 85%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/IsolationModeLogic.sol.gcov.html
rename to report/protocol/libraries/logic/IsolationModeLogic.sol.gcov.html
index ecc7f0d8..f750b6e9 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/IsolationModeLogic.sol.gcov.html
+++ b/report/protocol/libraries/logic/IsolationModeLogic.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/IsolationModeLogic.sol
-
+ LCOV - lcov.info.p - protocol/libraries/logic/IsolationModeLogic.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -37,7 +37,7 @@
-
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -98,34 +98,34 @@
27 : : * @param reserveCache The cached data of the reserve
28 : : * @param repayAmount The amount being repaid
29 : : */
- 30 : 11036 : function updateIsolatedDebtIfIsolated(
+ 30 : : function updateIsolatedDebtIfIsolated(
31 : : mapping(address => DataTypes.ReserveData) storage reservesData,
32 : : mapping(uint256 => address) storage reservesList,
33 : : DataTypes.UserConfigurationMap storage userConfig,
34 : : DataTypes.ReserveCache memory reserveCache,
35 : : uint256 repayAmount
36 : : ) internal {
- 37 : 33108 : (bool isolationModeActive, address isolationModeCollateralAddress, ) = userConfig
+ 37 : 13035 : (bool isolationModeActive, address isolationModeCollateralAddress, ) = userConfig
38 : : .getIsolationModeState(reservesData, reservesList);
39 : :
- 40 : 11036 : if (isolationModeActive) {
- 41 : 4 : uint128 isolationModeTotalDebt = reservesData[isolationModeCollateralAddress]
+ 40 : 13035 : if (isolationModeActive) {
+ 41 : 2 : uint128 isolationModeTotalDebt = reservesData[isolationModeCollateralAddress]
42 : : .isolationModeTotalDebt;
43 : :
- 44 : 6 : uint128 isolatedDebtRepaid = (repayAmount /
+ 44 : 2 : uint128 isolatedDebtRepaid = (repayAmount /
45 : : 10 **
46 : : (reserveCache.reserveConfiguration.getDecimals() -
47 : : ReserveConfiguration.DEBT_CEILING_DECIMALS)).toUint128();
48 : :
49 : : // since the debt ceiling does not take into account the interest accrued, it might happen that amount
50 : : // repaid > debt in isolation mode
- 51 : 4 : if (isolationModeTotalDebt <= isolatedDebtRepaid) {
- 52 : 2 : reservesData[isolationModeCollateralAddress].isolationModeTotalDebt = 0;
- 53 : 2 : emit IsolationModeTotalDebtUpdated(isolationModeCollateralAddress, 0);
+ 51 : 2 : if (isolationModeTotalDebt <= isolatedDebtRepaid) {
+ 52 : 1 : reservesData[isolationModeCollateralAddress].isolationModeTotalDebt = 0;
+ 53 : 1 : emit IsolationModeTotalDebtUpdated(isolationModeCollateralAddress, 0);
54 : : } else {
- 55 : 3 : uint256 nextIsolationModeTotalDebt = reservesData[isolationModeCollateralAddress]
+ 55 : 1 : uint256 nextIsolationModeTotalDebt = reservesData[isolationModeCollateralAddress]
56 : : .isolationModeTotalDebt = isolationModeTotalDebt - isolatedDebtRepaid;
- 57 : 2 : emit IsolationModeTotalDebtUpdated(
+ 57 : 1 : emit IsolationModeTotalDebtUpdated(
58 : : isolationModeCollateralAddress,
59 : : nextIsolationModeTotalDebt
60 : : );
@@ -140,8 +140,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/LiquidationLogic.sol.func-c.html b/report/protocol/libraries/logic/LiquidationLogic.sol.func-c.html
similarity index 56%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/LiquidationLogic.sol.func-c.html
rename to report/protocol/libraries/logic/LiquidationLogic.sol.func-c.html
index 0e8460fb..82970336 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/LiquidationLogic.sol.func-c.html
+++ b/report/protocol/libraries/logic/LiquidationLogic.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/LiquidationLogic.sol - functions
-
+ LCOV - lcov.info.p - protocol/libraries/logic/LiquidationLogic.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
+
+
|
@@ -53,70 +53,63 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../glass.png) |
- LiquidationLogic._liquidateATokens |
+ LiquidationLogic._liquidateATokens |
3 |
- LiquidationLogic._burnCollateralATokens |
+ LiquidationLogic._burnCollateralATokens |
- 6009 |
+ 8008 |
- LiquidationLogic._burnDebtTokens |
+ LiquidationLogic._burnDebtTokens |
- 6012 |
+ 8011 |
- LiquidationLogic._getConfigurationData |
+ LiquidationLogic._calculateAvailableCollateralToLiquidate |
- 6012 |
+ 12021 |
- LiquidationLogic._calculateAvailableCollateralToLiquidate |
+ LiquidationLogic._calculateDebt |
- 9023 |
+ 14501 |
- LiquidationLogic._calculateDebt |
+ LiquidationLogic.executeLiquidationCall |
- 11292 |
-
-
-
-
- LiquidationLogic.executeLiquidationCall |
-
- 11292 |
+ 14501 |
@@ -124,8 +117,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/LiquidationLogic.sol.func.html b/report/protocol/libraries/logic/LiquidationLogic.sol.func.html
similarity index 56%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/LiquidationLogic.sol.func.html
rename to report/protocol/libraries/logic/LiquidationLogic.sol.func.html
index a3d162f6..99073430 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/LiquidationLogic.sol.func.html
+++ b/report/protocol/libraries/logic/LiquidationLogic.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/LiquidationLogic.sol - functions
-
+ LCOV - lcov.info.p - protocol/libraries/logic/LiquidationLogic.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
+
+
|
@@ -53,70 +53,63 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../updown.png) |
- LiquidationLogic._burnCollateralATokens |
+ LiquidationLogic._burnCollateralATokens |
- 6009 |
+ 8008 |
- LiquidationLogic._burnDebtTokens |
+ LiquidationLogic._burnDebtTokens |
- 6012 |
+ 8011 |
- LiquidationLogic._calculateAvailableCollateralToLiquidate |
+ LiquidationLogic._calculateAvailableCollateralToLiquidate |
- 9023 |
+ 12021 |
- LiquidationLogic._calculateDebt |
+ LiquidationLogic._calculateDebt |
- 11292 |
+ 14501 |
- LiquidationLogic._getConfigurationData |
-
- 6012 |
-
-
-
-
- LiquidationLogic._liquidateATokens |
+ LiquidationLogic._liquidateATokens |
3 |
- LiquidationLogic.executeLiquidationCall |
+ LiquidationLogic.executeLiquidationCall |
- 11292 |
+ 14501 |
@@ -124,8 +117,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/LiquidationLogic.sol.gcov.html b/report/protocol/libraries/logic/LiquidationLogic.sol.gcov.html
similarity index 76%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/LiquidationLogic.sol.gcov.html
rename to report/protocol/libraries/logic/LiquidationLogic.sol.gcov.html
index 67f052b3..59de0f5b 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/LiquidationLogic.sol.gcov.html
+++ b/report/protocol/libraries/logic/LiquidationLogic.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/LiquidationLogic.sol
-
+ LCOV - lcov.info.p - protocol/libraries/logic/LiquidationLogic.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -76,527 +76,459 @@
5 : : import {GPv2SafeERC20} from '../../../dependencies/gnosis/contracts/GPv2SafeERC20.sol';
6 : : import {PercentageMath} from '../../libraries/math/PercentageMath.sol';
7 : : import {WadRayMath} from '../../libraries/math/WadRayMath.sol';
- 8 : : import {Helpers} from '../../libraries/helpers/Helpers.sol';
- 9 : : import {DataTypes} from '../../libraries/types/DataTypes.sol';
- 10 : : import {ReserveLogic} from './ReserveLogic.sol';
- 11 : : import {ValidationLogic} from './ValidationLogic.sol';
- 12 : : import {GenericLogic} from './GenericLogic.sol';
- 13 : : import {IsolationModeLogic} from './IsolationModeLogic.sol';
- 14 : : import {EModeLogic} from './EModeLogic.sol';
- 15 : : import {UserConfiguration} from '../../libraries/configuration/UserConfiguration.sol';
- 16 : : import {ReserveConfiguration} from '../../libraries/configuration/ReserveConfiguration.sol';
+ 8 : : import {DataTypes} from '../../libraries/types/DataTypes.sol';
+ 9 : : import {ReserveLogic} from './ReserveLogic.sol';
+ 10 : : import {ValidationLogic} from './ValidationLogic.sol';
+ 11 : : import {GenericLogic} from './GenericLogic.sol';
+ 12 : : import {IsolationModeLogic} from './IsolationModeLogic.sol';
+ 13 : : import {EModeLogic} from './EModeLogic.sol';
+ 14 : : import {UserConfiguration} from '../../libraries/configuration/UserConfiguration.sol';
+ 15 : : import {ReserveConfiguration} from '../../libraries/configuration/ReserveConfiguration.sol';
+ 16 : : import {EModeConfiguration} from '../../libraries/configuration/EModeConfiguration.sol';
17 : : import {IAToken} from '../../../interfaces/IAToken.sol';
- 18 : : import {IStableDebtToken} from '../../../interfaces/IStableDebtToken.sol';
- 19 : : import {IVariableDebtToken} from '../../../interfaces/IVariableDebtToken.sol';
- 20 : : import {IPriceOracleGetter} from '../../../interfaces/IPriceOracleGetter.sol';
- 21 : :
- 22 : : /**
- 23 : : * @title LiquidationLogic library
- 24 : : * @author Aave
- 25 : : * @notice Implements actions involving management of collateral in the protocol, the main one being the liquidations
- 26 : : */
- 27 : : library LiquidationLogic {
- 28 : : using WadRayMath for uint256;
- 29 : : using PercentageMath for uint256;
- 30 : : using ReserveLogic for DataTypes.ReserveCache;
- 31 : : using ReserveLogic for DataTypes.ReserveData;
- 32 : : using UserConfiguration for DataTypes.UserConfigurationMap;
- 33 : : using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
- 34 : : using GPv2SafeERC20 for IERC20;
- 35 : :
- 36 : : // See `IPool` for descriptions
- 37 : : event ReserveUsedAsCollateralEnabled(address indexed reserve, address indexed user);
- 38 : : event ReserveUsedAsCollateralDisabled(address indexed reserve, address indexed user);
- 39 : : event LiquidationCall(
- 40 : : address indexed collateralAsset,
- 41 : : address indexed debtAsset,
- 42 : : address indexed user,
- 43 : : uint256 debtToCover,
- 44 : : uint256 liquidatedCollateralAmount,
- 45 : : address liquidator,
- 46 : : bool receiveAToken
- 47 : : );
- 48 : :
- 49 : : /**
- 50 : : * @dev Default percentage of borrower's debt to be repaid in a liquidation.
- 51 : : * @dev Percentage applied when the users health factor is above `CLOSE_FACTOR_HF_THRESHOLD`
- 52 : : * Expressed in bps, a value of 0.5e4 results in 50.00%
- 53 : : */
- 54 : : uint256 internal constant DEFAULT_LIQUIDATION_CLOSE_FACTOR = 0.5e4;
- 55 : :
- 56 : : /**
- 57 : : * @dev Maximum percentage of borrower's debt to be repaid in a liquidation
- 58 : : * @dev Percentage applied when the users health factor is below `CLOSE_FACTOR_HF_THRESHOLD`
- 59 : : * Expressed in bps, a value of 1e4 results in 100.00%
- 60 : : */
- 61 : : uint256 public constant MAX_LIQUIDATION_CLOSE_FACTOR = 1e4;
- 62 : :
- 63 : : /**
- 64 : : * @dev This constant represents below which health factor value it is possible to liquidate
- 65 : : * an amount of debt corresponding to `MAX_LIQUIDATION_CLOSE_FACTOR`.
- 66 : : * A value of 0.95e18 results in 0.95
- 67 : : */
- 68 : : uint256 public constant CLOSE_FACTOR_HF_THRESHOLD = 0.95e18;
- 69 : :
- 70 : : struct LiquidationCallLocalVars {
- 71 : : uint256 userCollateralBalance;
- 72 : : uint256 userVariableDebt;
- 73 : : uint256 userTotalDebt;
- 74 : : uint256 actualDebtToLiquidate;
- 75 : : uint256 actualCollateralToLiquidate;
- 76 : : uint256 liquidationBonus;
- 77 : : uint256 healthFactor;
- 78 : : uint256 liquidationProtocolFeeAmount;
- 79 : : address collateralPriceSource;
- 80 : : address debtPriceSource;
- 81 : : IAToken collateralAToken;
- 82 : : DataTypes.ReserveCache debtReserveCache;
- 83 : : }
- 84 : :
- 85 : : /**
- 86 : : * @notice Function to liquidate a position if its Health Factor drops below 1. The caller (liquidator)
- 87 : : * covers `debtToCover` amount of debt of the user getting liquidated, and receives
- 88 : : * a proportional amount of the `collateralAsset` plus a bonus to cover market risk
- 89 : : * @dev Emits the `LiquidationCall()` event
- 90 : : * @param reservesData The state of all the reserves
- 91 : : * @param reservesList The addresses of all the active reserves
- 92 : : * @param usersConfig The users configuration mapping that track the supplied/borrowed assets
- 93 : : * @param eModeCategories The configuration of all the efficiency mode categories
- 94 : : * @param params The additional parameters needed to execute the liquidation function
- 95 : : */
- 96 : 11292 : function executeLiquidationCall(
- 97 : : mapping(address => DataTypes.ReserveData) storage reservesData,
- 98 : : mapping(uint256 => address) storage reservesList,
- 99 : : mapping(address => DataTypes.UserConfigurationMap) storage usersConfig,
- 100 : : mapping(uint8 => DataTypes.EModeCategory) storage eModeCategories,
- 101 : : DataTypes.ExecuteLiquidationCallParams memory params
- 102 : : ) external {
- 103 : 22584 : LiquidationCallLocalVars memory vars;
- 104 : :
- 105 : 22584 : DataTypes.ReserveData storage collateralReserve = reservesData[params.collateralAsset];
- 106 : 22584 : DataTypes.ReserveData storage debtReserve = reservesData[params.debtAsset];
- 107 : 22584 : DataTypes.UserConfigurationMap storage userConfig = usersConfig[params.user];
- 108 : 22584 : vars.debtReserveCache = debtReserve.cache();
- 109 : 22584 : debtReserve.updateState(vars.debtReserveCache);
- 110 : :
- 111 : 22584 : (, , , , vars.healthFactor, ) = GenericLogic.calculateUserAccountData(
- 112 : : reservesData,
- 113 : : reservesList,
- 114 : : eModeCategories,
- 115 : : DataTypes.CalculateUserAccountDataParams({
- 116 : : userConfig: userConfig,
- 117 : : reservesCount: params.reservesCount,
- 118 : : user: params.user,
- 119 : : oracle: params.priceOracle,
- 120 : : userEModeCategory: params.userEModeCategory
- 121 : : })
- 122 : : );
- 123 : :
- 124 : 22584 : (vars.userVariableDebt, vars.userTotalDebt, vars.actualDebtToLiquidate) = _calculateDebt(
- 125 : : vars.debtReserveCache,
- 126 : : params,
- 127 : : vars.healthFactor
- 128 : : );
- 129 : :
- 130 : 22584 : ValidationLogic.validateLiquidationCall(
- 131 : : userConfig,
- 132 : : collateralReserve,
- 133 : : debtReserve,
- 134 : : DataTypes.ValidateLiquidationCallParams({
- 135 : : debtReserveCache: vars.debtReserveCache,
- 136 : : totalDebt: vars.userTotalDebt,
- 137 : : healthFactor: vars.healthFactor,
- 138 : : priceOracleSentinel: params.priceOracleSentinel
- 139 : : })
- 140 : : );
- 141 : :
- 142 : 12024 : (
- 143 : : vars.collateralAToken,
- 144 : : vars.collateralPriceSource,
- 145 : : vars.debtPriceSource,
- 146 : : vars.liquidationBonus
- 147 : : ) = _getConfigurationData(eModeCategories, collateralReserve, params);
- 148 : :
- 149 : 12024 : vars.userCollateralBalance = vars.collateralAToken.balanceOf(params.user);
+ 18 : : import {IVariableDebtToken} from '../../../interfaces/IVariableDebtToken.sol';
+ 19 : : import {IPriceOracleGetter} from '../../../interfaces/IPriceOracleGetter.sol';
+ 20 : :
+ 21 : : /**
+ 22 : : * @title LiquidationLogic library
+ 23 : : * @author Aave
+ 24 : : * @notice Implements actions involving management of collateral in the protocol, the main one being the liquidations
+ 25 : : */
+ 26 : : library LiquidationLogic {
+ 27 : : using WadRayMath for uint256;
+ 28 : : using PercentageMath for uint256;
+ 29 : : using ReserveLogic for DataTypes.ReserveCache;
+ 30 : : using ReserveLogic for DataTypes.ReserveData;
+ 31 : : using UserConfiguration for DataTypes.UserConfigurationMap;
+ 32 : : using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
+ 33 : : using GPv2SafeERC20 for IERC20;
+ 34 : :
+ 35 : : // See `IPool` for descriptions
+ 36 : : event ReserveUsedAsCollateralEnabled(address indexed reserve, address indexed user);
+ 37 : : event ReserveUsedAsCollateralDisabled(address indexed reserve, address indexed user);
+ 38 : : event LiquidationCall(
+ 39 : : address indexed collateralAsset,
+ 40 : : address indexed debtAsset,
+ 41 : : address indexed user,
+ 42 : : uint256 debtToCover,
+ 43 : : uint256 liquidatedCollateralAmount,
+ 44 : : address liquidator,
+ 45 : : bool receiveAToken
+ 46 : : );
+ 47 : :
+ 48 : : /**
+ 49 : : * @dev Default percentage of borrower's debt to be repaid in a liquidation.
+ 50 : : * @dev Percentage applied when the users health factor is above `CLOSE_FACTOR_HF_THRESHOLD`
+ 51 : : * Expressed in bps, a value of 0.5e4 results in 50.00%
+ 52 : : */
+ 53 : : uint256 internal constant DEFAULT_LIQUIDATION_CLOSE_FACTOR = 0.5e4;
+ 54 : :
+ 55 : : /**
+ 56 : : * @dev Maximum percentage of borrower's debt to be repaid in a liquidation
+ 57 : : * @dev Percentage applied when the users health factor is below `CLOSE_FACTOR_HF_THRESHOLD`
+ 58 : : * Expressed in bps, a value of 1e4 results in 100.00%
+ 59 : : */
+ 60 : : uint256 public constant MAX_LIQUIDATION_CLOSE_FACTOR = 1e4;
+ 61 : :
+ 62 : : /**
+ 63 : : * @dev This constant represents below which health factor value it is possible to liquidate
+ 64 : : * an amount of debt corresponding to `MAX_LIQUIDATION_CLOSE_FACTOR`.
+ 65 : : * A value of 0.95e18 results in 0.95
+ 66 : : */
+ 67 : : uint256 public constant CLOSE_FACTOR_HF_THRESHOLD = 0.95e18;
+ 68 : :
+ 69 : : struct LiquidationCallLocalVars {
+ 70 : : uint256 userCollateralBalance;
+ 71 : : uint256 userTotalDebt;
+ 72 : : uint256 actualDebtToLiquidate;
+ 73 : : uint256 actualCollateralToLiquidate;
+ 74 : : uint256 liquidationBonus;
+ 75 : : uint256 healthFactor;
+ 76 : : uint256 liquidationProtocolFeeAmount;
+ 77 : : IAToken collateralAToken;
+ 78 : : DataTypes.ReserveCache debtReserveCache;
+ 79 : : }
+ 80 : :
+ 81 : : /**
+ 82 : : * @notice Function to liquidate a position if its Health Factor drops below 1. The caller (liquidator)
+ 83 : : * covers `debtToCover` amount of debt of the user getting liquidated, and receives
+ 84 : : * a proportional amount of the `collateralAsset` plus a bonus to cover market risk
+ 85 : : * @dev Emits the `LiquidationCall()` event
+ 86 : : * @param reservesData The state of all the reserves
+ 87 : : * @param reservesList The addresses of all the active reserves
+ 88 : : * @param usersConfig The users configuration mapping that track the supplied/borrowed assets
+ 89 : : * @param eModeCategories The configuration of all the efficiency mode categories
+ 90 : : * @param params The additional parameters needed to execute the liquidation function
+ 91 : : */
+ 92 : : function executeLiquidationCall(
+ 93 : : mapping(address => DataTypes.ReserveData) storage reservesData,
+ 94 : : mapping(uint256 => address) storage reservesList,
+ 95 : : mapping(address => DataTypes.UserConfigurationMap) storage usersConfig,
+ 96 : : mapping(uint8 => DataTypes.EModeCategory) storage eModeCategories,
+ 97 : : DataTypes.ExecuteLiquidationCallParams memory params
+ 98 : : ) external {
+ 99 : 14501 : LiquidationCallLocalVars memory vars;
+ 100 : :
+ 101 : 14501 : DataTypes.ReserveData storage collateralReserve = reservesData[params.collateralAsset];
+ 102 : 14501 : DataTypes.ReserveData storage debtReserve = reservesData[params.debtAsset];
+ 103 : 14501 : DataTypes.UserConfigurationMap storage userConfig = usersConfig[params.user];
+ 104 : 14501 : vars.debtReserveCache = debtReserve.cache();
+ 105 : 14501 : debtReserve.updateState(vars.debtReserveCache);
+ 106 : :
+ 107 : 14501 : (, , , , vars.healthFactor, ) = GenericLogic.calculateUserAccountData(
+ 108 : : reservesData,
+ 109 : : reservesList,
+ 110 : : eModeCategories,
+ 111 : : DataTypes.CalculateUserAccountDataParams({
+ 112 : : userConfig: userConfig,
+ 113 : : reservesCount: params.reservesCount,
+ 114 : : user: params.user,
+ 115 : : oracle: params.priceOracle,
+ 116 : : userEModeCategory: params.userEModeCategory
+ 117 : : })
+ 118 : : );
+ 119 : :
+ 120 : 14501 : (vars.userTotalDebt, vars.actualDebtToLiquidate) = _calculateDebt(
+ 121 : : vars.debtReserveCache,
+ 122 : : params,
+ 123 : : vars.healthFactor
+ 124 : : );
+ 125 : :
+ 126 : 14501 : ValidationLogic.validateLiquidationCall(
+ 127 : : userConfig,
+ 128 : : collateralReserve,
+ 129 : : debtReserve,
+ 130 : : DataTypes.ValidateLiquidationCallParams({
+ 131 : : debtReserveCache: vars.debtReserveCache,
+ 132 : : totalDebt: vars.userTotalDebt,
+ 133 : : healthFactor: vars.healthFactor,
+ 134 : : priceOracleSentinel: params.priceOracleSentinel
+ 135 : : })
+ 136 : : );
+ 137 : :
+ 138 : 8011 : vars.collateralAToken = IAToken(collateralReserve.aTokenAddress);
+ 139 : : if (
+ 140 : 8011 : params.userEModeCategory != 0 &&
+ 141 : 1001 : EModeConfiguration.isReserveEnabledOnBitmap(
+ 142 : : eModeCategories[params.userEModeCategory].collateralBitmap,
+ 143 : : collateralReserve.id
+ 144 : : )
+ 145 : : ) {
+ 146 : 1001 : vars.liquidationBonus = eModeCategories[params.userEModeCategory].liquidationBonus;
+ 147 : : } else {
+ 148 : 7010 : vars.liquidationBonus = collateralReserve.configuration.getLiquidationBonus();
+ 149 : : }
150 : :
- 151 : 12024 : (
- 152 : : vars.actualCollateralToLiquidate,
- 153 : : vars.actualDebtToLiquidate,
- 154 : : vars.liquidationProtocolFeeAmount
- 155 : : ) = _calculateAvailableCollateralToLiquidate(
- 156 : : collateralReserve,
- 157 : : vars.debtReserveCache,
- 158 : : vars.collateralPriceSource,
- 159 : : vars.debtPriceSource,
- 160 : : vars.actualDebtToLiquidate,
- 161 : : vars.userCollateralBalance,
- 162 : : vars.liquidationBonus,
- 163 : : IPriceOracleGetter(params.priceOracle)
- 164 : : );
- 165 : :
- 166 : 12024 : if (vars.userTotalDebt == vars.actualDebtToLiquidate) {
- 167 : 4 : userConfig.setBorrowing(debtReserve.id, false);
- 168 : : }
- 169 : :
- 170 : : // If the collateral being liquidated is equal to the user balance,
- 171 : : // we set the currency as not being used as collateral anymore
- 172 : : if (
- 173 : 18036 : vars.actualCollateralToLiquidate + vars.liquidationProtocolFeeAmount ==
- 174 : : vars.userCollateralBalance
- 175 : : ) {
- 176 : 12 : userConfig.setUsingAsCollateral(collateralReserve.id, false);
- 177 : 12 : emit ReserveUsedAsCollateralDisabled(params.collateralAsset, params.user);
- 178 : : }
- 179 : :
- 180 : 12024 : _burnDebtTokens(params, vars);
+ 151 : 8011 : vars.userCollateralBalance = vars.collateralAToken.balanceOf(params.user);
+ 152 : :
+ 153 : 8011 : (
+ 154 : : vars.actualCollateralToLiquidate,
+ 155 : : vars.actualDebtToLiquidate,
+ 156 : : vars.liquidationProtocolFeeAmount
+ 157 : : ) = _calculateAvailableCollateralToLiquidate(
+ 158 : : collateralReserve,
+ 159 : : vars.debtReserveCache,
+ 160 : : params.collateralAsset,
+ 161 : : params.debtAsset,
+ 162 : : vars.actualDebtToLiquidate,
+ 163 : : vars.userCollateralBalance,
+ 164 : : vars.liquidationBonus,
+ 165 : : IPriceOracleGetter(params.priceOracle)
+ 166 : : );
+ 167 : :
+ 168 : 8011 : if (vars.userTotalDebt == vars.actualDebtToLiquidate) {
+ 169 : 2 : userConfig.setBorrowing(debtReserve.id, false);
+ 170 : : }
+ 171 : :
+ 172 : : // If the collateral being liquidated is equal to the user balance,
+ 173 : : // we set the currency as not being used as collateral anymore
+ 174 : : if (
+ 175 : 8011 : vars.actualCollateralToLiquidate + vars.liquidationProtocolFeeAmount ==
+ 176 : : vars.userCollateralBalance
+ 177 : : ) {
+ 178 : 1006 : userConfig.setUsingAsCollateral(collateralReserve.id, false);
+ 179 : 1006 : emit ReserveUsedAsCollateralDisabled(params.collateralAsset, params.user);
+ 180 : : }
181 : :
- 182 : 12024 : debtReserve.updateInterestRatesAndVirtualBalance(
- 183 : : vars.debtReserveCache,
- 184 : : params.debtAsset,
- 185 : : vars.actualDebtToLiquidate,
- 186 : : 0
- 187 : : );
- 188 : :
- 189 : 12024 : IsolationModeLogic.updateIsolatedDebtIfIsolated(
- 190 : : reservesData,
- 191 : : reservesList,
- 192 : : userConfig,
- 193 : : vars.debtReserveCache,
- 194 : : vars.actualDebtToLiquidate
- 195 : : );
- 196 : :
- 197 : 6012 : if (params.receiveAToken) {
- 198 : 6 : _liquidateATokens(reservesData, reservesList, usersConfig, collateralReserve, params, vars);
- 199 : : } else {
- 200 : 12018 : _burnCollateralATokens(collateralReserve, params, vars);
- 201 : : }
- 202 : :
- 203 : : // Transfer fee to treasury if it is non-zero
- 204 : 12024 : if (vars.liquidationProtocolFeeAmount != 0) {
- 205 : 18033 : uint256 liquidityIndex = collateralReserve.getNormalizedIncome();
- 206 : 18033 : uint256 scaledDownLiquidationProtocolFee = vars.liquidationProtocolFeeAmount.rayDiv(
- 207 : : liquidityIndex
- 208 : : );
- 209 : 18033 : uint256 scaledDownUserBalance = vars.collateralAToken.scaledBalanceOf(params.user);
- 210 : : // To avoid trying to send more aTokens than available on balance, due to 1 wei imprecision
- 211 : 12022 : if (scaledDownLiquidationProtocolFee > scaledDownUserBalance) {
- 212 : 0 : vars.liquidationProtocolFeeAmount = scaledDownUserBalance.rayMul(liquidityIndex);
- 213 : : }
- 214 : 12022 : vars.collateralAToken.transferOnLiquidation(
- 215 : : params.user,
- 216 : : vars.collateralAToken.RESERVE_TREASURY_ADDRESS(),
- 217 : : vars.liquidationProtocolFeeAmount
- 218 : : );
- 219 : : }
- 220 : :
- 221 : : // Transfers the debt asset being repaid to the aToken, where the liquidity is kept
- 222 : 12024 : IERC20(params.debtAsset).safeTransferFrom(
- 223 : : msg.sender,
- 224 : : vars.debtReserveCache.aTokenAddress,
- 225 : : vars.actualDebtToLiquidate
- 226 : : );
- 227 : :
- 228 : 12024 : IAToken(vars.debtReserveCache.aTokenAddress).handleRepayment(
- 229 : : msg.sender,
- 230 : : params.user,
- 231 : : vars.actualDebtToLiquidate
- 232 : : );
- 233 : :
- 234 : 12024 : emit LiquidationCall(
- 235 : : params.collateralAsset,
- 236 : : params.debtAsset,
- 237 : : params.user,
- 238 : : vars.actualDebtToLiquidate,
- 239 : : vars.actualCollateralToLiquidate,
- 240 : : msg.sender,
- 241 : : params.receiveAToken
- 242 : : );
- 243 : : }
- 244 : :
- 245 : : /**
- 246 : : * @notice Burns the collateral aTokens and transfers the underlying to the liquidator.
- 247 : : * @dev The function also updates the state and the interest rate of the collateral reserve.
- 248 : : * @param collateralReserve The data of the collateral reserve
- 249 : : * @param params The additional parameters needed to execute the liquidation function
- 250 : : * @param vars The executeLiquidationCall() function local vars
- 251 : : */
- 252 : 6009 : function _burnCollateralATokens(
- 253 : : DataTypes.ReserveData storage collateralReserve,
- 254 : : DataTypes.ExecuteLiquidationCallParams memory params,
- 255 : : LiquidationCallLocalVars memory vars
- 256 : : ) internal {
- 257 : 18027 : DataTypes.ReserveCache memory collateralReserveCache = collateralReserve.cache();
- 258 : 12018 : collateralReserve.updateState(collateralReserveCache);
- 259 : 12018 : collateralReserve.updateInterestRatesAndVirtualBalance(
- 260 : : collateralReserveCache,
- 261 : : params.collateralAsset,
- 262 : : 0,
- 263 : : vars.actualCollateralToLiquidate
- 264 : : );
- 265 : :
- 266 : : // Burn the equivalent amount of aToken, sending the underlying to the liquidator
- 267 : 12018 : vars.collateralAToken.burn(
- 268 : : params.user,
- 269 : : msg.sender,
- 270 : : vars.actualCollateralToLiquidate,
- 271 : : collateralReserveCache.nextLiquidityIndex
- 272 : : );
- 273 : : }
- 274 : :
- 275 : : /**
- 276 : : * @notice Liquidates the user aTokens by transferring them to the liquidator.
- 277 : : * @dev The function also checks the state of the liquidator and activates the aToken as collateral
- 278 : : * as in standard transfers if the isolation mode constraints are respected.
- 279 : : * @param reservesData The state of all the reserves
- 280 : : * @param reservesList The addresses of all the active reserves
- 281 : : * @param usersConfig The users configuration mapping that track the supplied/borrowed assets
- 282 : : * @param collateralReserve The data of the collateral reserve
- 283 : : * @param params The additional parameters needed to execute the liquidation function
- 284 : : * @param vars The executeLiquidationCall() function local vars
- 285 : : */
- 286 : 3 : function _liquidateATokens(
- 287 : : mapping(address => DataTypes.ReserveData) storage reservesData,
- 288 : : mapping(uint256 => address) storage reservesList,
- 289 : : mapping(address => DataTypes.UserConfigurationMap) storage usersConfig,
- 290 : : DataTypes.ReserveData storage collateralReserve,
- 291 : : DataTypes.ExecuteLiquidationCallParams memory params,
- 292 : : LiquidationCallLocalVars memory vars
- 293 : : ) internal {
- 294 : 9 : uint256 liquidatorPreviousATokenBalance = IERC20(vars.collateralAToken).balanceOf(msg.sender);
- 295 : 6 : vars.collateralAToken.transferOnLiquidation(
- 296 : : params.user,
- 297 : : msg.sender,
- 298 : : vars.actualCollateralToLiquidate
- 299 : : );
- 300 : :
- 301 : 6 : if (liquidatorPreviousATokenBalance == 0) {
- 302 : 6 : DataTypes.UserConfigurationMap storage liquidatorConfig = usersConfig[msg.sender];
- 303 : : if (
- 304 : 6 : ValidationLogic.validateAutomaticUseAsCollateral(
- 305 : : reservesData,
- 306 : : reservesList,
- 307 : : liquidatorConfig,
- 308 : : collateralReserve.configuration,
- 309 : : collateralReserve.aTokenAddress
- 310 : : )
- 311 : : ) {
- 312 : 6 : liquidatorConfig.setUsingAsCollateral(collateralReserve.id, true);
- 313 : 6 : emit ReserveUsedAsCollateralEnabled(params.collateralAsset, msg.sender);
- 314 : : }
- 315 : : }
- 316 : : }
- 317 : :
- 318 : : /**
- 319 : : * @notice Burns the debt tokens of the user up to the amount being repaid by the liquidator.
- 320 : : * @dev The function alters the `debtReserveCache` state in `vars` to update the debt related data.
- 321 : : * @param params The additional parameters needed to execute the liquidation function
- 322 : : * @param vars the executeLiquidationCall() function local vars
- 323 : : */
- 324 : 6012 : function _burnDebtTokens(
- 325 : : DataTypes.ExecuteLiquidationCallParams memory params,
- 326 : : LiquidationCallLocalVars memory vars
- 327 : : ) internal {
- 328 : 12024 : if (vars.userVariableDebt >= vars.actualDebtToLiquidate) {
- 329 : 12024 : vars.debtReserveCache.nextScaledVariableDebt = IVariableDebtToken(
- 330 : : vars.debtReserveCache.variableDebtTokenAddress
- 331 : : ).burn(
- 332 : : params.user,
- 333 : : vars.actualDebtToLiquidate,
- 334 : : vars.debtReserveCache.nextVariableBorrowIndex
- 335 : : );
- 336 : : } else {
- 337 : : // If the user doesn't have variable debt, no need to try to burn variable debt tokens
- 338 : 0 : if (vars.userVariableDebt != 0) {
- 339 : 0 : vars.debtReserveCache.nextScaledVariableDebt = IVariableDebtToken(
- 340 : : vars.debtReserveCache.variableDebtTokenAddress
- 341 : : ).burn(params.user, vars.userVariableDebt, vars.debtReserveCache.nextVariableBorrowIndex);
- 342 : : }
- 343 : 0 : (
- 344 : : vars.debtReserveCache.nextTotalStableDebt,
- 345 : : vars.debtReserveCache.nextAvgStableBorrowRate
- 346 : : ) = IStableDebtToken(vars.debtReserveCache.stableDebtTokenAddress).burn(
- 347 : : params.user,
- 348 : : vars.actualDebtToLiquidate - vars.userVariableDebt
- 349 : : );
- 350 : : }
- 351 : : }
- 352 : :
- 353 : : /**
- 354 : : * @notice Calculates the total debt of the user and the actual amount to liquidate depending on the health factor
- 355 : : * and corresponding close factor.
- 356 : : * @dev If the Health Factor is below CLOSE_FACTOR_HF_THRESHOLD, the close factor is increased to MAX_LIQUIDATION_CLOSE_FACTOR
- 357 : : * @param debtReserveCache The reserve cache data object of the debt reserve
- 358 : : * @param params The additional parameters needed to execute the liquidation function
- 359 : : * @param healthFactor The health factor of the position
- 360 : : * @return The variable debt of the user
- 361 : : * @return The total debt of the user
- 362 : : * @return The actual debt to liquidate as a function of the closeFactor
- 363 : : */
- 364 : 11292 : function _calculateDebt(
- 365 : : DataTypes.ReserveCache memory debtReserveCache,
- 366 : : DataTypes.ExecuteLiquidationCallParams memory params,
- 367 : : uint256 healthFactor
- 368 : : ) internal view returns (uint256, uint256, uint256) {
- 369 : 33876 : (uint256 userStableDebt, uint256 userVariableDebt) = Helpers.getUserCurrentDebt(
- 370 : : params.user,
- 371 : : debtReserveCache
- 372 : : );
- 373 : :
- 374 : 33876 : uint256 userTotalDebt = userStableDebt + userVariableDebt;
- 375 : :
- 376 : 33876 : uint256 closeFactor = healthFactor > CLOSE_FACTOR_HF_THRESHOLD
- 377 : : ? DEFAULT_LIQUIDATION_CLOSE_FACTOR
- 378 : : : MAX_LIQUIDATION_CLOSE_FACTOR;
- 379 : :
- 380 : 33876 : uint256 maxLiquidatableDebt = userTotalDebt.percentMul(closeFactor);
- 381 : :
- 382 : 33876 : uint256 actualDebtToLiquidate = params.debtToCover > maxLiquidatableDebt
- 383 : : ? maxLiquidatableDebt
- 384 : : : params.debtToCover;
- 385 : :
- 386 : 22584 : return (userVariableDebt, userTotalDebt, actualDebtToLiquidate);
- 387 : : }
- 388 : :
- 389 : : /**
- 390 : : * @notice Returns the configuration data for the debt and the collateral reserves.
- 391 : : * @param eModeCategories The configuration of all the efficiency mode categories
- 392 : : * @param collateralReserve The data of the collateral reserve
- 393 : : * @param params The additional parameters needed to execute the liquidation function
- 394 : : * @return The collateral aToken
- 395 : : * @return The address to use as price source for the collateral
- 396 : : * @return The address to use as price source for the debt
- 397 : : * @return The liquidation bonus to apply to the collateral
+ 182 : 8011 : _burnDebtTokens(params, vars);
+ 183 : :
+ 184 : 8011 : debtReserve.updateInterestRatesAndVirtualBalance(
+ 185 : : vars.debtReserveCache,
+ 186 : : params.debtAsset,
+ 187 : : vars.actualDebtToLiquidate,
+ 188 : : 0
+ 189 : : );
+ 190 : :
+ 191 : 8011 : IsolationModeLogic.updateIsolatedDebtIfIsolated(
+ 192 : : reservesData,
+ 193 : : reservesList,
+ 194 : : userConfig,
+ 195 : : vars.debtReserveCache,
+ 196 : : vars.actualDebtToLiquidate
+ 197 : : );
+ 198 : :
+ 199 : 8011 : if (params.receiveAToken) {
+ 200 : 3 : _liquidateATokens(reservesData, reservesList, usersConfig, collateralReserve, params, vars);
+ 201 : : } else {
+ 202 : 8008 : _burnCollateralATokens(collateralReserve, params, vars);
+ 203 : : }
+ 204 : :
+ 205 : : // Transfer fee to treasury if it is non-zero
+ 206 : 8011 : if (vars.liquidationProtocolFeeAmount != 0) {
+ 207 : 8010 : uint256 liquidityIndex = collateralReserve.getNormalizedIncome();
+ 208 : 8010 : uint256 scaledDownLiquidationProtocolFee = vars.liquidationProtocolFeeAmount.rayDiv(
+ 209 : : liquidityIndex
+ 210 : : );
+ 211 : 8010 : uint256 scaledDownUserBalance = vars.collateralAToken.scaledBalanceOf(params.user);
+ 212 : : // To avoid trying to send more aTokens than available on balance, due to 1 wei imprecision
+ 213 : 8010 : if (scaledDownLiquidationProtocolFee > scaledDownUserBalance) {
+ 214 : 0 : vars.liquidationProtocolFeeAmount = scaledDownUserBalance.rayMul(liquidityIndex);
+ 215 : : }
+ 216 : 8010 : vars.collateralAToken.transferOnLiquidation(
+ 217 : : params.user,
+ 218 : : vars.collateralAToken.RESERVE_TREASURY_ADDRESS(),
+ 219 : : vars.liquidationProtocolFeeAmount
+ 220 : : );
+ 221 : : }
+ 222 : :
+ 223 : : // Transfers the debt asset being repaid to the aToken, where the liquidity is kept
+ 224 : 8011 : IERC20(params.debtAsset).safeTransferFrom(
+ 225 : : msg.sender,
+ 226 : : vars.debtReserveCache.aTokenAddress,
+ 227 : : vars.actualDebtToLiquidate
+ 228 : : );
+ 229 : :
+ 230 : 8011 : IAToken(vars.debtReserveCache.aTokenAddress).handleRepayment(
+ 231 : : msg.sender,
+ 232 : : params.user,
+ 233 : : vars.actualDebtToLiquidate
+ 234 : : );
+ 235 : :
+ 236 : 8011 : emit LiquidationCall(
+ 237 : : params.collateralAsset,
+ 238 : : params.debtAsset,
+ 239 : : params.user,
+ 240 : : vars.actualDebtToLiquidate,
+ 241 : : vars.actualCollateralToLiquidate,
+ 242 : : msg.sender,
+ 243 : : params.receiveAToken
+ 244 : : );
+ 245 : : }
+ 246 : :
+ 247 : : /**
+ 248 : : * @notice Burns the collateral aTokens and transfers the underlying to the liquidator.
+ 249 : : * @dev The function also updates the state and the interest rate of the collateral reserve.
+ 250 : : * @param collateralReserve The data of the collateral reserve
+ 251 : : * @param params The additional parameters needed to execute the liquidation function
+ 252 : : * @param vars The executeLiquidationCall() function local vars
+ 253 : : */
+ 254 : : function _burnCollateralATokens(
+ 255 : : DataTypes.ReserveData storage collateralReserve,
+ 256 : : DataTypes.ExecuteLiquidationCallParams memory params,
+ 257 : : LiquidationCallLocalVars memory vars
+ 258 : : ) internal {
+ 259 : 8008 : DataTypes.ReserveCache memory collateralReserveCache = collateralReserve.cache();
+ 260 : 8008 : collateralReserve.updateState(collateralReserveCache);
+ 261 : 8008 : collateralReserve.updateInterestRatesAndVirtualBalance(
+ 262 : : collateralReserveCache,
+ 263 : : params.collateralAsset,
+ 264 : : 0,
+ 265 : : vars.actualCollateralToLiquidate
+ 266 : : );
+ 267 : :
+ 268 : : // Burn the equivalent amount of aToken, sending the underlying to the liquidator
+ 269 : 8008 : vars.collateralAToken.burn(
+ 270 : : params.user,
+ 271 : : msg.sender,
+ 272 : : vars.actualCollateralToLiquidate,
+ 273 : : collateralReserveCache.nextLiquidityIndex
+ 274 : : );
+ 275 : : }
+ 276 : :
+ 277 : : /**
+ 278 : : * @notice Liquidates the user aTokens by transferring them to the liquidator.
+ 279 : : * @dev The function also checks the state of the liquidator and activates the aToken as collateral
+ 280 : : * as in standard transfers if the isolation mode constraints are respected.
+ 281 : : * @param reservesData The state of all the reserves
+ 282 : : * @param reservesList The addresses of all the active reserves
+ 283 : : * @param usersConfig The users configuration mapping that track the supplied/borrowed assets
+ 284 : : * @param collateralReserve The data of the collateral reserve
+ 285 : : * @param params The additional parameters needed to execute the liquidation function
+ 286 : : * @param vars The executeLiquidationCall() function local vars
+ 287 : : */
+ 288 : : function _liquidateATokens(
+ 289 : : mapping(address => DataTypes.ReserveData) storage reservesData,
+ 290 : : mapping(uint256 => address) storage reservesList,
+ 291 : : mapping(address => DataTypes.UserConfigurationMap) storage usersConfig,
+ 292 : : DataTypes.ReserveData storage collateralReserve,
+ 293 : : DataTypes.ExecuteLiquidationCallParams memory params,
+ 294 : : LiquidationCallLocalVars memory vars
+ 295 : : ) internal {
+ 296 : 3 : uint256 liquidatorPreviousATokenBalance = IERC20(vars.collateralAToken).balanceOf(msg.sender);
+ 297 : 3 : vars.collateralAToken.transferOnLiquidation(
+ 298 : : params.user,
+ 299 : : msg.sender,
+ 300 : : vars.actualCollateralToLiquidate
+ 301 : : );
+ 302 : :
+ 303 : 3 : if (liquidatorPreviousATokenBalance == 0) {
+ 304 : 3 : DataTypes.UserConfigurationMap storage liquidatorConfig = usersConfig[msg.sender];
+ 305 : : if (
+ 306 : 3 : ValidationLogic.validateAutomaticUseAsCollateral(
+ 307 : : reservesData,
+ 308 : : reservesList,
+ 309 : : liquidatorConfig,
+ 310 : : collateralReserve.configuration,
+ 311 : : collateralReserve.aTokenAddress
+ 312 : : )
+ 313 : : ) {
+ 314 : 3 : liquidatorConfig.setUsingAsCollateral(collateralReserve.id, true);
+ 315 : 3 : emit ReserveUsedAsCollateralEnabled(params.collateralAsset, msg.sender);
+ 316 : : }
+ 317 : : }
+ 318 : : }
+ 319 : :
+ 320 : : /**
+ 321 : : * @notice Burns the debt tokens of the user up to the amount being repaid by the liquidator.
+ 322 : : * @dev The function alters the `debtReserveCache` state in `vars` to update the debt related data.
+ 323 : : * @param params The additional parameters needed to execute the liquidation function
+ 324 : : * @param vars the executeLiquidationCall() function local vars
+ 325 : : */
+ 326 : : function _burnDebtTokens(
+ 327 : : DataTypes.ExecuteLiquidationCallParams memory params,
+ 328 : : LiquidationCallLocalVars memory vars
+ 329 : : ) internal {
+ 330 : 8011 : vars.debtReserveCache.nextScaledVariableDebt = IVariableDebtToken(
+ 331 : : vars.debtReserveCache.variableDebtTokenAddress
+ 332 : : ).burn(params.user, vars.actualDebtToLiquidate, vars.debtReserveCache.nextVariableBorrowIndex);
+ 333 : : }
+ 334 : :
+ 335 : : /**
+ 336 : : * @notice Calculates the total debt of the user and the actual amount to liquidate depending on the health factor
+ 337 : : * and corresponding close factor.
+ 338 : : * @dev If the Health Factor is below CLOSE_FACTOR_HF_THRESHOLD, the close factor is increased to MAX_LIQUIDATION_CLOSE_FACTOR
+ 339 : : * @param debtReserveCache The reserve cache data object of the debt reserve
+ 340 : : * @param params The additional parameters needed to execute the liquidation function
+ 341 : : * @param healthFactor The health factor of the position
+ 342 : : * @return The total debt of the user
+ 343 : : * @return The actual debt to liquidate as a function of the closeFactor
+ 344 : : */
+ 345 : : function _calculateDebt(
+ 346 : : DataTypes.ReserveCache memory debtReserveCache,
+ 347 : : DataTypes.ExecuteLiquidationCallParams memory params,
+ 348 : : uint256 healthFactor
+ 349 : : ) internal view returns (uint256, uint256) {
+ 350 : 14501 : uint256 userVariableDebt = IERC20(debtReserveCache.variableDebtTokenAddress).balanceOf(
+ 351 : : params.user
+ 352 : : );
+ 353 : :
+ 354 : 14501 : uint256 closeFactor = healthFactor > CLOSE_FACTOR_HF_THRESHOLD
+ 355 : : ? DEFAULT_LIQUIDATION_CLOSE_FACTOR
+ 356 : : : MAX_LIQUIDATION_CLOSE_FACTOR;
+ 357 : :
+ 358 : 14501 : uint256 maxLiquidatableDebt = userVariableDebt.percentMul(closeFactor);
+ 359 : :
+ 360 : 14501 : uint256 actualDebtToLiquidate = params.debtToCover > maxLiquidatableDebt
+ 361 : : ? maxLiquidatableDebt
+ 362 : : : params.debtToCover;
+ 363 : :
+ 364 : 14501 : return (userVariableDebt, actualDebtToLiquidate);
+ 365 : : }
+ 366 : :
+ 367 : : struct AvailableCollateralToLiquidateLocalVars {
+ 368 : : uint256 collateralPrice;
+ 369 : : uint256 debtAssetPrice;
+ 370 : : uint256 maxCollateralToLiquidate;
+ 371 : : uint256 baseCollateral;
+ 372 : : uint256 bonusCollateral;
+ 373 : : uint256 debtAssetDecimals;
+ 374 : : uint256 collateralDecimals;
+ 375 : : uint256 collateralAssetUnit;
+ 376 : : uint256 debtAssetUnit;
+ 377 : : uint256 collateralAmount;
+ 378 : : uint256 debtAmountNeeded;
+ 379 : : uint256 liquidationProtocolFeePercentage;
+ 380 : : uint256 liquidationProtocolFee;
+ 381 : : }
+ 382 : :
+ 383 : : /**
+ 384 : : * @notice Calculates how much of a specific collateral can be liquidated, given
+ 385 : : * a certain amount of debt asset.
+ 386 : : * @dev This function needs to be called after all the checks to validate the liquidation have been performed,
+ 387 : : * otherwise it might fail.
+ 388 : : * @param collateralReserve The data of the collateral reserve
+ 389 : : * @param debtReserveCache The cached data of the debt reserve
+ 390 : : * @param collateralAsset The address of the underlying asset used as collateral, to receive as result of the liquidation
+ 391 : : * @param debtAsset The address of the underlying borrowed asset to be repaid with the liquidation
+ 392 : : * @param debtToCover The debt amount of borrowed `asset` the liquidator wants to cover
+ 393 : : * @param userCollateralBalance The collateral balance for the specific `collateralAsset` of the user being liquidated
+ 394 : : * @param liquidationBonus The collateral bonus percentage to receive as result of the liquidation
+ 395 : : * @return The maximum amount that is possible to liquidate given all the liquidation constraints (user balance, close factor)
+ 396 : : * @return The amount to repay with the liquidation
+ 397 : : * @return The fee taken from the liquidation bonus amount to be paid to the protocol
398 : : */
- 399 : 6012 : function _getConfigurationData(
- 400 : : mapping(uint8 => DataTypes.EModeCategory) storage eModeCategories,
- 401 : : DataTypes.ReserveData storage collateralReserve,
- 402 : : DataTypes.ExecuteLiquidationCallParams memory params
- 403 : : ) internal view returns (IAToken, address, address, uint256) {
- 404 : 18036 : IAToken collateralAToken = IAToken(collateralReserve.aTokenAddress);
- 405 : 18036 : uint256 liquidationBonus = collateralReserve.configuration.getLiquidationBonus();
- 406 : :
- 407 : 12024 : address collateralPriceSource = params.collateralAsset;
- 408 : 12024 : address debtPriceSource = params.debtAsset;
- 409 : :
- 410 : 12024 : if (params.userEModeCategory != 0) {
- 411 : 4 : address eModePriceSource = eModeCategories[params.userEModeCategory].priceSource;
- 412 : :
- 413 : : if (
- 414 : 4 : EModeLogic.isInEModeCategory(
- 415 : : params.userEModeCategory,
- 416 : : collateralReserve.configuration.getEModeCategory()
- 417 : : )
- 418 : : ) {
- 419 : 4 : liquidationBonus = eModeCategories[params.userEModeCategory].liquidationBonus;
- 420 : :
- 421 : 6 : if (eModePriceSource != address(0)) {
- 422 : 2 : collateralPriceSource = eModePriceSource;
- 423 : : }
- 424 : : }
+ 399 : : function _calculateAvailableCollateralToLiquidate(
+ 400 : : DataTypes.ReserveData storage collateralReserve,
+ 401 : : DataTypes.ReserveCache memory debtReserveCache,
+ 402 : : address collateralAsset,
+ 403 : : address debtAsset,
+ 404 : : uint256 debtToCover,
+ 405 : : uint256 userCollateralBalance,
+ 406 : : uint256 liquidationBonus,
+ 407 : : IPriceOracleGetter oracle
+ 408 : : ) internal view returns (uint256, uint256, uint256) {
+ 409 : 12021 : AvailableCollateralToLiquidateLocalVars memory vars;
+ 410 : :
+ 411 : 12021 : vars.collateralPrice = oracle.getAssetPrice(collateralAsset);
+ 412 : 12021 : vars.debtAssetPrice = oracle.getAssetPrice(debtAsset);
+ 413 : :
+ 414 : 12021 : vars.collateralDecimals = collateralReserve.configuration.getDecimals();
+ 415 : 12021 : vars.debtAssetDecimals = debtReserveCache.reserveConfiguration.getDecimals();
+ 416 : :
+ 417 : : unchecked {
+ 418 : 12021 : vars.collateralAssetUnit = 10 ** vars.collateralDecimals;
+ 419 : 12021 : vars.debtAssetUnit = 10 ** vars.debtAssetDecimals;
+ 420 : : }
+ 421 : :
+ 422 : 12021 : vars.liquidationProtocolFeePercentage = collateralReserve
+ 423 : : .configuration
+ 424 : : .getLiquidationProtocolFee();
425 : :
- 426 : : // when in eMode, debt will always be in the same eMode category, can skip matching category check
- 427 : 6 : if (eModePriceSource != address(0)) {
- 428 : 2 : debtPriceSource = eModePriceSource;
- 429 : : }
- 430 : : }
- 431 : :
- 432 : 12024 : return (collateralAToken, collateralPriceSource, debtPriceSource, liquidationBonus);
- 433 : : }
- 434 : :
- 435 : : struct AvailableCollateralToLiquidateLocalVars {
- 436 : : uint256 collateralPrice;
- 437 : : uint256 debtAssetPrice;
- 438 : : uint256 maxCollateralToLiquidate;
- 439 : : uint256 baseCollateral;
- 440 : : uint256 bonusCollateral;
- 441 : : uint256 debtAssetDecimals;
- 442 : : uint256 collateralDecimals;
- 443 : : uint256 collateralAssetUnit;
- 444 : : uint256 debtAssetUnit;
- 445 : : uint256 collateralAmount;
- 446 : : uint256 debtAmountNeeded;
- 447 : : uint256 liquidationProtocolFeePercentage;
- 448 : : uint256 liquidationProtocolFee;
- 449 : : }
+ 426 : : // This is the base collateral to liquidate based on the given debt to cover
+ 427 : 12021 : vars.baseCollateral =
+ 428 : : ((vars.debtAssetPrice * debtToCover * vars.collateralAssetUnit)) /
+ 429 : : (vars.collateralPrice * vars.debtAssetUnit);
+ 430 : :
+ 431 : 12021 : vars.maxCollateralToLiquidate = vars.baseCollateral.percentMul(liquidationBonus);
+ 432 : :
+ 433 : 12021 : if (vars.maxCollateralToLiquidate > userCollateralBalance) {
+ 434 : 1011 : vars.collateralAmount = userCollateralBalance;
+ 435 : 1011 : vars.debtAmountNeeded = ((vars.collateralPrice * vars.collateralAmount * vars.debtAssetUnit) /
+ 436 : : (vars.debtAssetPrice * vars.collateralAssetUnit)).percentDiv(liquidationBonus);
+ 437 : : } else {
+ 438 : 11010 : vars.collateralAmount = vars.maxCollateralToLiquidate;
+ 439 : 11010 : vars.debtAmountNeeded = debtToCover;
+ 440 : : }
+ 441 : :
+ 442 : 12021 : if (vars.liquidationProtocolFeePercentage != 0) {
+ 443 : 12019 : vars.bonusCollateral =
+ 444 : : vars.collateralAmount -
+ 445 : : vars.collateralAmount.percentDiv(liquidationBonus);
+ 446 : :
+ 447 : 12019 : vars.liquidationProtocolFee = vars.bonusCollateral.percentMul(
+ 448 : : vars.liquidationProtocolFeePercentage
+ 449 : : );
450 : :
- 451 : : /**
- 452 : : * @notice Calculates how much of a specific collateral can be liquidated, given
- 453 : : * a certain amount of debt asset.
- 454 : : * @dev This function needs to be called after all the checks to validate the liquidation have been performed,
- 455 : : * otherwise it might fail.
- 456 : : * @param collateralReserve The data of the collateral reserve
- 457 : : * @param debtReserveCache The cached data of the debt reserve
- 458 : : * @param collateralAsset The address of the underlying asset used as collateral, to receive as result of the liquidation
- 459 : : * @param debtAsset The address of the underlying borrowed asset to be repaid with the liquidation
- 460 : : * @param debtToCover The debt amount of borrowed `asset` the liquidator wants to cover
- 461 : : * @param userCollateralBalance The collateral balance for the specific `collateralAsset` of the user being liquidated
- 462 : : * @param liquidationBonus The collateral bonus percentage to receive as result of the liquidation
- 463 : : * @return The maximum amount that is possible to liquidate given all the liquidation constraints (user balance, close factor)
- 464 : : * @return The amount to repay with the liquidation
- 465 : : * @return The fee taken from the liquidation bonus amount to be paid to the protocol
- 466 : : */
- 467 : 9023 : function _calculateAvailableCollateralToLiquidate(
- 468 : : DataTypes.ReserveData storage collateralReserve,
- 469 : : DataTypes.ReserveCache memory debtReserveCache,
- 470 : : address collateralAsset,
- 471 : : address debtAsset,
- 472 : : uint256 debtToCover,
- 473 : : uint256 userCollateralBalance,
- 474 : : uint256 liquidationBonus,
- 475 : : IPriceOracleGetter oracle
- 476 : : ) internal view returns (uint256, uint256, uint256) {
- 477 : 18046 : AvailableCollateralToLiquidateLocalVars memory vars;
- 478 : :
- 479 : 18046 : vars.collateralPrice = oracle.getAssetPrice(collateralAsset);
- 480 : 18046 : vars.debtAssetPrice = oracle.getAssetPrice(debtAsset);
- 481 : :
- 482 : 18046 : vars.collateralDecimals = collateralReserve.configuration.getDecimals();
- 483 : 18046 : vars.debtAssetDecimals = debtReserveCache.reserveConfiguration.getDecimals();
- 484 : :
- 485 : : unchecked {
- 486 : 18046 : vars.collateralAssetUnit = 10 ** vars.collateralDecimals;
- 487 : 18046 : vars.debtAssetUnit = 10 ** vars.debtAssetDecimals;
- 488 : : }
- 489 : :
- 490 : 18046 : vars.liquidationProtocolFeePercentage = collateralReserve
- 491 : : .configuration
- 492 : : .getLiquidationProtocolFee();
- 493 : :
- 494 : : // This is the base collateral to liquidate based on the given debt to cover
- 495 : 18046 : vars.baseCollateral =
- 496 : : ((vars.debtAssetPrice * debtToCover * vars.collateralAssetUnit)) /
- 497 : : (vars.collateralPrice * vars.debtAssetUnit);
- 498 : :
- 499 : 18046 : vars.maxCollateralToLiquidate = vars.baseCollateral.percentMul(liquidationBonus);
- 500 : :
- 501 : 18046 : if (vars.maxCollateralToLiquidate > userCollateralBalance) {
- 502 : 22 : vars.collateralAmount = userCollateralBalance;
- 503 : 22 : vars.debtAmountNeeded = ((vars.collateralPrice * vars.collateralAmount * vars.debtAssetUnit) /
- 504 : : (vars.debtAssetPrice * vars.collateralAssetUnit)).percentDiv(liquidationBonus);
- 505 : : } else {
- 506 : 18024 : vars.collateralAmount = vars.maxCollateralToLiquidate;
- 507 : 18024 : vars.debtAmountNeeded = debtToCover;
- 508 : : }
- 509 : :
- 510 : 18046 : if (vars.liquidationProtocolFeePercentage != 0) {
- 511 : 18042 : vars.bonusCollateral =
- 512 : : vars.collateralAmount -
- 513 : : vars.collateralAmount.percentDiv(liquidationBonus);
- 514 : :
- 515 : 18042 : vars.liquidationProtocolFee = vars.bonusCollateral.percentMul(
- 516 : : vars.liquidationProtocolFeePercentage
- 517 : : );
- 518 : :
- 519 : 18042 : return (
- 520 : : vars.collateralAmount - vars.liquidationProtocolFee,
- 521 : : vars.debtAmountNeeded,
- 522 : : vars.liquidationProtocolFee
- 523 : : );
- 524 : : } else {
- 525 : 4 : return (vars.collateralAmount, vars.debtAmountNeeded, 0);
- 526 : : }
- 527 : : }
- 528 : : }
+ 451 : 12019 : return (
+ 452 : : vars.collateralAmount - vars.liquidationProtocolFee,
+ 453 : : vars.debtAmountNeeded,
+ 454 : : vars.liquidationProtocolFee
+ 455 : : );
+ 456 : : } else {
+ 457 : 2 : return (vars.collateralAmount, vars.debtAmountNeeded, 0);
+ 458 : : }
+ 459 : : }
+ 460 : : }
@@ -604,8 +536,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/PoolLogic.sol.func-c.html b/report/protocol/libraries/logic/PoolLogic.sol.func-c.html
similarity index 66%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/PoolLogic.sol.func-c.html
rename to report/protocol/libraries/logic/PoolLogic.sol.func-c.html
index dfb17312..3fcf8767 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/PoolLogic.sol.func-c.html
+++ b/report/protocol/libraries/logic/PoolLogic.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/PoolLogic.sol - functions
-
+ LCOV - lcov.info.p - protocol/libraries/logic/PoolLogic.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -37,7 +37,7 @@
-
+
|
@@ -53,70 +53,70 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../glass.png) |
- PoolLogic.executeMintToTreasury |
+ PoolLogic.executeMintToTreasury |
4 |
- PoolLogic.executeDropReserve |
+ PoolLogic.executeDropReserve |
9 |
- PoolLogic.executeResetIsolationModeTotalDebt |
+ PoolLogic.executeResetIsolationModeTotalDebt |
- 1751 |
+ 1951 |
- PoolLogic.executeRescueTokens |
+ PoolLogic.executeRescueTokens |
2000 |
- PoolLogic.executeInitReserve |
+ PoolLogic.executeGetUserAccountData |
- 2889 |
+ 10015 |
- PoolLogic.executeGetUserAccountData |
+ PoolLogic.executeSetLiquidationGracePeriod |
- 3013 |
+ 12412 |
- PoolLogic.executeSetLiquidationGracePeriod |
+ PoolLogic.executeInitReserve |
- 9028 |
+ 166023 |
@@ -124,8 +124,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/PoolLogic.sol.func.html b/report/protocol/libraries/logic/PoolLogic.sol.func.html
similarity index 66%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/PoolLogic.sol.func.html
rename to report/protocol/libraries/logic/PoolLogic.sol.func.html
index 6cd89e2d..63ec4fd8 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/PoolLogic.sol.func.html
+++ b/report/protocol/libraries/logic/PoolLogic.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/PoolLogic.sol - functions
-
+ LCOV - lcov.info.p - protocol/libraries/logic/PoolLogic.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -37,7 +37,7 @@
-
+
|
@@ -53,70 +53,70 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../updown.png) |
- PoolLogic.executeDropReserve |
+ PoolLogic.executeDropReserve |
9 |
- PoolLogic.executeGetUserAccountData |
+ PoolLogic.executeGetUserAccountData |
- 3013 |
+ 10015 |
PoolLogic.executeInitReserve |
- 2889 |
+ 166023 |
- PoolLogic.executeMintToTreasury |
+ PoolLogic.executeMintToTreasury |
4 |
- PoolLogic.executeRescueTokens |
+ PoolLogic.executeRescueTokens |
2000 |
- PoolLogic.executeResetIsolationModeTotalDebt |
+ PoolLogic.executeResetIsolationModeTotalDebt |
- 1751 |
+ 1951 |
- PoolLogic.executeSetLiquidationGracePeriod |
+ PoolLogic.executeSetLiquidationGracePeriod |
- 9028 |
+ 12412 |
@@ -124,8 +124,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/PoolLogic.sol.gcov.html b/report/protocol/libraries/logic/PoolLogic.sol.gcov.html
similarity index 86%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/PoolLogic.sol.gcov.html
rename to report/protocol/libraries/logic/PoolLogic.sol.gcov.html
index 1b87cbfe..bc54127d 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/PoolLogic.sol.gcov.html
+++ b/report/protocol/libraries/logic/PoolLogic.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/PoolLogic.sol
-
+ LCOV - lcov.info.p - protocol/libraries/logic/PoolLogic.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -37,7 +37,7 @@
-
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -106,171 +106,170 @@
35 : : * @param params Additional parameters needed for initiation
36 : : * @return true if appended, false if inserted at existing empty spot
37 : : */
- 38 : 2889 : function executeInitReserve(
+ 38 : : function executeInitReserve(
39 : : mapping(address => DataTypes.ReserveData) storage reservesData,
40 : : mapping(uint256 => address) storage reservesList,
41 : : DataTypes.InitReserveParams memory params
42 : : ) external returns (bool) {
- 43 : 5778 : require(Address.isContract(params.asset), Errors.NOT_CONTRACT);
- 44 : 5778 : reservesData[params.asset].init(
+ 43 : 166023 : require(Address.isContract(params.asset), Errors.NOT_CONTRACT);
+ 44 : 166023 : reservesData[params.asset].init(
45 : : params.aTokenAddress,
- 46 : : params.stableDebtAddress,
- 47 : : params.variableDebtAddress,
- 48 : : params.interestRateStrategyAddress
- 49 : : );
- 50 : :
- 51 : 11552 : bool reserveAlreadyAdded = reservesData[params.asset].id != 0 ||
- 52 : 5776 : reservesList[0] == params.asset;
- 53 : 5776 : require(!reserveAlreadyAdded, Errors.RESERVE_ALREADY_ADDED);
- 54 : :
- 55 : 34740 : for (uint16 i = 0; i < params.reservesCount; i++) {
- 56 : 39117 : if (reservesList[i] == address(0)) {
- 57 : 2 : reservesData[params.asset].id = i;
- 58 : 2 : reservesList[i] = params.asset;
- 59 : 2 : return false;
- 60 : : }
- 61 : : }
- 62 : :
- 63 : 5774 : require(params.reservesCount < params.maxNumberReserves, Errors.NO_MORE_RESERVES_ALLOWED);
- 64 : 5770 : reservesData[params.asset].id = params.reservesCount;
- 65 : 5770 : reservesList[params.reservesCount] = params.asset;
- 66 : 5770 : return true;
- 67 : : }
- 68 : :
- 69 : : /**
- 70 : : * @notice Rescue and transfer tokens locked in this contract
- 71 : : * @param token The address of the token
- 72 : : * @param to The address of the recipient
- 73 : : * @param amount The amount of token to transfer
- 74 : : */
- 75 : 2000 : function executeRescueTokens(address token, address to, uint256 amount) external {
- 76 : 4000 : IERC20(token).safeTransfer(to, amount);
- 77 : : }
- 78 : :
- 79 : : /**
- 80 : : * @notice Mints the assets accrued through the reserve factor to the treasury in the form of aTokens
- 81 : : * @param reservesData The state of all the reserves
- 82 : : * @param assets The list of reserves for which the minting needs to be executed
- 83 : : */
- 84 : 4 : function executeMintToTreasury(
- 85 : : mapping(address => DataTypes.ReserveData) storage reservesData,
- 86 : : address[] calldata assets
- 87 : : ) external {
- 88 : 24 : for (uint256 i = 0; i < assets.length; i++) {
- 89 : 12 : address assetAddress = assets[i];
- 90 : :
- 91 : 12 : DataTypes.ReserveData storage reserve = reservesData[assetAddress];
- 92 : :
- 93 : : // this cover both inactive reserves and invalid reserves since the flag will be 0 for both
- 94 : 12 : if (!reserve.configuration.getActive()) {
- 95 : 4 : continue;
- 96 : : }
- 97 : :
- 98 : 8 : uint256 accruedToTreasury = reserve.accruedToTreasury;
- 99 : :
- 100 : 8 : if (accruedToTreasury != 0) {
- 101 : 8 : reserve.accruedToTreasury = 0;
- 102 : 12 : uint256 normalizedIncome = reserve.getNormalizedIncome();
- 103 : 12 : uint256 amountToMint = accruedToTreasury.rayMul(normalizedIncome);
- 104 : 8 : IAToken(reserve.aTokenAddress).mintToTreasury(amountToMint, normalizedIncome);
- 105 : :
- 106 : 8 : emit MintedToTreasury(assetAddress, amountToMint);
- 107 : : }
- 108 : : }
- 109 : : }
- 110 : :
- 111 : : /**
- 112 : : * @notice Resets the isolation mode total debt of the given asset to zero
- 113 : : * @dev It requires the given asset has zero debt ceiling
- 114 : : * @param reservesData The state of all the reserves
- 115 : : * @param asset The address of the underlying asset to reset the isolationModeTotalDebt
- 116 : : */
- 117 : 1751 : function executeResetIsolationModeTotalDebt(
- 118 : : mapping(address => DataTypes.ReserveData) storage reservesData,
- 119 : : address asset
- 120 : : ) external {
- 121 : 3502 : require(reservesData[asset].configuration.getDebtCeiling() == 0, Errors.DEBT_CEILING_NOT_ZERO);
- 122 : 3502 : reservesData[asset].isolationModeTotalDebt = 0;
- 123 : 3502 : emit IsolationModeTotalDebtUpdated(asset, 0);
- 124 : : }
- 125 : :
- 126 : : /**
- 127 : : * @notice Sets the liquidation grace period of the asset
- 128 : : * @param reservesData The state of all the reserves
- 129 : : * @param asset The address of the underlying asset to set the liquidationGracePeriod
- 130 : : * @param until Timestamp when the liquidation grace period will end
- 131 : : */
- 132 : 9028 : function executeSetLiquidationGracePeriod(
- 133 : : mapping(address => DataTypes.ReserveData) storage reservesData,
- 134 : : address asset,
- 135 : : uint40 until
- 136 : : ) external {
- 137 : 18056 : reservesData[asset].liquidationGracePeriodUntil = until;
- 138 : : }
- 139 : :
- 140 : : /**
- 141 : : * @notice Drop a reserve
- 142 : : * @param reservesData The state of all the reserves
- 143 : : * @param reservesList The addresses of all the active reserves
- 144 : : * @param asset The address of the underlying asset of the reserve
- 145 : : */
- 146 : 9 : function executeDropReserve(
- 147 : : mapping(address => DataTypes.ReserveData) storage reservesData,
- 148 : : mapping(uint256 => address) storage reservesList,
- 149 : : address asset
- 150 : : ) external {
- 151 : 18 : DataTypes.ReserveData storage reserve = reservesData[asset];
- 152 : 18 : ValidationLogic.validateDropReserve(reservesList, reserve, asset);
- 153 : 10 : reservesList[reservesData[asset].id] = address(0);
- 154 : 10 : delete reservesData[asset];
- 155 : : }
- 156 : :
- 157 : : /**
- 158 : : * @notice Returns the user account data across all the reserves
- 159 : : * @param reservesData The state of all the reserves
- 160 : : * @param reservesList The addresses of all the active reserves
- 161 : : * @param eModeCategories The configuration of all the efficiency mode categories
- 162 : : * @param params Additional params needed for the calculation
- 163 : : * @return totalCollateralBase The total collateral of the user in the base currency used by the price feed
- 164 : : * @return totalDebtBase The total debt of the user in the base currency used by the price feed
- 165 : : * @return availableBorrowsBase The borrowing power left of the user in the base currency used by the price feed
- 166 : : * @return currentLiquidationThreshold The liquidation threshold of the user
- 167 : : * @return ltv The loan to value of The user
- 168 : : * @return healthFactor The current health factor of the user
- 169 : : */
- 170 : 3013 : function executeGetUserAccountData(
- 171 : : mapping(address => DataTypes.ReserveData) storage reservesData,
- 172 : : mapping(uint256 => address) storage reservesList,
- 173 : : mapping(uint8 => DataTypes.EModeCategory) storage eModeCategories,
- 174 : : DataTypes.CalculateUserAccountDataParams memory params
- 175 : : )
- 176 : : external
- 177 : : view
- 178 : : returns (
- 179 : : uint256 totalCollateralBase,
- 180 : : uint256 totalDebtBase,
- 181 : : uint256 availableBorrowsBase,
- 182 : : uint256 currentLiquidationThreshold,
- 183 : : uint256 ltv,
- 184 : : uint256 healthFactor
- 185 : : )
- 186 : : {
- 187 : 6026 : (
- 188 : : totalCollateralBase,
- 189 : : totalDebtBase,
- 190 : : ltv,
- 191 : : currentLiquidationThreshold,
- 192 : : healthFactor,
- 193 : :
- 194 : : ) = GenericLogic.calculateUserAccountData(reservesData, reservesList, eModeCategories, params);
- 195 : :
- 196 : 6026 : availableBorrowsBase = GenericLogic.calculateAvailableBorrows(
- 197 : : totalCollateralBase,
- 198 : : totalDebtBase,
- 199 : : ltv
- 200 : : );
- 201 : : }
- 202 : : }
+ 46 : : params.variableDebtAddress,
+ 47 : : params.interestRateStrategyAddress
+ 48 : : );
+ 49 : :
+ 50 : 166022 : bool reserveAlreadyAdded = reservesData[params.asset].id != 0 ||
+ 51 : 166022 : reservesList[0] == params.asset;
+ 52 : 166022 : require(!reserveAlreadyAdded, Errors.RESERVE_ALREADY_ADDED);
+ 53 : :
+ 54 : 166022 : for (uint16 i = 0; i < params.reservesCount; i++) {
+ 55 : 9608022 : if (reservesList[i] == address(0)) {
+ 56 : 1 : reservesData[params.asset].id = i;
+ 57 : 1 : reservesList[i] = params.asset;
+ 58 : 1 : return false;
+ 59 : : }
+ 60 : : }
+ 61 : :
+ 62 : 166021 : require(params.reservesCount < params.maxNumberReserves, Errors.NO_MORE_RESERVES_ALLOWED);
+ 63 : 165020 : reservesData[params.asset].id = params.reservesCount;
+ 64 : 165020 : reservesList[params.reservesCount] = params.asset;
+ 65 : 165020 : return true;
+ 66 : : }
+ 67 : :
+ 68 : : /**
+ 69 : : * @notice Rescue and transfer tokens locked in this contract
+ 70 : : * @param token The address of the token
+ 71 : : * @param to The address of the recipient
+ 72 : : * @param amount The amount of token to transfer
+ 73 : : */
+ 74 : : function executeRescueTokens(address token, address to, uint256 amount) external {
+ 75 : 2000 : IERC20(token).safeTransfer(to, amount);
+ 76 : : }
+ 77 : :
+ 78 : : /**
+ 79 : : * @notice Mints the assets accrued through the reserve factor to the treasury in the form of aTokens
+ 80 : : * @param reservesData The state of all the reserves
+ 81 : : * @param assets The list of reserves for which the minting needs to be executed
+ 82 : : */
+ 83 : : function executeMintToTreasury(
+ 84 : : mapping(address => DataTypes.ReserveData) storage reservesData,
+ 85 : : address[] calldata assets
+ 86 : : ) external {
+ 87 : 4 : for (uint256 i = 0; i < assets.length; i++) {
+ 88 : 6 : address assetAddress = assets[i];
+ 89 : :
+ 90 : 6 : DataTypes.ReserveData storage reserve = reservesData[assetAddress];
+ 91 : :
+ 92 : : // this cover both inactive reserves and invalid reserves since the flag will be 0 for both
+ 93 : 6 : if (!reserve.configuration.getActive()) {
+ 94 : 2 : continue;
+ 95 : : }
+ 96 : :
+ 97 : 4 : uint256 accruedToTreasury = reserve.accruedToTreasury;
+ 98 : :
+ 99 : 4 : if (accruedToTreasury != 0) {
+ 100 : 4 : reserve.accruedToTreasury = 0;
+ 101 : 4 : uint256 normalizedIncome = reserve.getNormalizedIncome();
+ 102 : 4 : uint256 amountToMint = accruedToTreasury.rayMul(normalizedIncome);
+ 103 : 4 : IAToken(reserve.aTokenAddress).mintToTreasury(amountToMint, normalizedIncome);
+ 104 : :
+ 105 : 4 : emit MintedToTreasury(assetAddress, amountToMint);
+ 106 : : }
+ 107 : : }
+ 108 : : }
+ 109 : :
+ 110 : : /**
+ 111 : : * @notice Resets the isolation mode total debt of the given asset to zero
+ 112 : : * @dev It requires the given asset has zero debt ceiling
+ 113 : : * @param reservesData The state of all the reserves
+ 114 : : * @param asset The address of the underlying asset to reset the isolationModeTotalDebt
+ 115 : : */
+ 116 : : function executeResetIsolationModeTotalDebt(
+ 117 : : mapping(address => DataTypes.ReserveData) storage reservesData,
+ 118 : : address asset
+ 119 : : ) external {
+ 120 : 1951 : require(reservesData[asset].configuration.getDebtCeiling() == 0, Errors.DEBT_CEILING_NOT_ZERO);
+ 121 : 1951 : reservesData[asset].isolationModeTotalDebt = 0;
+ 122 : 1951 : emit IsolationModeTotalDebtUpdated(asset, 0);
+ 123 : : }
+ 124 : :
+ 125 : : /**
+ 126 : : * @notice Sets the liquidation grace period of the asset
+ 127 : : * @param reservesData The state of all the reserves
+ 128 : : * @param asset The address of the underlying asset to set the liquidationGracePeriod
+ 129 : : * @param until Timestamp when the liquidation grace period will end
+ 130 : : */
+ 131 : : function executeSetLiquidationGracePeriod(
+ 132 : : mapping(address => DataTypes.ReserveData) storage reservesData,
+ 133 : : address asset,
+ 134 : : uint40 until
+ 135 : : ) external {
+ 136 : 12412 : reservesData[asset].liquidationGracePeriodUntil = until;
+ 137 : : }
+ 138 : :
+ 139 : : /**
+ 140 : : * @notice Drop a reserve
+ 141 : : * @param reservesData The state of all the reserves
+ 142 : : * @param reservesList The addresses of all the active reserves
+ 143 : : * @param asset The address of the underlying asset of the reserve
+ 144 : : */
+ 145 : : function executeDropReserve(
+ 146 : : mapping(address => DataTypes.ReserveData) storage reservesData,
+ 147 : : mapping(uint256 => address) storage reservesList,
+ 148 : : address asset
+ 149 : : ) external {
+ 150 : 9 : DataTypes.ReserveData storage reserve = reservesData[asset];
+ 151 : 9 : ValidationLogic.validateDropReserve(reservesList, reserve, asset);
+ 152 : 5 : reservesList[reservesData[asset].id] = address(0);
+ 153 : 5 : delete reservesData[asset];
+ 154 : : }
+ 155 : :
+ 156 : : /**
+ 157 : : * @notice Returns the user account data across all the reserves
+ 158 : : * @param reservesData The state of all the reserves
+ 159 : : * @param reservesList The addresses of all the active reserves
+ 160 : : * @param eModeCategories The configuration of all the efficiency mode categories
+ 161 : : * @param params Additional params needed for the calculation
+ 162 : : * @return totalCollateralBase The total collateral of the user in the base currency used by the price feed
+ 163 : : * @return totalDebtBase The total debt of the user in the base currency used by the price feed
+ 164 : : * @return availableBorrowsBase The borrowing power left of the user in the base currency used by the price feed
+ 165 : : * @return currentLiquidationThreshold The liquidation threshold of the user
+ 166 : : * @return ltv The loan to value of The user
+ 167 : : * @return healthFactor The current health factor of the user
+ 168 : : */
+ 169 : : function executeGetUserAccountData(
+ 170 : : mapping(address => DataTypes.ReserveData) storage reservesData,
+ 171 : : mapping(uint256 => address) storage reservesList,
+ 172 : : mapping(uint8 => DataTypes.EModeCategory) storage eModeCategories,
+ 173 : : DataTypes.CalculateUserAccountDataParams memory params
+ 174 : : )
+ 175 : : external
+ 176 : : view
+ 177 : : returns (
+ 178 : : uint256 totalCollateralBase,
+ 179 : : uint256 totalDebtBase,
+ 180 : : uint256 availableBorrowsBase,
+ 181 : : uint256 currentLiquidationThreshold,
+ 182 : : uint256 ltv,
+ 183 : : uint256 healthFactor
+ 184 : : )
+ 185 : : {
+ 186 : 10015 : (
+ 187 : : totalCollateralBase,
+ 188 : : totalDebtBase,
+ 189 : : ltv,
+ 190 : : currentLiquidationThreshold,
+ 191 : : healthFactor,
+ 192 : :
+ 193 : : ) = GenericLogic.calculateUserAccountData(reservesData, reservesList, eModeCategories, params);
+ 194 : :
+ 195 : 10015 : availableBorrowsBase = GenericLogic.calculateAvailableBorrows(
+ 196 : : totalCollateralBase,
+ 197 : : totalDebtBase,
+ 198 : : ltv
+ 199 : : );
+ 200 : : }
+ 201 : : }
@@ -278,8 +277,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/SupplyLogic.sol.func-c.html b/report/protocol/libraries/logic/SupplyLogic.sol.func-c.html
similarity index 68%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/SupplyLogic.sol.func-c.html
rename to report/protocol/libraries/logic/SupplyLogic.sol.func-c.html
index 452c1606..f464f30d 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/SupplyLogic.sol.func-c.html
+++ b/report/protocol/libraries/logic/SupplyLogic.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/SupplyLogic.sol - functions
-
+ LCOV - lcov.info.p - protocol/libraries/logic/SupplyLogic.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -37,7 +37,7 @@
-
+
|
@@ -53,21 +53,21 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../glass.png) |
@@ -81,21 +81,21 @@
SupplyLogic.executeWithdraw |
- 45 |
+ 2045 |
SupplyLogic.executeFinalizeTransfer |
- 1036 |
+ 17042 |
SupplyLogic.executeSupply |
- 13582 |
+ 44515 |
@@ -103,8 +103,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/SupplyLogic.sol.func.html b/report/protocol/libraries/logic/SupplyLogic.sol.func.html
similarity index 68%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/SupplyLogic.sol.func.html
rename to report/protocol/libraries/logic/SupplyLogic.sol.func.html
index 039c5115..88a637ef 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/SupplyLogic.sol.func.html
+++ b/report/protocol/libraries/logic/SupplyLogic.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/SupplyLogic.sol - functions
-
+ LCOV - lcov.info.p - protocol/libraries/logic/SupplyLogic.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -37,7 +37,7 @@
-
+
|
@@ -53,35 +53,35 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../updown.png) |
SupplyLogic.executeFinalizeTransfer |
- 1036 |
+ 17042 |
SupplyLogic.executeSupply |
- 13582 |
+ 44515 |
@@ -95,7 +95,7 @@
SupplyLogic.executeWithdraw |
- 45 |
+ 2045 |
@@ -103,8 +103,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/SupplyLogic.sol.gcov.html b/report/protocol/libraries/logic/SupplyLogic.sol.gcov.html
similarity index 88%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/SupplyLogic.sol.gcov.html
rename to report/protocol/libraries/logic/SupplyLogic.sol.gcov.html
index 5d94b67a..c4930385 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/SupplyLogic.sol.gcov.html
+++ b/report/protocol/libraries/logic/SupplyLogic.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/SupplyLogic.sol
-
+ LCOV - lcov.info.p - protocol/libraries/logic/SupplyLogic.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -37,7 +37,7 @@
-
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -120,33 +120,33 @@
49 : : * @param userConfig The user configuration mapping that tracks the supplied/borrowed assets
50 : : * @param params The additional parameters needed to execute the supply function
51 : : */
- 52 : 13582 : function executeSupply(
+ 52 : : function executeSupply(
53 : : mapping(address => DataTypes.ReserveData) storage reservesData,
54 : : mapping(uint256 => address) storage reservesList,
55 : : DataTypes.UserConfigurationMap storage userConfig,
56 : : DataTypes.ExecuteSupplyParams memory params
57 : : ) external {
- 58 : 27164 : DataTypes.ReserveData storage reserve = reservesData[params.asset];
- 59 : 40746 : DataTypes.ReserveCache memory reserveCache = reserve.cache();
+ 58 : 44515 : DataTypes.ReserveData storage reserve = reservesData[params.asset];
+ 59 : 44515 : DataTypes.ReserveCache memory reserveCache = reserve.cache();
60 : :
- 61 : 27164 : reserve.updateState(reserveCache);
+ 61 : 44515 : reserve.updateState(reserveCache);
62 : :
- 63 : 27164 : ValidationLogic.validateSupply(reserveCache, reserve, params.amount, params.onBehalfOf);
+ 63 : 44515 : ValidationLogic.validateSupply(reserveCache, reserve, params.amount, params.onBehalfOf);
64 : :
- 65 : 27148 : reserve.updateInterestRatesAndVirtualBalance(reserveCache, params.asset, params.amount, 0);
+ 65 : 44507 : reserve.updateInterestRatesAndVirtualBalance(reserveCache, params.asset, params.amount, 0);
66 : :
- 67 : 27146 : IERC20(params.asset).safeTransferFrom(msg.sender, reserveCache.aTokenAddress, params.amount);
+ 67 : 44506 : IERC20(params.asset).safeTransferFrom(msg.sender, reserveCache.aTokenAddress, params.amount);
68 : :
- 69 : 37719 : bool isFirstSupply = IAToken(reserveCache.aTokenAddress).mint(
+ 69 : 43506 : bool isFirstSupply = IAToken(reserveCache.aTokenAddress).mint(
70 : : msg.sender,
71 : : params.onBehalfOf,
72 : : params.amount,
73 : : reserveCache.nextLiquidityIndex
74 : : );
75 : :
- 76 : 12573 : if (isFirstSupply) {
+ 76 : 43506 : if (isFirstSupply) {
77 : : if (
- 78 : 25094 : ValidationLogic.validateAutomaticUseAsCollateral(
+ 78 : 43501 : ValidationLogic.validateAutomaticUseAsCollateral(
79 : : reservesData,
80 : : reservesList,
81 : : userConfig,
@@ -154,12 +154,12 @@
83 : : reserveCache.aTokenAddress
84 : : )
85 : : ) {
- 86 : 25068 : userConfig.setUsingAsCollateral(reserve.id, true);
- 87 : 25068 : emit ReserveUsedAsCollateralEnabled(params.asset, params.onBehalfOf);
+ 86 : 43488 : userConfig.setUsingAsCollateral(reserve.id, true);
+ 87 : 43488 : emit ReserveUsedAsCollateralEnabled(params.asset, params.onBehalfOf);
88 : : }
89 : : }
90 : :
- 91 : 25146 : emit Supply(params.asset, msg.sender, params.onBehalfOf, params.amount, params.referralCode);
+ 91 : 43506 : emit Supply(params.asset, msg.sender, params.onBehalfOf, params.amount, params.referralCode);
92 : : }
93 : :
94 : : /**
@@ -174,50 +174,50 @@
103 : : * @param params The additional parameters needed to execute the withdraw function
104 : : * @return The actual amount withdrawn
105 : : */
- 106 : 45 : function executeWithdraw(
+ 106 : : function executeWithdraw(
107 : : mapping(address => DataTypes.ReserveData) storage reservesData,
108 : : mapping(uint256 => address) storage reservesList,
109 : : mapping(uint8 => DataTypes.EModeCategory) storage eModeCategories,
110 : : DataTypes.UserConfigurationMap storage userConfig,
111 : : DataTypes.ExecuteWithdrawParams memory params
112 : : ) external returns (uint256) {
- 113 : 90 : DataTypes.ReserveData storage reserve = reservesData[params.asset];
- 114 : 135 : DataTypes.ReserveCache memory reserveCache = reserve.cache();
+ 113 : 2045 : DataTypes.ReserveData storage reserve = reservesData[params.asset];
+ 114 : 2045 : DataTypes.ReserveCache memory reserveCache = reserve.cache();
115 : :
- 116 : 90 : require(params.to != reserveCache.aTokenAddress, Errors.WITHDRAW_TO_ATOKEN);
+ 116 : 2045 : require(params.to != reserveCache.aTokenAddress, Errors.WITHDRAW_TO_ATOKEN);
117 : :
- 118 : 88 : reserve.updateState(reserveCache);
+ 118 : 2044 : reserve.updateState(reserveCache);
119 : :
- 120 : 132 : uint256 userBalance = IAToken(reserveCache.aTokenAddress).scaledBalanceOf(msg.sender).rayMul(
+ 120 : 2044 : uint256 userBalance = IAToken(reserveCache.aTokenAddress).scaledBalanceOf(msg.sender).rayMul(
121 : : reserveCache.nextLiquidityIndex
122 : : );
123 : :
- 124 : 88 : uint256 amountToWithdraw = params.amount;
+ 124 : 2044 : uint256 amountToWithdraw = params.amount;
125 : :
- 126 : 88 : if (params.amount == type(uint256).max) {
- 127 : 10 : amountToWithdraw = userBalance;
+ 126 : 2044 : if (params.amount == type(uint256).max) {
+ 127 : 5 : amountToWithdraw = userBalance;
128 : : }
129 : :
- 130 : 88 : ValidationLogic.validateWithdraw(reserveCache, amountToWithdraw, userBalance);
+ 130 : 2044 : ValidationLogic.validateWithdraw(reserveCache, amountToWithdraw, userBalance);
131 : :
- 132 : 80 : reserve.updateInterestRatesAndVirtualBalance(reserveCache, params.asset, 0, amountToWithdraw);
+ 132 : 2040 : reserve.updateInterestRatesAndVirtualBalance(reserveCache, params.asset, 0, amountToWithdraw);
133 : :
- 134 : 111 : bool isCollateral = userConfig.isUsingAsCollateral(reserve.id);
+ 134 : 2037 : bool isCollateral = userConfig.isUsingAsCollateral(reserve.id);
135 : :
- 136 : 110 : if (isCollateral && amountToWithdraw == userBalance) {
- 137 : 60 : userConfig.setUsingAsCollateral(reserve.id, false);
- 138 : 60 : emit ReserveUsedAsCollateralDisabled(params.asset, msg.sender);
+ 136 : 2037 : if (isCollateral && amountToWithdraw == userBalance) {
+ 137 : 2030 : userConfig.setUsingAsCollateral(reserve.id, false);
+ 138 : 2030 : emit ReserveUsedAsCollateralDisabled(params.asset, msg.sender);
139 : : }
140 : :
- 141 : 74 : IAToken(reserveCache.aTokenAddress).burn(
+ 141 : 2037 : IAToken(reserveCache.aTokenAddress).burn(
142 : : msg.sender,
143 : : params.to,
144 : : amountToWithdraw,
145 : : reserveCache.nextLiquidityIndex
146 : : );
147 : :
- 148 : 110 : if (isCollateral && userConfig.isBorrowingAny()) {
- 149 : 2 : ValidationLogic.validateHFAndLtv(
+ 148 : 2037 : if (isCollateral && userConfig.isBorrowingAny()) {
+ 149 : 1 : ValidationLogic.validateHFAndLtv(
150 : : reservesData,
151 : : reservesList,
152 : : eModeCategories,
@@ -230,9 +230,9 @@
159 : : );
160 : : }
161 : :
- 162 : 72 : emit Withdraw(params.asset, msg.sender, params.to, amountToWithdraw);
+ 162 : 2036 : emit Withdraw(params.asset, msg.sender, params.to, amountToWithdraw);
163 : :
- 164 : 72 : return amountToWithdraw;
+ 164 : 2036 : return amountToWithdraw;
165 : : }
166 : :
167 : : /**
@@ -247,26 +247,26 @@
176 : : * @param usersConfig The users configuration mapping that track the supplied/borrowed assets
177 : : * @param params The additional parameters needed to execute the finalizeTransfer function
178 : : */
- 179 : 1036 : function executeFinalizeTransfer(
+ 179 : : function executeFinalizeTransfer(
180 : : mapping(address => DataTypes.ReserveData) storage reservesData,
181 : : mapping(uint256 => address) storage reservesList,
182 : : mapping(uint8 => DataTypes.EModeCategory) storage eModeCategories,
183 : : mapping(address => DataTypes.UserConfigurationMap) storage usersConfig,
184 : : DataTypes.FinalizeTransferParams memory params
185 : : ) external {
- 186 : 2072 : DataTypes.ReserveData storage reserve = reservesData[params.asset];
+ 186 : 17042 : DataTypes.ReserveData storage reserve = reservesData[params.asset];
187 : :
- 188 : 2072 : ValidationLogic.validateTransfer(reserve);
+ 188 : 17042 : ValidationLogic.validateTransfer(reserve);
189 : :
- 190 : 2072 : uint256 reserveId = reserve.id;
- 191 : 3108 : uint256 scaledAmount = params.amount.rayDiv(reserve.getNormalizedIncome());
+ 190 : 17042 : uint256 reserveId = reserve.id;
+ 191 : 17042 : uint256 scaledAmount = params.amount.rayDiv(reserve.getNormalizedIncome());
192 : :
- 193 : 4142 : if (params.from != params.to && scaledAmount != 0) {
- 194 : 1558 : DataTypes.UserConfigurationMap storage fromConfig = usersConfig[params.from];
+ 193 : 17042 : if (params.from != params.to && scaledAmount != 0) {
+ 194 : 16898 : DataTypes.UserConfigurationMap storage fromConfig = usersConfig[params.from];
195 : :
- 196 : 1558 : if (fromConfig.isUsingAsCollateral(reserveId)) {
- 197 : 1558 : if (fromConfig.isBorrowingAny()) {
- 198 : 12 : ValidationLogic.validateHFAndLtv(
+ 196 : 16898 : if (fromConfig.isUsingAsCollateral(reserveId)) {
+ 197 : 16898 : if (fromConfig.isBorrowingAny()) {
+ 198 : 6 : ValidationLogic.validateHFAndLtv(
199 : : reservesData,
200 : : reservesList,
201 : : eModeCategories,
@@ -278,16 +278,16 @@
207 : : params.fromEModeCategory
208 : : );
209 : : }
- 210 : 1556 : if (params.balanceFromBefore == params.amount) {
- 211 : 14 : fromConfig.setUsingAsCollateral(reserveId, false);
- 212 : 14 : emit ReserveUsedAsCollateralDisabled(params.asset, params.from);
+ 210 : 16897 : if (params.balanceFromBefore == params.amount) {
+ 211 : 15013 : fromConfig.setUsingAsCollateral(reserveId, false);
+ 212 : 15013 : emit ReserveUsedAsCollateralDisabled(params.asset, params.from);
213 : : }
214 : : }
215 : :
- 216 : 1556 : if (params.balanceToBefore == 0) {
- 217 : 1548 : DataTypes.UserConfigurationMap storage toConfig = usersConfig[params.to];
+ 216 : 16897 : if (params.balanceToBefore == 0) {
+ 217 : 15893 : DataTypes.UserConfigurationMap storage toConfig = usersConfig[params.to];
218 : : if (
- 219 : 1548 : ValidationLogic.validateAutomaticUseAsCollateral(
+ 219 : 15893 : ValidationLogic.validateAutomaticUseAsCollateral(
220 : : reservesData,
221 : : reservesList,
222 : : toConfig,
@@ -295,8 +295,8 @@
224 : : reserve.aTokenAddress
225 : : )
226 : : ) {
- 227 : 1548 : toConfig.setUsingAsCollateral(reserveId, true);
- 228 : 1548 : emit ReserveUsedAsCollateralEnabled(params.asset, params.to);
+ 227 : 15893 : toConfig.setUsingAsCollateral(reserveId, true);
+ 228 : 15893 : emit ReserveUsedAsCollateralEnabled(params.asset, params.to);
229 : : }
230 : : }
231 : : }
@@ -318,7 +318,7 @@
247 : : * @param priceOracle The address of the price oracle
248 : : * @param userEModeCategory The eMode category chosen by the user
249 : : */
- 250 : 43 : function executeUseReserveAsCollateral(
+ 250 : : function executeUseReserveAsCollateral(
251 : : mapping(address => DataTypes.ReserveData) storage reservesData,
252 : : mapping(uint256 => address) storage reservesList,
253 : : mapping(uint8 => DataTypes.EModeCategory) storage eModeCategories,
@@ -329,17 +329,17 @@
258 : : address priceOracle,
259 : : uint8 userEModeCategory
260 : : ) external {
- 261 : 86 : DataTypes.ReserveData storage reserve = reservesData[asset];
- 262 : 129 : DataTypes.ReserveCache memory reserveCache = reserve.cache();
+ 261 : 43 : DataTypes.ReserveData storage reserve = reservesData[asset];
+ 262 : 43 : DataTypes.ReserveCache memory reserveCache = reserve.cache();
263 : :
- 264 : 129 : uint256 userBalance = IERC20(reserveCache.aTokenAddress).balanceOf(msg.sender);
+ 264 : 43 : uint256 userBalance = IERC20(reserveCache.aTokenAddress).balanceOf(msg.sender);
265 : :
- 266 : 86 : ValidationLogic.validateSetUseReserveAsCollateral(reserveCache, userBalance);
+ 266 : 43 : ValidationLogic.validateSetUseReserveAsCollateral(reserveCache, userBalance);
267 : :
- 268 : 113 : if (useAsCollateral == userConfig.isUsingAsCollateral(reserve.id)) return;
+ 268 : 37 : if (useAsCollateral == userConfig.isUsingAsCollateral(reserve.id)) return;
269 : :
270 : 35 : if (useAsCollateral) {
- 271 : 38 : require(
+ 271 : 19 : require(
272 : : ValidationLogic.validateUseAsCollateral(
273 : : reservesData,
274 : : reservesList,
@@ -349,11 +349,11 @@
278 : : Errors.USER_IN_ISOLATION_MODE_OR_LTV_ZERO
279 : : );
280 : :
- 281 : 30 : userConfig.setUsingAsCollateral(reserve.id, true);
- 282 : 30 : emit ReserveUsedAsCollateralEnabled(asset, msg.sender);
+ 281 : 15 : userConfig.setUsingAsCollateral(reserve.id, true);
+ 282 : 15 : emit ReserveUsedAsCollateralEnabled(asset, msg.sender);
283 : : } else {
- 284 : 32 : userConfig.setUsingAsCollateral(reserve.id, false);
- 285 : 32 : ValidationLogic.validateHFAndLtv(
+ 284 : 16 : userConfig.setUsingAsCollateral(reserve.id, false);
+ 285 : 16 : ValidationLogic.validateHFAndLtv(
286 : : reservesData,
287 : : reservesList,
288 : : eModeCategories,
@@ -365,7 +365,7 @@
294 : : userEModeCategory
295 : : );
296 : :
- 297 : 28 : emit ReserveUsedAsCollateralDisabled(asset, msg.sender);
+ 297 : 14 : emit ReserveUsedAsCollateralDisabled(asset, msg.sender);
298 : : }
299 : : }
300 : : }
@@ -376,8 +376,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol.func-c.html b/report/protocol/libraries/logic/ValidationLogic.sol.func-c.html
similarity index 57%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol.func-c.html
rename to report/protocol/libraries/logic/ValidationLogic.sol.func-c.html
index 1c7aa134..ecc963ea 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol.func-c.html
+++ b/report/protocol/libraries/logic/ValidationLogic.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol - functions
-
+ LCOV - lcov.info.p - protocol/libraries/logic/ValidationLogic.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,140 +53,126 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../glass.png) |
- ValidationLogic.validateRebalanceStableBorrowRate |
-
- 5 |
-
-
-
-
- ValidationLogic.validateSwapRateMode |
-
- 8 |
-
-
-
-
- ValidationLogic.validateDropReserve |
+ ValidationLogic.validateDropReserve |
9 |
- ValidationLogic.validateFlashloan |
+ ValidationLogic.validateFlashloanSimple |
- 10 |
+ 23 |
- ValidationLogic.validateSetUserEMode |
+ ValidationLogic.validateHFAndLtv |
- 17 |
+ 23 |
- ValidationLogic.validateFlashloanSimple |
+ ValidationLogic.validateSetUseReserveAsCollateral |
- 21 |
+ 43 |
- ValidationLogic.validateHFAndLtv |
+ ValidationLogic.validateFlashloan |
- 23 |
+ 1011 |
- ValidationLogic.validateHealthFactor |
+ ValidationLogic.validateWithdraw |
- 27 |
+ 2044 |
- ValidationLogic.validateSetUseReserveAsCollateral |
+ ValidationLogic.validateRepay |
- 43 |
+ 5030 |
- ValidationLogic.validateWithdraw |
+ ValidationLogic.validateHealthFactor |
- 44 |
+ 8637 |
- ValidationLogic.validateTransfer |
+ ValidationLogic.validateSetUserEMode |
- 1036 |
+ 9617 |
- ValidationLogic.validateRepay |
+ ValidationLogic.validateLiquidationCall |
- 5029 |
+ 14501 |
- ValidationLogic.validateBorrow |
+ ValidationLogic.validateBorrow |
- 9117 |
+ 16110 |
- ValidationLogic.validateLiquidationCall |
+ ValidationLogic.validateTransfer |
- 11292 |
+ 17042 |
- ValidationLogic.validateAutomaticUseAsCollateral |
+ ValidationLogic.validateSupply |
- 13331 |
+ 44531 |
- ValidationLogic.validateUseAsCollateral |
+ ValidationLogic.validateAutomaticUseAsCollateral |
- 13338 |
+ 59404 |
- ValidationLogic.validateSupply |
+ ValidationLogic.validateUseAsCollateral |
- 13598 |
+ 59411 |
@@ -194,8 +180,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol.func.html b/report/protocol/libraries/logic/ValidationLogic.sol.func.html
similarity index 57%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol.func.html
rename to report/protocol/libraries/logic/ValidationLogic.sol.func.html
index 7319ff08..8e7a3e8d 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol.func.html
+++ b/report/protocol/libraries/logic/ValidationLogic.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol - functions
-
+ LCOV - lcov.info.p - protocol/libraries/logic/ValidationLogic.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,140 +53,126 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../updown.png) |
- ValidationLogic.validateAutomaticUseAsCollateral |
+ ValidationLogic.validateAutomaticUseAsCollateral |
- 13331 |
+ 59404 |
- ValidationLogic.validateBorrow |
+ ValidationLogic.validateBorrow |
- 9117 |
+ 16110 |
- ValidationLogic.validateDropReserve |
+ ValidationLogic.validateDropReserve |
9 |
- ValidationLogic.validateFlashloan |
+ ValidationLogic.validateFlashloan |
- 10 |
+ 1011 |
- ValidationLogic.validateFlashloanSimple |
-
- 21 |
-
-
-
-
- ValidationLogic.validateHFAndLtv |
+ ValidationLogic.validateFlashloanSimple |
23 |
- ValidationLogic.validateHealthFactor |
+ ValidationLogic.validateHFAndLtv |
- 27 |
+ 23 |
- ValidationLogic.validateLiquidationCall |
+ ValidationLogic.validateHealthFactor |
- 11292 |
+ 8637 |
- ValidationLogic.validateRebalanceStableBorrowRate |
+ ValidationLogic.validateLiquidationCall |
- 5 |
+ 14501 |
- ValidationLogic.validateRepay |
+ ValidationLogic.validateRepay |
- 5029 |
+ 5030 |
- ValidationLogic.validateSetUseReserveAsCollateral |
+ ValidationLogic.validateSetUseReserveAsCollateral |
43 |
- ValidationLogic.validateSetUserEMode |
+ ValidationLogic.validateSetUserEMode |
- 17 |
+ 9617 |
ValidationLogic.validateSupply |
- 13598 |
-
-
-
-
- ValidationLogic.validateSwapRateMode |
-
- 8 |
+ 44531 |
- ValidationLogic.validateTransfer |
+ ValidationLogic.validateTransfer |
- 1036 |
+ 17042 |
- ValidationLogic.validateUseAsCollateral |
+ ValidationLogic.validateUseAsCollateral |
- 13338 |
+ 59411 |
- ValidationLogic.validateWithdraw |
+ ValidationLogic.validateWithdraw |
- 44 |
+ 2044 |
@@ -194,8 +180,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol.gcov.html b/report/protocol/libraries/logic/ValidationLogic.sol.gcov.html
similarity index 71%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol.gcov.html
rename to report/protocol/libraries/logic/ValidationLogic.sol.gcov.html
index d7f1dd6f..02916898 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol.gcov.html
+++ b/report/protocol/libraries/logic/ValidationLogic.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol
-
+ LCOV - lcov.info.p - protocol/libraries/logic/ValidationLogic.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -76,15 +76,15 @@
5 : : import {Address} from '../../../dependencies/openzeppelin/contracts/Address.sol';
6 : : import {GPv2SafeERC20} from '../../../dependencies/gnosis/contracts/GPv2SafeERC20.sol';
7 : : import {IReserveInterestRateStrategy} from '../../../interfaces/IReserveInterestRateStrategy.sol';
- 8 : : import {IStableDebtToken} from '../../../interfaces/IStableDebtToken.sol';
- 9 : : import {IScaledBalanceToken} from '../../../interfaces/IScaledBalanceToken.sol';
- 10 : : import {IPriceOracleGetter} from '../../../interfaces/IPriceOracleGetter.sol';
- 11 : : import {IAToken} from '../../../interfaces/IAToken.sol';
- 12 : : import {IPriceOracleSentinel} from '../../../interfaces/IPriceOracleSentinel.sol';
- 13 : : import {IPoolAddressesProvider} from '../../../interfaces/IPoolAddressesProvider.sol';
- 14 : : import {IAccessControl} from '../../../dependencies/openzeppelin/contracts/IAccessControl.sol';
- 15 : : import {ReserveConfiguration} from '../configuration/ReserveConfiguration.sol';
- 16 : : import {UserConfiguration} from '../configuration/UserConfiguration.sol';
+ 8 : : import {IScaledBalanceToken} from '../../../interfaces/IScaledBalanceToken.sol';
+ 9 : : import {IPriceOracleGetter} from '../../../interfaces/IPriceOracleGetter.sol';
+ 10 : : import {IAToken} from '../../../interfaces/IAToken.sol';
+ 11 : : import {IPriceOracleSentinel} from '../../../interfaces/IPriceOracleSentinel.sol';
+ 12 : : import {IPoolAddressesProvider} from '../../../interfaces/IPoolAddressesProvider.sol';
+ 13 : : import {IAccessControl} from '../../../dependencies/openzeppelin/contracts/IAccessControl.sol';
+ 14 : : import {ReserveConfiguration} from '../configuration/ReserveConfiguration.sol';
+ 15 : : import {UserConfiguration} from '../configuration/UserConfiguration.sol';
+ 16 : : import {EModeConfiguration} from '../configuration/EModeConfiguration.sol';
17 : : import {Errors} from '../helpers/Errors.sol';
18 : : import {WadRayMath} from '../math/WadRayMath.sol';
19 : : import {PercentageMath} from '../math/PercentageMath.sol';
@@ -134,715 +134,583 @@
63 : : * @param reserveCache The cached data of the reserve
64 : : * @param amount The amount to be supplied
65 : : */
- 66 : 13598 : function validateSupply(
+ 66 : : function validateSupply(
67 : : DataTypes.ReserveCache memory reserveCache,
68 : : DataTypes.ReserveData storage reserve,
69 : : uint256 amount,
70 : : address onBehalfOf
71 : : ) internal view {
- 72 : 27196 : require(amount != 0, Errors.INVALID_AMOUNT);
+ 72 : 44531 : require(amount != 0, Errors.INVALID_AMOUNT);
73 : :
- 74 : 40791 : (bool isActive, bool isFrozen, , , bool isPaused) = reserveCache
- 75 : : .reserveConfiguration
- 76 : : .getFlags();
- 77 : 27194 : require(isActive, Errors.RESERVE_INACTIVE);
- 78 : 27192 : require(!isPaused, Errors.RESERVE_PAUSED);
- 79 : 27190 : require(!isFrozen, Errors.RESERVE_FROZEN);
- 80 : 27188 : require(onBehalfOf != reserveCache.aTokenAddress, Errors.SUPPLY_TO_ATOKEN);
- 81 : :
- 82 : 40779 : uint256 supplyCap = reserveCache.reserveConfiguration.getSupplyCap();
- 83 : 27186 : require(
- 84 : : supplyCap == 0 ||
- 85 : : ((IAToken(reserveCache.aTokenAddress).scaledTotalSupply() +
- 86 : : uint256(reserve.accruedToTreasury)).rayMul(reserveCache.nextLiquidityIndex) + amount) <=
- 87 : : supplyCap * (10 ** reserveCache.reserveConfiguration.getDecimals()),
- 88 : : Errors.SUPPLY_CAP_EXCEEDED
- 89 : : );
- 90 : : }
- 91 : :
- 92 : : /**
- 93 : : * @notice Validates a withdraw action.
- 94 : : * @param reserveCache The cached data of the reserve
- 95 : : * @param amount The amount to be withdrawn
- 96 : : * @param userBalance The balance of the user
- 97 : : */
- 98 : 44 : function validateWithdraw(
- 99 : : DataTypes.ReserveCache memory reserveCache,
- 100 : : uint256 amount,
- 101 : : uint256 userBalance
- 102 : : ) internal pure {
- 103 : 88 : require(amount != 0, Errors.INVALID_AMOUNT);
- 104 : 86 : require(amount <= userBalance, Errors.NOT_ENOUGH_AVAILABLE_USER_BALANCE);
- 105 : :
- 106 : 126 : (bool isActive, , , , bool isPaused) = reserveCache.reserveConfiguration.getFlags();
- 107 : 84 : require(isActive, Errors.RESERVE_INACTIVE);
- 108 : 82 : require(!isPaused, Errors.RESERVE_PAUSED);
- 109 : : }
- 110 : :
- 111 : : struct ValidateBorrowLocalVars {
- 112 : : uint256 currentLtv;
- 113 : : uint256 collateralNeededInBaseCurrency;
- 114 : : uint256 userCollateralInBaseCurrency;
- 115 : : uint256 userDebtInBaseCurrency;
- 116 : : uint256 availableLiquidity;
- 117 : : uint256 healthFactor;
- 118 : : uint256 totalDebt;
- 119 : : uint256 totalSupplyVariableDebt;
- 120 : : uint256 reserveDecimals;
- 121 : : uint256 borrowCap;
- 122 : : uint256 amountInBaseCurrency;
- 123 : : uint256 assetUnit;
- 124 : : address eModePriceSource;
- 125 : : address siloedBorrowingAddress;
- 126 : : bool isActive;
- 127 : : bool isFrozen;
- 128 : : bool isPaused;
- 129 : : bool borrowingEnabled;
- 130 : : bool stableRateBorrowingEnabled;
- 131 : : bool siloedBorrowingEnabled;
- 132 : : }
- 133 : :
- 134 : : /**
- 135 : : * @notice Validates a borrow action.
- 136 : : * @param reservesData The state of all the reserves
- 137 : : * @param reservesList The addresses of all the active reserves
- 138 : : * @param eModeCategories The configuration of all the efficiency mode categories
- 139 : : * @param params Additional params needed for the validation
- 140 : : */
- 141 : 9117 : function validateBorrow(
- 142 : : mapping(address => DataTypes.ReserveData) storage reservesData,
- 143 : : mapping(uint256 => address) storage reservesList,
- 144 : : mapping(uint8 => DataTypes.EModeCategory) storage eModeCategories,
- 145 : : DataTypes.ValidateBorrowParams memory params
- 146 : : ) internal view {
- 147 : 18234 : require(params.amount != 0, Errors.INVALID_AMOUNT);
- 148 : :
- 149 : 18232 : ValidateBorrowLocalVars memory vars;
- 150 : :
- 151 : 18232 : (
- 152 : : vars.isActive,
- 153 : : vars.isFrozen,
- 154 : : vars.borrowingEnabled,
- 155 : : vars.stableRateBorrowingEnabled,
- 156 : : vars.isPaused
- 157 : : ) = params.reserveCache.reserveConfiguration.getFlags();
- 158 : :
- 159 : 18232 : require(vars.isActive, Errors.RESERVE_INACTIVE);
- 160 : 18230 : require(!vars.isPaused, Errors.RESERVE_PAUSED);
- 161 : 18228 : require(!vars.isFrozen, Errors.RESERVE_FROZEN);
- 162 : 18226 : require(vars.borrowingEnabled, Errors.BORROWING_NOT_ENABLED);
- 163 : 18226 : require(
- 164 : : IERC20(params.reserveCache.aTokenAddress).totalSupply() >= params.amount,
- 165 : : Errors.INVALID_AMOUNT
+ 74 : 44530 : (bool isActive, bool isFrozen, , bool isPaused) = reserveCache.reserveConfiguration.getFlags();
+ 75 : 44530 : require(isActive, Errors.RESERVE_INACTIVE);
+ 76 : 44529 : require(!isPaused, Errors.RESERVE_PAUSED);
+ 77 : 44528 : require(!isFrozen, Errors.RESERVE_FROZEN);
+ 78 : 44527 : require(onBehalfOf != reserveCache.aTokenAddress, Errors.SUPPLY_TO_ATOKEN);
+ 79 : :
+ 80 : 44526 : uint256 supplyCap = reserveCache.reserveConfiguration.getSupplyCap();
+ 81 : 44526 : require(
+ 82 : : supplyCap == 0 ||
+ 83 : : ((IAToken(reserveCache.aTokenAddress).scaledTotalSupply() +
+ 84 : : uint256(reserve.accruedToTreasury)).rayMul(reserveCache.nextLiquidityIndex) + amount) <=
+ 85 : : supplyCap * (10 ** reserveCache.reserveConfiguration.getDecimals()),
+ 86 : : Errors.SUPPLY_CAP_EXCEEDED
+ 87 : : );
+ 88 : : }
+ 89 : :
+ 90 : : /**
+ 91 : : * @notice Validates a withdraw action.
+ 92 : : * @param reserveCache The cached data of the reserve
+ 93 : : * @param amount The amount to be withdrawn
+ 94 : : * @param userBalance The balance of the user
+ 95 : : */
+ 96 : : function validateWithdraw(
+ 97 : : DataTypes.ReserveCache memory reserveCache,
+ 98 : : uint256 amount,
+ 99 : : uint256 userBalance
+ 100 : : ) internal pure {
+ 101 : 2044 : require(amount != 0, Errors.INVALID_AMOUNT);
+ 102 : 2043 : require(amount <= userBalance, Errors.NOT_ENOUGH_AVAILABLE_USER_BALANCE);
+ 103 : :
+ 104 : 2042 : (bool isActive, , , bool isPaused) = reserveCache.reserveConfiguration.getFlags();
+ 105 : 2042 : require(isActive, Errors.RESERVE_INACTIVE);
+ 106 : 2041 : require(!isPaused, Errors.RESERVE_PAUSED);
+ 107 : : }
+ 108 : :
+ 109 : : struct ValidateBorrowLocalVars {
+ 110 : : uint256 currentLtv;
+ 111 : : uint256 collateralNeededInBaseCurrency;
+ 112 : : uint256 userCollateralInBaseCurrency;
+ 113 : : uint256 userDebtInBaseCurrency;
+ 114 : : uint256 availableLiquidity;
+ 115 : : uint256 healthFactor;
+ 116 : : uint256 totalDebt;
+ 117 : : uint256 totalSupplyVariableDebt;
+ 118 : : uint256 reserveDecimals;
+ 119 : : uint256 borrowCap;
+ 120 : : uint256 amountInBaseCurrency;
+ 121 : : uint256 assetUnit;
+ 122 : : address siloedBorrowingAddress;
+ 123 : : bool isActive;
+ 124 : : bool isFrozen;
+ 125 : : bool isPaused;
+ 126 : : bool borrowingEnabled;
+ 127 : : bool siloedBorrowingEnabled;
+ 128 : : }
+ 129 : :
+ 130 : : /**
+ 131 : : * @notice Validates a borrow action.
+ 132 : : * @param reservesData The state of all the reserves
+ 133 : : * @param reservesList The addresses of all the active reserves
+ 134 : : * @param eModeCategories The configuration of all the efficiency mode categories
+ 135 : : * @param params Additional params needed for the validation
+ 136 : : */
+ 137 : : function validateBorrow(
+ 138 : : mapping(address => DataTypes.ReserveData) storage reservesData,
+ 139 : : mapping(uint256 => address) storage reservesList,
+ 140 : : mapping(uint8 => DataTypes.EModeCategory) storage eModeCategories,
+ 141 : : DataTypes.ValidateBorrowParams memory params
+ 142 : : ) internal view {
+ 143 : 16110 : require(params.amount != 0, Errors.INVALID_AMOUNT);
+ 144 : :
+ 145 : 16109 : ValidateBorrowLocalVars memory vars;
+ 146 : :
+ 147 : 16109 : (vars.isActive, vars.isFrozen, vars.borrowingEnabled, vars.isPaused) = params
+ 148 : : .reserveCache
+ 149 : : .reserveConfiguration
+ 150 : : .getFlags();
+ 151 : :
+ 152 : 16109 : require(vars.isActive, Errors.RESERVE_INACTIVE);
+ 153 : 16108 : require(!vars.isPaused, Errors.RESERVE_PAUSED);
+ 154 : 16107 : require(!vars.isFrozen, Errors.RESERVE_FROZEN);
+ 155 : 16106 : require(vars.borrowingEnabled, Errors.BORROWING_NOT_ENABLED);
+ 156 : 15106 : require(
+ 157 : : !params.reserveCache.reserveConfiguration.getIsVirtualAccActive() ||
+ 158 : : IERC20(params.reserveCache.aTokenAddress).totalSupply() >= params.amount,
+ 159 : : Errors.INVALID_AMOUNT
+ 160 : : );
+ 161 : :
+ 162 : 15105 : require(
+ 163 : : params.priceOracleSentinel == address(0) ||
+ 164 : : IPriceOracleSentinel(params.priceOracleSentinel).isBorrowAllowed(),
+ 165 : : Errors.PRICE_ORACLE_SENTINEL_CHECK_FAILED
166 : : );
167 : :
- 168 : 18224 : require(
- 169 : : params.priceOracleSentinel == address(0) ||
- 170 : : IPriceOracleSentinel(params.priceOracleSentinel).isBorrowAllowed(),
- 171 : : Errors.PRICE_ORACLE_SENTINEL_CHECK_FAILED
+ 168 : : //validate interest rate mode
+ 169 : 15104 : require(
+ 170 : : params.interestRateMode == DataTypes.InterestRateMode.VARIABLE,
+ 171 : : Errors.INVALID_INTEREST_RATE_MODE_SELECTED
172 : : );
173 : :
- 174 : : //validate interest rate mode
- 175 : 18222 : require(
- 176 : : params.interestRateMode == DataTypes.InterestRateMode.VARIABLE ||
- 177 : : params.interestRateMode == DataTypes.InterestRateMode.STABLE,
- 178 : : Errors.INVALID_INTEREST_RATE_MODE_SELECTED
- 179 : : );
- 180 : :
- 181 : 18220 : vars.reserveDecimals = params.reserveCache.reserveConfiguration.getDecimals();
- 182 : 18220 : vars.borrowCap = params.reserveCache.reserveConfiguration.getBorrowCap();
- 183 : : unchecked {
- 184 : 18220 : vars.assetUnit = 10 ** vars.reserveDecimals;
- 185 : : }
+ 174 : 15102 : vars.reserveDecimals = params.reserveCache.reserveConfiguration.getDecimals();
+ 175 : 15102 : vars.borrowCap = params.reserveCache.reserveConfiguration.getBorrowCap();
+ 176 : : unchecked {
+ 177 : 15102 : vars.assetUnit = 10 ** vars.reserveDecimals;
+ 178 : : }
+ 179 : :
+ 180 : 15102 : if (vars.borrowCap != 0) {
+ 181 : 7 : vars.totalSupplyVariableDebt = params.reserveCache.currScaledVariableDebt.rayMul(
+ 182 : : params.reserveCache.nextVariableBorrowIndex
+ 183 : : );
+ 184 : :
+ 185 : 7 : vars.totalDebt = vars.totalSupplyVariableDebt + params.amount;
186 : :
- 187 : 18220 : if (vars.borrowCap != 0) {
- 188 : 14 : vars.totalSupplyVariableDebt = params.reserveCache.currScaledVariableDebt.rayMul(
- 189 : : params.reserveCache.nextVariableBorrowIndex
- 190 : : );
+ 187 : : unchecked {
+ 188 : 7 : require(vars.totalDebt <= vars.borrowCap * vars.assetUnit, Errors.BORROW_CAP_EXCEEDED);
+ 189 : : }
+ 190 : : }
191 : :
- 192 : 14 : vars.totalDebt =
- 193 : : params.reserveCache.currTotalStableDebt +
- 194 : : vars.totalSupplyVariableDebt +
- 195 : : params.amount;
- 196 : :
- 197 : : unchecked {
- 198 : 14 : require(vars.totalDebt <= vars.borrowCap * vars.assetUnit, Errors.BORROW_CAP_EXCEEDED);
- 199 : : }
- 200 : : }
- 201 : :
- 202 : 9107 : if (params.isolationModeActive) {
- 203 : : // check that the asset being borrowed is borrowable in isolation mode AND
- 204 : : // the total exposure is no bigger than the collateral debt ceiling
- 205 : 22 : require(
- 206 : : params.reserveCache.reserveConfiguration.getBorrowableInIsolation(),
- 207 : : Errors.ASSET_NOT_BORROWABLE_IN_ISOLATION
- 208 : : );
+ 192 : 15099 : if (params.isolationModeActive) {
+ 193 : : // check that the asset being borrowed is borrowable in isolation mode AND
+ 194 : : // the total exposure is no bigger than the collateral debt ceiling
+ 195 : 11 : require(
+ 196 : : params.reserveCache.reserveConfiguration.getBorrowableInIsolation(),
+ 197 : : Errors.ASSET_NOT_BORROWABLE_IN_ISOLATION
+ 198 : : );
+ 199 : :
+ 200 : 10 : require(
+ 201 : : reservesData[params.isolationModeCollateralAddress].isolationModeTotalDebt +
+ 202 : : (params.amount /
+ 203 : : 10 ** (vars.reserveDecimals - ReserveConfiguration.DEBT_CEILING_DECIMALS))
+ 204 : : .toUint128() <=
+ 205 : : params.isolationModeDebtCeiling,
+ 206 : : Errors.DEBT_CEILING_EXCEEDED
+ 207 : : );
+ 208 : : }
209 : :
- 210 : 20 : require(
- 211 : : reservesData[params.isolationModeCollateralAddress].isolationModeTotalDebt +
- 212 : : (params.amount /
- 213 : : 10 ** (vars.reserveDecimals - ReserveConfiguration.DEBT_CEILING_DECIMALS))
- 214 : : .toUint128() <=
- 215 : : params.isolationModeDebtCeiling,
- 216 : : Errors.DEBT_CEILING_EXCEEDED
+ 210 : 15096 : if (params.userEModeCategory != 0) {
+ 211 : 4006 : require(
+ 212 : : EModeConfiguration.isReserveEnabledOnBitmap(
+ 213 : : eModeCategories[params.userEModeCategory].borrowableBitmap,
+ 214 : : reservesData[params.asset].id
+ 215 : : ),
+ 216 : : Errors.NOT_BORROWABLE_IN_EMODE
217 : : );
218 : : }
219 : :
- 220 : 18208 : if (params.userEModeCategory != 0) {
- 221 : 14 : require(
- 222 : : params.reserveCache.reserveConfiguration.getEModeCategory() == params.userEModeCategory,
- 223 : : Errors.INCONSISTENT_EMODE_CATEGORY
- 224 : : );
- 225 : 12 : vars.eModePriceSource = eModeCategories[params.userEModeCategory].priceSource;
- 226 : : }
- 227 : :
- 228 : 18206 : (
- 229 : : vars.userCollateralInBaseCurrency,
- 230 : : vars.userDebtInBaseCurrency,
- 231 : : vars.currentLtv,
- 232 : : ,
- 233 : : vars.healthFactor,
- 234 : :
- 235 : : ) = GenericLogic.calculateUserAccountData(
- 236 : : reservesData,
- 237 : : reservesList,
- 238 : : eModeCategories,
- 239 : : DataTypes.CalculateUserAccountDataParams({
- 240 : : userConfig: params.userConfig,
- 241 : : reservesCount: params.reservesCount,
- 242 : : user: params.userAddress,
- 243 : : oracle: params.oracle,
- 244 : : userEModeCategory: params.userEModeCategory
- 245 : : })
+ 220 : 15095 : (
+ 221 : : vars.userCollateralInBaseCurrency,
+ 222 : : vars.userDebtInBaseCurrency,
+ 223 : : vars.currentLtv,
+ 224 : : ,
+ 225 : : vars.healthFactor,
+ 226 : :
+ 227 : : ) = GenericLogic.calculateUserAccountData(
+ 228 : : reservesData,
+ 229 : : reservesList,
+ 230 : : eModeCategories,
+ 231 : : DataTypes.CalculateUserAccountDataParams({
+ 232 : : userConfig: params.userConfig,
+ 233 : : reservesCount: params.reservesCount,
+ 234 : : user: params.userAddress,
+ 235 : : oracle: params.oracle,
+ 236 : : userEModeCategory: params.userEModeCategory
+ 237 : : })
+ 238 : : );
+ 239 : :
+ 240 : 15095 : require(vars.userCollateralInBaseCurrency != 0, Errors.COLLATERAL_BALANCE_IS_ZERO);
+ 241 : 15094 : require(vars.currentLtv != 0, Errors.LTV_VALIDATION_FAILED);
+ 242 : :
+ 243 : 15094 : require(
+ 244 : : vars.healthFactor > HEALTH_FACTOR_LIQUIDATION_THRESHOLD,
+ 245 : : Errors.HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD
246 : : );
247 : :
- 248 : 18206 : require(vars.userCollateralInBaseCurrency != 0, Errors.COLLATERAL_BALANCE_IS_ZERO);
- 249 : 18204 : require(vars.currentLtv != 0, Errors.LTV_VALIDATION_FAILED);
- 250 : :
- 251 : 18204 : require(
- 252 : : vars.healthFactor > HEALTH_FACTOR_LIQUIDATION_THRESHOLD,
- 253 : : Errors.HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD
- 254 : : );
- 255 : :
- 256 : 18202 : vars.amountInBaseCurrency =
- 257 : : IPriceOracleGetter(params.oracle).getAssetPrice(
- 258 : : vars.eModePriceSource != address(0) ? vars.eModePriceSource : params.asset
- 259 : : ) *
- 260 : : params.amount;
- 261 : : unchecked {
- 262 : 18202 : vars.amountInBaseCurrency /= vars.assetUnit;
- 263 : : }
- 264 : :
- 265 : : //add the current already borrowed amount to the amount requested to calculate the total collateral needed.
- 266 : 18202 : vars.collateralNeededInBaseCurrency = (vars.userDebtInBaseCurrency + vars.amountInBaseCurrency)
- 267 : : .percentDiv(vars.currentLtv); //LTV is calculated in percentage
+ 248 : 15093 : vars.amountInBaseCurrency =
+ 249 : : IPriceOracleGetter(params.oracle).getAssetPrice(params.asset) *
+ 250 : : params.amount;
+ 251 : : unchecked {
+ 252 : 15093 : vars.amountInBaseCurrency /= vars.assetUnit;
+ 253 : : }
+ 254 : :
+ 255 : : //add the current already borrowed amount to the amount requested to calculate the total collateral needed.
+ 256 : 15093 : vars.collateralNeededInBaseCurrency = (vars.userDebtInBaseCurrency + vars.amountInBaseCurrency)
+ 257 : : .percentDiv(vars.currentLtv); //LTV is calculated in percentage
+ 258 : :
+ 259 : 15093 : require(
+ 260 : : vars.collateralNeededInBaseCurrency <= vars.userCollateralInBaseCurrency,
+ 261 : : Errors.COLLATERAL_CANNOT_COVER_NEW_BORROW
+ 262 : : );
+ 263 : :
+ 264 : 15092 : if (params.userConfig.isBorrowingAny()) {
+ 265 : 7 : (vars.siloedBorrowingEnabled, vars.siloedBorrowingAddress) = params
+ 266 : : .userConfig
+ 267 : : .getSiloedBorrowingState(reservesData, reservesList);
268 : :
- 269 : 18202 : require(
- 270 : : vars.collateralNeededInBaseCurrency <= vars.userCollateralInBaseCurrency,
- 271 : : Errors.COLLATERAL_CANNOT_COVER_NEW_BORROW
- 272 : : );
- 273 : :
- 274 : : /**
- 275 : : * Following conditions need to be met if the user is borrowing at a stable rate:
- 276 : : * 1. Reserve must be enabled for stable rate borrowing
- 277 : : * 2. Users cannot borrow from the reserve if their collateral is (mostly) the same currency
- 278 : : * they are borrowing, to prevent abuses.
- 279 : : * 3. Users will be able to borrow only a portion of the total available liquidity
- 280 : : */
- 281 : :
- 282 : 18200 : if (params.interestRateMode == DataTypes.InterestRateMode.STABLE) {
- 283 : : //check if the borrow mode is stable and if stable rate borrowing is enabled on this reserve
- 284 : :
- 285 : 8 : require(vars.stableRateBorrowingEnabled, Errors.STABLE_BORROWING_NOT_ENABLED);
- 286 : :
- 287 : 6 : require(
- 288 : : !params.userConfig.isUsingAsCollateral(reservesData[params.asset].id) ||
- 289 : : params.reserveCache.reserveConfiguration.getLtv() == 0 ||
- 290 : : params.amount > IERC20(params.reserveCache.aTokenAddress).balanceOf(params.userAddress),
- 291 : : Errors.COLLATERAL_SAME_AS_BORROWING_CURRENCY
- 292 : : );
- 293 : :
- 294 : 4 : vars.availableLiquidity = reservesData[params.asset].virtualUnderlyingBalance;
- 295 : :
- 296 : : //calculate the max available loan size in stable rate mode as a percentage of the
- 297 : : //available liquidity
- 298 : 6 : uint256 maxLoanSizeStable = vars.availableLiquidity.percentMul(params.maxStableLoanPercent);
- 299 : :
- 300 : 4 : require(params.amount <= maxLoanSizeStable, Errors.AMOUNT_BIGGER_THAN_MAX_LOAN_SIZE_STABLE);
- 301 : : }
- 302 : :
- 303 : 18194 : if (params.userConfig.isBorrowingAny()) {
- 304 : 14 : (vars.siloedBorrowingEnabled, vars.siloedBorrowingAddress) = params
- 305 : : .userConfig
- 306 : : .getSiloedBorrowingState(reservesData, reservesList);
+ 269 : 7 : if (vars.siloedBorrowingEnabled) {
+ 270 : 1 : require(vars.siloedBorrowingAddress == params.asset, Errors.SILOED_BORROWING_VIOLATION);
+ 271 : : } else {
+ 272 : 6 : require(
+ 273 : : !params.reserveCache.reserveConfiguration.getSiloedBorrowing(),
+ 274 : : Errors.SILOED_BORROWING_VIOLATION
+ 275 : : );
+ 276 : : }
+ 277 : : }
+ 278 : : }
+ 279 : :
+ 280 : : /**
+ 281 : : * @notice Validates a repay action.
+ 282 : : * @param reserveCache The cached data of the reserve
+ 283 : : * @param amountSent The amount sent for the repayment. Can be an actual value or uint(-1)
+ 284 : : * @param onBehalfOf The address of the user msg.sender is repaying for
+ 285 : : * @param debt The borrow balance of the user
+ 286 : : */
+ 287 : : function validateRepay(
+ 288 : : DataTypes.ReserveCache memory reserveCache,
+ 289 : : uint256 amountSent,
+ 290 : : DataTypes.InterestRateMode interestRateMode,
+ 291 : : address onBehalfOf,
+ 292 : : uint256 debt
+ 293 : : ) internal view {
+ 294 : 5030 : require(amountSent != 0, Errors.INVALID_AMOUNT);
+ 295 : 5029 : require(
+ 296 : : interestRateMode == DataTypes.InterestRateMode.VARIABLE,
+ 297 : : Errors.INVALID_INTEREST_RATE_MODE_SELECTED
+ 298 : : );
+ 299 : 5028 : require(
+ 300 : : amountSent != type(uint256).max || msg.sender == onBehalfOf,
+ 301 : : Errors.NO_EXPLICIT_AMOUNT_TO_REPAY_ON_BEHALF
+ 302 : : );
+ 303 : :
+ 304 : 5027 : (bool isActive, , , bool isPaused) = reserveCache.reserveConfiguration.getFlags();
+ 305 : 5027 : require(isActive, Errors.RESERVE_INACTIVE);
+ 306 : 5026 : require(!isPaused, Errors.RESERVE_PAUSED);
307 : :
- 308 : 7 : if (vars.siloedBorrowingEnabled) {
- 309 : 2 : require(vars.siloedBorrowingAddress == params.asset, Errors.SILOED_BORROWING_VIOLATION);
- 310 : : } else {
- 311 : 12 : require(
- 312 : : !params.reserveCache.reserveConfiguration.getSiloedBorrowing(),
- 313 : : Errors.SILOED_BORROWING_VIOLATION
- 314 : : );
- 315 : : }
- 316 : : }
- 317 : : }
- 318 : :
- 319 : : /**
- 320 : : * @notice Validates a repay action.
- 321 : : * @param reserveCache The cached data of the reserve
- 322 : : * @param amountSent The amount sent for the repayment. Can be an actual value or uint(-1)
- 323 : : * @param interestRateMode The interest rate mode of the debt being repaid
- 324 : : * @param onBehalfOf The address of the user msg.sender is repaying for
- 325 : : * @param stableDebt The borrow balance of the user
- 326 : : * @param variableDebt The borrow balance of the user
- 327 : : */
- 328 : 5029 : function validateRepay(
- 329 : : DataTypes.ReserveCache memory reserveCache,
- 330 : : uint256 amountSent,
- 331 : : DataTypes.InterestRateMode interestRateMode,
- 332 : : address onBehalfOf,
- 333 : : uint256 stableDebt,
- 334 : : uint256 variableDebt
- 335 : : ) internal view {
- 336 : 10058 : require(amountSent != 0, Errors.INVALID_AMOUNT);
- 337 : 10056 : require(
- 338 : : amountSent != type(uint256).max || msg.sender == onBehalfOf,
- 339 : : Errors.NO_EXPLICIT_AMOUNT_TO_REPAY_ON_BEHALF
- 340 : : );
- 341 : :
- 342 : 15081 : (bool isActive, , , , bool isPaused) = reserveCache.reserveConfiguration.getFlags();
- 343 : 10054 : require(isActive, Errors.RESERVE_INACTIVE);
- 344 : 10052 : require(!isPaused, Errors.RESERVE_PAUSED);
- 345 : :
- 346 : 10050 : require(
- 347 : : (stableDebt != 0 && interestRateMode == DataTypes.InterestRateMode.STABLE) ||
- 348 : : (variableDebt != 0 && interestRateMode == DataTypes.InterestRateMode.VARIABLE),
- 349 : : Errors.NO_DEBT_OF_SELECTED_TYPE
- 350 : : );
- 351 : : }
- 352 : :
- 353 : : /**
- 354 : : * @notice Validates a swap of borrow rate mode.
- 355 : : * @param reserve The reserve state on which the user is swapping the rate
- 356 : : * @param reserveCache The cached data of the reserve
- 357 : : * @param userConfig The user reserves configuration
- 358 : : * @param stableDebt The stable debt of the user
- 359 : : * @param variableDebt The variable debt of the user
- 360 : : * @param currentRateMode The rate mode of the debt being swapped
- 361 : : */
- 362 : 8 : function validateSwapRateMode(
- 363 : : DataTypes.ReserveData storage reserve,
- 364 : : DataTypes.ReserveCache memory reserveCache,
- 365 : : DataTypes.UserConfigurationMap storage userConfig,
- 366 : : uint256 stableDebt,
- 367 : : uint256 variableDebt,
- 368 : : DataTypes.InterestRateMode currentRateMode
- 369 : : ) internal view {
- 370 : 24 : (bool isActive, , , bool stableRateEnabled, bool isPaused) = reserveCache
- 371 : : .reserveConfiguration
- 372 : : .getFlags();
- 373 : 16 : require(isActive, Errors.RESERVE_INACTIVE);
- 374 : 14 : require(!isPaused, Errors.RESERVE_PAUSED);
- 375 : :
- 376 : 12 : if (currentRateMode == DataTypes.InterestRateMode.STABLE) {
- 377 : 2 : require(stableDebt != 0, Errors.NO_OUTSTANDING_STABLE_DEBT);
- 378 : 10 : } else if (currentRateMode == DataTypes.InterestRateMode.VARIABLE) {
- 379 : 8 : require(variableDebt != 0, Errors.NO_OUTSTANDING_VARIABLE_DEBT);
- 380 : : /**
- 381 : : * user wants to swap to stable, before swapping we need to ensure that
- 382 : : * 1. stable borrow rate is enabled on the reserve
- 383 : : * 2. user is not trying to abuse the reserve by supplying
- 384 : : * more collateral than he is borrowing, artificially lowering
- 385 : : * the interest rate, borrowing at variable, and switching to stable
- 386 : : */
- 387 : 6 : require(stableRateEnabled, Errors.STABLE_BORROWING_NOT_ENABLED);
+ 308 : 5025 : require(debt != 0, Errors.NO_DEBT_OF_SELECTED_TYPE);
+ 309 : : }
+ 310 : :
+ 311 : : /**
+ 312 : : * @notice Validates the action of setting an asset as collateral.
+ 313 : : * @param reserveCache The cached data of the reserve
+ 314 : : * @param userBalance The balance of the user
+ 315 : : */
+ 316 : : function validateSetUseReserveAsCollateral(
+ 317 : : DataTypes.ReserveCache memory reserveCache,
+ 318 : : uint256 userBalance
+ 319 : : ) internal pure {
+ 320 : 43 : require(userBalance != 0, Errors.UNDERLYING_BALANCE_ZERO);
+ 321 : :
+ 322 : 41 : (bool isActive, , , bool isPaused) = reserveCache.reserveConfiguration.getFlags();
+ 323 : 41 : require(isActive, Errors.RESERVE_INACTIVE);
+ 324 : 39 : require(!isPaused, Errors.RESERVE_PAUSED);
+ 325 : : }
+ 326 : :
+ 327 : : /**
+ 328 : : * @notice Validates a flashloan action.
+ 329 : : * @param reservesData The state of all the reserves
+ 330 : : * @param assets The assets being flash-borrowed
+ 331 : : * @param amounts The amounts for each asset being borrowed
+ 332 : : */
+ 333 : : function validateFlashloan(
+ 334 : : mapping(address => DataTypes.ReserveData) storage reservesData,
+ 335 : : address[] memory assets,
+ 336 : : uint256[] memory amounts
+ 337 : : ) internal view {
+ 338 : 1011 : require(assets.length == amounts.length, Errors.INCONSISTENT_FLASHLOAN_PARAMS);
+ 339 : 1011 : for (uint256 i = 0; i < assets.length; i++) {
+ 340 : 1012 : for (uint256 j = i + 1; j < assets.length; j++) {
+ 341 : 1001 : require(assets[i] != assets[j], Errors.INCONSISTENT_FLASHLOAN_PARAMS);
+ 342 : : }
+ 343 : 12 : validateFlashloanSimple(reservesData[assets[i]], amounts[i]);
+ 344 : : }
+ 345 : : }
+ 346 : :
+ 347 : : /**
+ 348 : : * @notice Validates a flashloan action.
+ 349 : : * @param reserve The state of the reserve
+ 350 : : */
+ 351 : : function validateFlashloanSimple(
+ 352 : : DataTypes.ReserveData storage reserve,
+ 353 : : uint256 amount
+ 354 : : ) internal view {
+ 355 : 23 : DataTypes.ReserveConfigurationMap memory configuration = reserve.configuration;
+ 356 : 23 : require(!configuration.getPaused(), Errors.RESERVE_PAUSED);
+ 357 : 22 : require(configuration.getActive(), Errors.RESERVE_INACTIVE);
+ 358 : 21 : require(configuration.getFlashLoanEnabled(), Errors.FLASHLOAN_DISABLED);
+ 359 : 20 : require(
+ 360 : : !configuration.getIsVirtualAccActive() ||
+ 361 : : IERC20(reserve.aTokenAddress).totalSupply() >= amount,
+ 362 : : Errors.INVALID_AMOUNT
+ 363 : : );
+ 364 : : }
+ 365 : :
+ 366 : : struct ValidateLiquidationCallLocalVars {
+ 367 : : bool collateralReserveActive;
+ 368 : : bool collateralReservePaused;
+ 369 : : bool principalReserveActive;
+ 370 : : bool principalReservePaused;
+ 371 : : bool isCollateralEnabled;
+ 372 : : }
+ 373 : :
+ 374 : : /**
+ 375 : : * @notice Validates the liquidation action.
+ 376 : : * @param userConfig The user configuration mapping
+ 377 : : * @param collateralReserve The reserve data of the collateral
+ 378 : : * @param debtReserve The reserve data of the debt
+ 379 : : * @param params Additional parameters needed for the validation
+ 380 : : */
+ 381 : : function validateLiquidationCall(
+ 382 : : DataTypes.UserConfigurationMap storage userConfig,
+ 383 : : DataTypes.ReserveData storage collateralReserve,
+ 384 : : DataTypes.ReserveData storage debtReserve,
+ 385 : : DataTypes.ValidateLiquidationCallParams memory params
+ 386 : : ) internal view {
+ 387 : 14501 : ValidateLiquidationCallLocalVars memory vars;
388 : :
- 389 : 6 : require(
- 390 : : !userConfig.isUsingAsCollateral(reserve.id) ||
- 391 : : reserveCache.reserveConfiguration.getLtv() == 0 ||
- 392 : : stableDebt + variableDebt > IERC20(reserveCache.aTokenAddress).balanceOf(msg.sender),
- 393 : : Errors.COLLATERAL_SAME_AS_BORROWING_CURRENCY
- 394 : : );
- 395 : : } else {
- 396 : 2 : revert(Errors.INVALID_INTEREST_RATE_MODE_SELECTED);
- 397 : : }
- 398 : : }
- 399 : :
- 400 : : /**
- 401 : : * @notice Validates a stable borrow rate rebalance action.
- 402 : : * @dev Rebalancing is accepted when depositors are earning <= 90% of their earnings in pure supply/demand market (variable rate only)
- 403 : : * For this to be the case, there has to be quite large stable debt with an interest rate below the current variable rate.
- 404 : : * @param reserve The reserve state on which the user is getting rebalanced
- 405 : : * @param reserveCache The cached state of the reserve
- 406 : : * @param reserveAddress The address of the reserve
- 407 : : */
- 408 : 5 : function validateRebalanceStableBorrowRate(
- 409 : : DataTypes.ReserveData storage reserve,
- 410 : : DataTypes.ReserveCache memory reserveCache,
- 411 : : address reserveAddress
- 412 : : ) internal view {
- 413 : 15 : (bool isActive, , , , bool isPaused) = reserveCache.reserveConfiguration.getFlags();
- 414 : 10 : require(isActive, Errors.RESERVE_INACTIVE);
- 415 : 8 : require(!isPaused, Errors.RESERVE_PAUSED);
- 416 : :
- 417 : 12 : uint256 totalDebt = IERC20(reserveCache.stableDebtTokenAddress).totalSupply() +
- 418 : 6 : IERC20(reserveCache.variableDebtTokenAddress).totalSupply();
- 419 : :
- 420 : 9 : (uint256 liquidityRateVariableDebtOnly, , ) = IReserveInterestRateStrategy(
- 421 : : reserve.interestRateStrategyAddress
- 422 : : ).calculateInterestRates(
- 423 : : DataTypes.CalculateInterestRatesParams({
- 424 : : unbacked: reserve.unbacked,
- 425 : : liquidityAdded: 0,
- 426 : : liquidityTaken: 0,
- 427 : : totalStableDebt: 0,
- 428 : : totalVariableDebt: totalDebt,
- 429 : : averageStableBorrowRate: 0,
- 430 : : reserveFactor: reserveCache.reserveFactor,
- 431 : : reserve: reserveAddress,
- 432 : : usingVirtualBalance: reserve.configuration.getIsVirtualAccActive(),
- 433 : : virtualUnderlyingBalance: reserve.virtualUnderlyingBalance
- 434 : : })
- 435 : : );
- 436 : :
- 437 : 6 : require(
- 438 : : reserveCache.currLiquidityRate <=
- 439 : : liquidityRateVariableDebtOnly.percentMul(REBALANCE_UP_LIQUIDITY_RATE_THRESHOLD),
- 440 : : Errors.INTEREST_RATE_REBALANCE_CONDITIONS_NOT_MET
- 441 : : );
- 442 : : }
- 443 : :
- 444 : : /**
- 445 : : * @notice Validates the action of setting an asset as collateral.
- 446 : : * @param reserveCache The cached data of the reserve
- 447 : : * @param userBalance The balance of the user
- 448 : : */
- 449 : 43 : function validateSetUseReserveAsCollateral(
- 450 : : DataTypes.ReserveCache memory reserveCache,
- 451 : : uint256 userBalance
- 452 : : ) internal pure {
- 453 : 86 : require(userBalance != 0, Errors.UNDERLYING_BALANCE_ZERO);
- 454 : :
- 455 : 123 : (bool isActive, , , , bool isPaused) = reserveCache.reserveConfiguration.getFlags();
- 456 : 82 : require(isActive, Errors.RESERVE_INACTIVE);
- 457 : 78 : require(!isPaused, Errors.RESERVE_PAUSED);
- 458 : : }
- 459 : :
- 460 : : /**
- 461 : : * @notice Validates a flashloan action.
- 462 : : * @param reservesData The state of all the reserves
- 463 : : * @param assets The assets being flash-borrowed
- 464 : : * @param amounts The amounts for each asset being borrowed
- 465 : : */
- 466 : 10 : function validateFlashloan(
- 467 : : mapping(address => DataTypes.ReserveData) storage reservesData,
- 468 : : address[] memory assets,
- 469 : : uint256[] memory amounts
- 470 : : ) internal view {
- 471 : 20 : require(assets.length == amounts.length, Errors.INCONSISTENT_FLASHLOAN_PARAMS);
- 472 : 44 : for (uint256 i = 0; i < assets.length; i++) {
- 473 : 22 : validateFlashloanSimple(reservesData[assets[i]], amounts[i]);
- 474 : : }
- 475 : : }
- 476 : :
- 477 : : /**
- 478 : : * @notice Validates a flashloan action.
- 479 : : * @param reserve The state of the reserve
- 480 : : */
- 481 : 21 : function validateFlashloanSimple(
- 482 : : DataTypes.ReserveData storage reserve,
- 483 : : uint256 amount
- 484 : : ) internal view {
- 485 : 42 : DataTypes.ReserveConfigurationMap memory configuration = reserve.configuration;
- 486 : 42 : require(!configuration.getPaused(), Errors.RESERVE_PAUSED);
- 487 : 40 : require(configuration.getActive(), Errors.RESERVE_INACTIVE);
- 488 : 38 : require(configuration.getFlashLoanEnabled(), Errors.FLASHLOAN_DISABLED);
- 489 : 36 : require(IERC20(reserve.aTokenAddress).totalSupply() >= amount, Errors.INVALID_AMOUNT);
- 490 : : }
- 491 : :
- 492 : : struct ValidateLiquidationCallLocalVars {
- 493 : : bool collateralReserveActive;
- 494 : : bool collateralReservePaused;
- 495 : : bool principalReserveActive;
- 496 : : bool principalReservePaused;
- 497 : : bool isCollateralEnabled;
- 498 : : }
- 499 : :
- 500 : : /**
- 501 : : * @notice Validates the liquidation action.
- 502 : : * @param userConfig The user configuration mapping
- 503 : : * @param collateralReserve The reserve data of the collateral
- 504 : : * @param debtReserve The reserve data of the debt
- 505 : : * @param params Additional parameters needed for the validation
- 506 : : */
- 507 : 11292 : function validateLiquidationCall(
- 508 : : DataTypes.UserConfigurationMap storage userConfig,
- 509 : : DataTypes.ReserveData storage collateralReserve,
- 510 : : DataTypes.ReserveData storage debtReserve,
- 511 : : DataTypes.ValidateLiquidationCallParams memory params
- 512 : : ) internal view {
- 513 : 22584 : ValidateLiquidationCallLocalVars memory vars;
- 514 : :
- 515 : 22584 : (vars.collateralReserveActive, , , , vars.collateralReservePaused) = collateralReserve
- 516 : : .configuration
- 517 : : .getFlags();
- 518 : :
- 519 : 22584 : (vars.principalReserveActive, , , , vars.principalReservePaused) = params
- 520 : : .debtReserveCache
- 521 : : .reserveConfiguration
- 522 : : .getFlags();
- 523 : :
- 524 : 22584 : require(vars.collateralReserveActive && vars.principalReserveActive, Errors.RESERVE_INACTIVE);
- 525 : 22582 : require(!vars.collateralReservePaused && !vars.principalReservePaused, Errors.RESERVE_PAUSED);
- 526 : :
- 527 : 22580 : require(
- 528 : : params.priceOracleSentinel == address(0) ||
- 529 : : params.healthFactor < MINIMUM_HEALTH_FACTOR_LIQUIDATION_THRESHOLD ||
- 530 : : IPriceOracleSentinel(params.priceOracleSentinel).isLiquidationAllowed(),
- 531 : : Errors.PRICE_ORACLE_SENTINEL_CHECK_FAILED
- 532 : : );
- 533 : :
- 534 : 22578 : require(
- 535 : : collateralReserve.liquidationGracePeriodUntil < uint40(block.timestamp) &&
- 536 : : debtReserve.liquidationGracePeriodUntil < uint40(block.timestamp),
- 537 : : Errors.LIQUIDATION_GRACE_SENTINEL_CHECK_FAILED
- 538 : : );
- 539 : :
- 540 : 12030 : require(
- 541 : : params.healthFactor < HEALTH_FACTOR_LIQUIDATION_THRESHOLD,
- 542 : : Errors.HEALTH_FACTOR_NOT_BELOW_THRESHOLD
- 543 : : );
- 544 : :
- 545 : 12028 : vars.isCollateralEnabled =
- 546 : : collateralReserve.configuration.getLiquidationThreshold() != 0 &&
- 547 : : userConfig.isUsingAsCollateral(collateralReserve.id);
- 548 : :
- 549 : : //if collateral isn't enabled as collateral by user, it cannot be liquidated
- 550 : 12028 : require(vars.isCollateralEnabled, Errors.COLLATERAL_CANNOT_BE_LIQUIDATED);
- 551 : 12026 : require(params.totalDebt != 0, Errors.SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER);
- 552 : : }
- 553 : :
- 554 : : /**
- 555 : : * @notice Validates the health factor of a user.
- 556 : : * @param reservesData The state of all the reserves
- 557 : : * @param reservesList The addresses of all the active reserves
- 558 : : * @param eModeCategories The configuration of all the efficiency mode categories
- 559 : : * @param userConfig The state of the user for the specific reserve
- 560 : : * @param user The user to validate health factor of
- 561 : : * @param userEModeCategory The users active efficiency mode category
- 562 : : * @param reservesCount The number of available reserves
- 563 : : * @param oracle The price oracle
- 564 : : */
- 565 : 27 : function validateHealthFactor(
- 566 : : mapping(address => DataTypes.ReserveData) storage reservesData,
- 567 : : mapping(uint256 => address) storage reservesList,
- 568 : : mapping(uint8 => DataTypes.EModeCategory) storage eModeCategories,
- 569 : : DataTypes.UserConfigurationMap memory userConfig,
- 570 : : address user,
- 571 : : uint8 userEModeCategory,
- 572 : : uint256 reservesCount,
- 573 : : address oracle
- 574 : : ) internal view returns (uint256, bool) {
- 575 : 81 : (, , , , uint256 healthFactor, bool hasZeroLtvCollateral) = GenericLogic
- 576 : : .calculateUserAccountData(
- 577 : : reservesData,
- 578 : : reservesList,
- 579 : : eModeCategories,
- 580 : : DataTypes.CalculateUserAccountDataParams({
- 581 : : userConfig: userConfig,
- 582 : : reservesCount: reservesCount,
- 583 : : user: user,
- 584 : : oracle: oracle,
- 585 : : userEModeCategory: userEModeCategory
- 586 : : })
- 587 : : );
- 588 : :
- 589 : 54 : require(
- 590 : : healthFactor >= HEALTH_FACTOR_LIQUIDATION_THRESHOLD,
- 591 : : Errors.HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD
- 592 : : );
- 593 : :
- 594 : 42 : return (healthFactor, hasZeroLtvCollateral);
- 595 : : }
- 596 : :
- 597 : : /**
- 598 : : * @notice Validates the health factor of a user and the ltv of the asset being withdrawn.
- 599 : : * @param reservesData The state of all the reserves
- 600 : : * @param reservesList The addresses of all the active reserves
- 601 : : * @param eModeCategories The configuration of all the efficiency mode categories
- 602 : : * @param userConfig The state of the user for the specific reserve
- 603 : : * @param asset The asset for which the ltv will be validated
- 604 : : * @param from The user from which the aTokens are being transferred
- 605 : : * @param reservesCount The number of available reserves
- 606 : : * @param oracle The price oracle
- 607 : : * @param userEModeCategory The users active efficiency mode category
- 608 : : */
- 609 : 23 : function validateHFAndLtv(
- 610 : : mapping(address => DataTypes.ReserveData) storage reservesData,
- 611 : : mapping(uint256 => address) storage reservesList,
- 612 : : mapping(uint8 => DataTypes.EModeCategory) storage eModeCategories,
- 613 : : DataTypes.UserConfigurationMap memory userConfig,
- 614 : : address asset,
- 615 : : address from,
- 616 : : uint256 reservesCount,
- 617 : : address oracle,
- 618 : : uint8 userEModeCategory
- 619 : : ) internal view {
- 620 : 46 : DataTypes.ReserveData memory reserve = reservesData[asset];
- 621 : :
- 622 : 69 : (, bool hasZeroLtvCollateral) = validateHealthFactor(
- 623 : : reservesData,
- 624 : : reservesList,
- 625 : : eModeCategories,
- 626 : : userConfig,
- 627 : : from,
- 628 : : userEModeCategory,
- 629 : : reservesCount,
- 630 : : oracle
- 631 : : );
- 632 : :
- 633 : 38 : require(
- 634 : : !hasZeroLtvCollateral || reserve.configuration.getLtv() == 0,
- 635 : : Errors.LTV_VALIDATION_FAILED
- 636 : : );
- 637 : : }
- 638 : :
- 639 : : /**
- 640 : : * @notice Validates a transfer action.
- 641 : : * @param reserve The reserve object
- 642 : : */
- 643 : 1036 : function validateTransfer(DataTypes.ReserveData storage reserve) internal view {
- 644 : 2072 : require(!reserve.configuration.getPaused(), Errors.RESERVE_PAUSED);
- 645 : : }
- 646 : :
- 647 : : /**
- 648 : : * @notice Validates a drop reserve action.
- 649 : : * @param reservesList The addresses of all the active reserves
- 650 : : * @param reserve The reserve object
- 651 : : * @param asset The address of the reserve's underlying asset
- 652 : : */
- 653 : 9 : function validateDropReserve(
- 654 : : mapping(uint256 => address) storage reservesList,
- 655 : : DataTypes.ReserveData storage reserve,
- 656 : : address asset
- 657 : : ) internal view {
- 658 : 18 : require(asset != address(0), Errors.ZERO_ADDRESS_NOT_VALID);
- 659 : 16 : require(reserve.id != 0 || reservesList[0] == asset, Errors.ASSET_NOT_LISTED);
- 660 : 14 : require(IERC20(reserve.stableDebtTokenAddress).totalSupply() == 0, Errors.STABLE_DEBT_NOT_ZERO);
- 661 : 14 : require(
- 662 : : IERC20(reserve.variableDebtTokenAddress).totalSupply() == 0,
- 663 : : Errors.VARIABLE_DEBT_SUPPLY_NOT_ZERO
- 664 : : );
- 665 : 12 : require(
- 666 : : IERC20(reserve.aTokenAddress).totalSupply() == 0 && reserve.accruedToTreasury == 0,
- 667 : : Errors.UNDERLYING_CLAIMABLE_RIGHTS_NOT_ZERO
- 668 : : );
- 669 : : }
- 670 : :
- 671 : : /**
- 672 : : * @notice Validates the action of setting efficiency mode.
- 673 : : * @param reservesData The state of all the reserves
- 674 : : * @param reservesList The addresses of all the active reserves
- 675 : : * @param eModeCategories a mapping storing configurations for all efficiency mode categories
- 676 : : * @param userConfig the user configuration
- 677 : : * @param reservesCount The total number of valid reserves
- 678 : : * @param categoryId The id of the category
- 679 : : */
- 680 : 17 : function validateSetUserEMode(
- 681 : : mapping(address => DataTypes.ReserveData) storage reservesData,
- 682 : : mapping(uint256 => address) storage reservesList,
- 683 : : mapping(uint8 => DataTypes.EModeCategory) storage eModeCategories,
- 684 : : DataTypes.UserConfigurationMap memory userConfig,
- 685 : : uint256 reservesCount,
- 686 : : uint8 categoryId
- 687 : : ) internal view {
- 688 : : // category is invalid if the liq threshold is not set
- 689 : 34 : require(
- 690 : : categoryId == 0 || eModeCategories[categoryId].liquidationThreshold != 0,
- 691 : : Errors.INCONSISTENT_EMODE_CATEGORY
- 692 : : );
- 693 : :
- 694 : : // eMode can always be enabled if the user hasn't supplied anything
- 695 : 34 : if (userConfig.isEmpty()) {
- 696 : 34 : return;
- 697 : : }
- 698 : :
- 699 : : // if user is trying to set another category than default we require that
- 700 : : // either the user is not borrowing, or it's borrowing assets of categoryId
- 701 : 8 : if (categoryId != 0) {
- 702 : : unchecked {
- 703 : 14 : for (uint256 i = 0; i < reservesCount; i++) {
- 704 : 12 : if (userConfig.isBorrowing(i)) {
- 705 : 4 : DataTypes.ReserveConfigurationMap memory configuration = reservesData[reservesList[i]]
- 706 : : .configuration;
- 707 : 4 : require(
- 708 : : configuration.getEModeCategory() == categoryId,
- 709 : : Errors.INCONSISTENT_EMODE_CATEGORY
- 710 : : );
- 711 : : }
- 712 : : }
- 713 : : }
- 714 : : }
- 715 : : }
- 716 : :
- 717 : : /**
- 718 : : * @notice Validates the action of activating the asset as collateral.
- 719 : : * @dev Only possible if the asset has non-zero LTV and the user is not in isolation mode
- 720 : : * @param reservesData The state of all the reserves
- 721 : : * @param reservesList The addresses of all the active reserves
- 722 : : * @param userConfig the user configuration
- 723 : : * @param reserveConfig The reserve configuration
- 724 : : * @return True if the asset can be activated as collateral, false otherwise
- 725 : : */
- 726 : 13338 : function validateUseAsCollateral(
- 727 : : mapping(address => DataTypes.ReserveData) storage reservesData,
- 728 : : mapping(uint256 => address) storage reservesList,
- 729 : : DataTypes.UserConfigurationMap storage userConfig,
- 730 : : DataTypes.ReserveConfigurationMap memory reserveConfig
- 731 : : ) internal view returns (bool) {
- 732 : 40014 : if (reserveConfig.getLtv() == 0) {
- 733 : 6 : return false;
- 734 : : }
- 735 : 26670 : if (!userConfig.isUsingAsCollateralAny()) {
- 736 : 24510 : return true;
- 737 : : }
- 738 : 3240 : (bool isolationModeActive, , ) = userConfig.getIsolationModeState(reservesData, reservesList);
- 739 : :
- 740 : 2160 : return (!isolationModeActive && reserveConfig.getDebtCeiling() == 0);
- 741 : : }
- 742 : :
- 743 : : /**
- 744 : : * @notice Validates if an asset should be automatically activated as collateral in the following actions: supply,
- 745 : : * transfer, mint unbacked, and liquidate
- 746 : : * @dev This is used to ensure that isolated assets are not enabled as collateral automatically
- 747 : : * @param reservesData The state of all the reserves
- 748 : : * @param reservesList The addresses of all the active reserves
- 749 : : * @param userConfig the user configuration
- 750 : : * @param reserveConfig The reserve configuration
- 751 : : * @return True if the asset can be activated as collateral, false otherwise
- 752 : : */
- 753 : 13331 : function validateAutomaticUseAsCollateral(
- 754 : : mapping(address => DataTypes.ReserveData) storage reservesData,
- 755 : : mapping(uint256 => address) storage reservesList,
- 756 : : DataTypes.UserConfigurationMap storage userConfig,
- 757 : : DataTypes.ReserveConfigurationMap memory reserveConfig,
- 758 : : address aTokenAddress
- 759 : : ) internal view returns (bool) {
- 760 : 39993 : if (reserveConfig.getDebtCeiling() != 0) {
- 761 : : // ensures only the ISOLATED_COLLATERAL_SUPPLIER_ROLE can enable collateral as side-effect of an action
- 762 : 36 : IPoolAddressesProvider addressesProvider = IncentivizedERC20(aTokenAddress)
- 763 : : .POOL()
- 764 : : .ADDRESSES_PROVIDER();
- 765 : : if (
- 766 : 24 : !IAccessControl(addressesProvider.getACLManager()).hasRole(
- 767 : : ISOLATED_COLLATERAL_SUPPLIER_ROLE,
- 768 : : msg.sender
- 769 : : )
- 770 : 24 : ) return false;
- 771 : : }
- 772 : 39957 : return validateUseAsCollateral(reservesData, reservesList, userConfig, reserveConfig);
- 773 : : }
- 774 : : }
+ 389 : 14501 : (vars.collateralReserveActive, , , vars.collateralReservePaused) = collateralReserve
+ 390 : : .configuration
+ 391 : : .getFlags();
+ 392 : :
+ 393 : 14501 : (vars.principalReserveActive, , , vars.principalReservePaused) = params
+ 394 : : .debtReserveCache
+ 395 : : .reserveConfiguration
+ 396 : : .getFlags();
+ 397 : :
+ 398 : 14501 : require(vars.collateralReserveActive && vars.principalReserveActive, Errors.RESERVE_INACTIVE);
+ 399 : 14500 : require(!vars.collateralReservePaused && !vars.principalReservePaused, Errors.RESERVE_PAUSED);
+ 400 : :
+ 401 : 14499 : require(
+ 402 : : params.priceOracleSentinel == address(0) ||
+ 403 : : params.healthFactor < MINIMUM_HEALTH_FACTOR_LIQUIDATION_THRESHOLD ||
+ 404 : : IPriceOracleSentinel(params.priceOracleSentinel).isLiquidationAllowed(),
+ 405 : : Errors.PRICE_ORACLE_SENTINEL_CHECK_FAILED
+ 406 : : );
+ 407 : :
+ 408 : 14498 : require(
+ 409 : : collateralReserve.liquidationGracePeriodUntil < uint40(block.timestamp) &&
+ 410 : : debtReserve.liquidationGracePeriodUntil < uint40(block.timestamp),
+ 411 : : Errors.LIQUIDATION_GRACE_SENTINEL_CHECK_FAILED
+ 412 : : );
+ 413 : :
+ 414 : 8014 : require(
+ 415 : : params.healthFactor < HEALTH_FACTOR_LIQUIDATION_THRESHOLD,
+ 416 : : Errors.HEALTH_FACTOR_NOT_BELOW_THRESHOLD
+ 417 : : );
+ 418 : :
+ 419 : 8013 : vars.isCollateralEnabled =
+ 420 : : collateralReserve.configuration.getLiquidationThreshold() != 0 &&
+ 421 : : userConfig.isUsingAsCollateral(collateralReserve.id);
+ 422 : :
+ 423 : : //if collateral isn't enabled as collateral by user, it cannot be liquidated
+ 424 : 8013 : require(vars.isCollateralEnabled, Errors.COLLATERAL_CANNOT_BE_LIQUIDATED);
+ 425 : 8012 : require(params.totalDebt != 0, Errors.SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER);
+ 426 : : }
+ 427 : :
+ 428 : : /**
+ 429 : : * @notice Validates the health factor of a user.
+ 430 : : * @param reservesData The state of all the reserves
+ 431 : : * @param reservesList The addresses of all the active reserves
+ 432 : : * @param eModeCategories The configuration of all the efficiency mode categories
+ 433 : : * @param userConfig The state of the user for the specific reserve
+ 434 : : * @param user The user to validate health factor of
+ 435 : : * @param userEModeCategory The users active efficiency mode category
+ 436 : : * @param reservesCount The number of available reserves
+ 437 : : * @param oracle The price oracle
+ 438 : : */
+ 439 : : function validateHealthFactor(
+ 440 : : mapping(address => DataTypes.ReserveData) storage reservesData,
+ 441 : : mapping(uint256 => address) storage reservesList,
+ 442 : : mapping(uint8 => DataTypes.EModeCategory) storage eModeCategories,
+ 443 : : DataTypes.UserConfigurationMap memory userConfig,
+ 444 : : address user,
+ 445 : : uint8 userEModeCategory,
+ 446 : : uint256 reservesCount,
+ 447 : : address oracle
+ 448 : : ) internal view returns (uint256, bool) {
+ 449 : 8637 : (, , , , uint256 healthFactor, bool hasZeroLtvCollateral) = GenericLogic
+ 450 : : .calculateUserAccountData(
+ 451 : : reservesData,
+ 452 : : reservesList,
+ 453 : : eModeCategories,
+ 454 : : DataTypes.CalculateUserAccountDataParams({
+ 455 : : userConfig: userConfig,
+ 456 : : reservesCount: reservesCount,
+ 457 : : user: user,
+ 458 : : oracle: oracle,
+ 459 : : userEModeCategory: userEModeCategory
+ 460 : : })
+ 461 : : );
+ 462 : :
+ 463 : 8637 : require(
+ 464 : : healthFactor >= HEALTH_FACTOR_LIQUIDATION_THRESHOLD,
+ 465 : : Errors.HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD
+ 466 : : );
+ 467 : :
+ 468 : 7631 : return (healthFactor, hasZeroLtvCollateral);
+ 469 : : }
+ 470 : :
+ 471 : : /**
+ 472 : : * @notice Validates the health factor of a user and the ltv of the asset being withdrawn.
+ 473 : : * @param reservesData The state of all the reserves
+ 474 : : * @param reservesList The addresses of all the active reserves
+ 475 : : * @param eModeCategories The configuration of all the efficiency mode categories
+ 476 : : * @param userConfig The state of the user for the specific reserve
+ 477 : : * @param asset The asset for which the ltv will be validated
+ 478 : : * @param from The user from which the aTokens are being transferred
+ 479 : : * @param reservesCount The number of available reserves
+ 480 : : * @param oracle The price oracle
+ 481 : : * @param userEModeCategory The users active efficiency mode category
+ 482 : : */
+ 483 : : function validateHFAndLtv(
+ 484 : : mapping(address => DataTypes.ReserveData) storage reservesData,
+ 485 : : mapping(uint256 => address) storage reservesList,
+ 486 : : mapping(uint8 => DataTypes.EModeCategory) storage eModeCategories,
+ 487 : : DataTypes.UserConfigurationMap memory userConfig,
+ 488 : : address asset,
+ 489 : : address from,
+ 490 : : uint256 reservesCount,
+ 491 : : address oracle,
+ 492 : : uint8 userEModeCategory
+ 493 : : ) internal view {
+ 494 : 23 : DataTypes.ReserveData memory reserve = reservesData[asset];
+ 495 : :
+ 496 : 23 : (, bool hasZeroLtvCollateral) = validateHealthFactor(
+ 497 : : reservesData,
+ 498 : : reservesList,
+ 499 : : eModeCategories,
+ 500 : : userConfig,
+ 501 : : from,
+ 502 : : userEModeCategory,
+ 503 : : reservesCount,
+ 504 : : oracle
+ 505 : : );
+ 506 : :
+ 507 : 19 : require(
+ 508 : : !hasZeroLtvCollateral || reserve.configuration.getLtv() == 0,
+ 509 : : Errors.LTV_VALIDATION_FAILED
+ 510 : : );
+ 511 : : }
+ 512 : :
+ 513 : : /**
+ 514 : : * @notice Validates a transfer action.
+ 515 : : * @param reserve The reserve object
+ 516 : : */
+ 517 : : function validateTransfer(DataTypes.ReserveData storage reserve) internal view {
+ 518 : 17042 : require(!reserve.configuration.getPaused(), Errors.RESERVE_PAUSED);
+ 519 : : }
+ 520 : :
+ 521 : : /**
+ 522 : : * @notice Validates a drop reserve action.
+ 523 : : * @param reservesList The addresses of all the active reserves
+ 524 : : * @param reserve The reserve object
+ 525 : : * @param asset The address of the reserve's underlying asset
+ 526 : : */
+ 527 : : function validateDropReserve(
+ 528 : : mapping(uint256 => address) storage reservesList,
+ 529 : : DataTypes.ReserveData storage reserve,
+ 530 : : address asset
+ 531 : : ) internal view {
+ 532 : 9 : require(asset != address(0), Errors.ZERO_ADDRESS_NOT_VALID);
+ 533 : 8 : require(reserve.id != 0 || reservesList[0] == asset, Errors.ASSET_NOT_LISTED);
+ 534 : 7 : require(
+ 535 : : IERC20(reserve.variableDebtTokenAddress).totalSupply() == 0,
+ 536 : : Errors.VARIABLE_DEBT_SUPPLY_NOT_ZERO
+ 537 : : );
+ 538 : 6 : require(
+ 539 : : IERC20(reserve.aTokenAddress).totalSupply() == 0 && reserve.accruedToTreasury == 0,
+ 540 : : Errors.UNDERLYING_CLAIMABLE_RIGHTS_NOT_ZERO
+ 541 : : );
+ 542 : : }
+ 543 : :
+ 544 : : /**
+ 545 : : * @notice Validates the action of setting efficiency mode.
+ 546 : : * @param eModeCategories a mapping storing configurations for all efficiency mode categories
+ 547 : : * @param userConfig the user configuration
+ 548 : : * @param reservesCount The total number of valid reserves
+ 549 : : * @param categoryId The id of the category
+ 550 : : */
+ 551 : : function validateSetUserEMode(
+ 552 : : mapping(uint8 => DataTypes.EModeCategory) storage eModeCategories,
+ 553 : : DataTypes.UserConfigurationMap memory userConfig,
+ 554 : : uint256 reservesCount,
+ 555 : : uint8 categoryId
+ 556 : : ) internal view {
+ 557 : 9617 : DataTypes.EModeCategory storage eModeCategory = eModeCategories[categoryId];
+ 558 : : // category is invalid if the liq threshold is not set
+ 559 : 9617 : require(
+ 560 : : categoryId == 0 || eModeCategory.liquidationThreshold != 0,
+ 561 : : Errors.INCONSISTENT_EMODE_CATEGORY
+ 562 : : );
+ 563 : :
+ 564 : : // eMode can always be enabled if the user hasn't supplied anything
+ 565 : 9616 : if (userConfig.isEmpty()) {
+ 566 : 6611 : return;
+ 567 : : }
+ 568 : :
+ 569 : : // if user is trying to set another category than default we require that
+ 570 : : // either the user is not borrowing, or it's borrowing assets of categoryId
+ 571 : 3005 : if (categoryId != 0) {
+ 572 : : unchecked {
+ 573 : 3002 : for (uint256 i = 0; i < reservesCount; i++) {
+ 574 : 8006 : if (userConfig.isBorrowing(i)) {
+ 575 : 3002 : require(
+ 576 : : EModeConfiguration.isReserveEnabledOnBitmap(eModeCategory.borrowableBitmap, i),
+ 577 : : Errors.NOT_BORROWABLE_IN_EMODE
+ 578 : : );
+ 579 : : }
+ 580 : : }
+ 581 : : }
+ 582 : : }
+ 583 : : }
+ 584 : :
+ 585 : : /**
+ 586 : : * @notice Validates the action of activating the asset as collateral.
+ 587 : : * @dev Only possible if the asset has non-zero LTV and the user is not in isolation mode
+ 588 : : * @param reservesData The state of all the reserves
+ 589 : : * @param reservesList The addresses of all the active reserves
+ 590 : : * @param userConfig the user configuration
+ 591 : : * @param reserveConfig The reserve configuration
+ 592 : : * @return True if the asset can be activated as collateral, false otherwise
+ 593 : : */
+ 594 : : function validateUseAsCollateral(
+ 595 : : mapping(address => DataTypes.ReserveData) storage reservesData,
+ 596 : : mapping(uint256 => address) storage reservesList,
+ 597 : : DataTypes.UserConfigurationMap storage userConfig,
+ 598 : : DataTypes.ReserveConfigurationMap memory reserveConfig
+ 599 : : ) internal view returns (bool) {
+ 600 : 59411 : if (reserveConfig.getLtv() == 0) {
+ 601 : 3 : return false;
+ 602 : : }
+ 603 : 59408 : if (!userConfig.isUsingAsCollateralAny()) {
+ 604 : 58324 : return true;
+ 605 : : }
+ 606 : 1084 : (bool isolationModeActive, , ) = userConfig.getIsolationModeState(reservesData, reservesList);
+ 607 : :
+ 608 : 1084 : return (!isolationModeActive && reserveConfig.getDebtCeiling() == 0);
+ 609 : : }
+ 610 : :
+ 611 : : /**
+ 612 : : * @notice Validates if an asset should be automatically activated as collateral in the following actions: supply,
+ 613 : : * transfer, mint unbacked, and liquidate
+ 614 : : * @dev This is used to ensure that isolated assets are not enabled as collateral automatically
+ 615 : : * @param reservesData The state of all the reserves
+ 616 : : * @param reservesList The addresses of all the active reserves
+ 617 : : * @param userConfig the user configuration
+ 618 : : * @param reserveConfig The reserve configuration
+ 619 : : * @return True if the asset can be activated as collateral, false otherwise
+ 620 : : */
+ 621 : : function validateAutomaticUseAsCollateral(
+ 622 : : mapping(address => DataTypes.ReserveData) storage reservesData,
+ 623 : : mapping(uint256 => address) storage reservesList,
+ 624 : : DataTypes.UserConfigurationMap storage userConfig,
+ 625 : : DataTypes.ReserveConfigurationMap memory reserveConfig,
+ 626 : : address aTokenAddress
+ 627 : : ) internal view returns (bool) {
+ 628 : 59404 : if (reserveConfig.getDebtCeiling() != 0) {
+ 629 : : // ensures only the ISOLATED_COLLATERAL_SUPPLIER_ROLE can enable collateral as side-effect of an action
+ 630 : 12 : IPoolAddressesProvider addressesProvider = IncentivizedERC20(aTokenAddress)
+ 631 : : .POOL()
+ 632 : : .ADDRESSES_PROVIDER();
+ 633 : : if (
+ 634 : 12 : !IAccessControl(addressesProvider.getACLManager()).hasRole(
+ 635 : : ISOLATED_COLLATERAL_SUPPLIER_ROLE,
+ 636 : : msg.sender
+ 637 : : )
+ 638 : 12 : ) return false;
+ 639 : : }
+ 640 : 59392 : return validateUseAsCollateral(reservesData, reservesList, userConfig, reserveConfig);
+ 641 : : }
+ 642 : : }
@@ -850,8 +718,8 @@
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/index-sort-b.html b/report/protocol/libraries/logic/index-sort-b.html
similarity index 60%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/index-sort-b.html
rename to report/protocol/libraries/logic/index-sort-b.html
index d508c1da..f602334f 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/index-sort-b.html
+++ b/report/protocol/libraries/logic/index-sort-b.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic
-
+ LCOV - lcov.info.p - protocol/libraries/logic
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../../../glass.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../glass.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../updown.png) |
Rate |
@@ -96,24 +96,24 @@
Hit |
- BorrowLogic.sol |
+ BorrowLogic.sol |
-
+
|
- 88.1 % |
- 67 |
- 59 |
+ 100.0 % |
+ 41 |
+ 41 |
- |
|
|
100.0 % |
- 4 |
- 4 |
+ 2 |
+ 2 |
- BridgeLogic.sol |
+ BridgeLogic.sol |
-
+
|
100.0 % |
28 |
@@ -126,54 +126,54 @@
2 |
- CalldataLogic.sol |
+ CalldataLogic.sol |
-
+
|
100.0 % |
- 72 |
- 72 |
+ 62 |
+ 62 |
- |
|
|
100.0 % |
- 10 |
- 10 |
+ 8 |
+ 8 |
- ConfiguratorLogic.sol |
+ ConfiguratorLogic.sol |
-
+
|
100.0 % |
- 33 |
- 33 |
+ 29 |
+ 29 |
- |
|
|
100.0 % |
- 6 |
- 6 |
+ 5 |
+ 5 |
- EModeLogic.sol |
+ EModeLogic.sol |
-
+
|
100.0 % |
- 12 |
- 12 |
+ 5 |
+ 5 |
- |
|
|
100.0 % |
- 3 |
- 3 |
+ 1 |
+ 1 |
- FlashLoanLogic.sol |
+ FlashLoanLogic.sol |
-
+
|
100.0 % |
38 |
@@ -186,9 +186,9 @@
3 |
- IsolationModeLogic.sol |
+ IsolationModeLogic.sol |
-
+
|
100.0 % |
9 |
@@ -201,24 +201,24 @@
1 |
- LiquidationLogic.sol |
+ LiquidationLogic.sol |
-
+
|
- 95.5 % |
- 88 |
- 84 |
+ 98.6 % |
+ 74 |
+ 73 |
- |
|
|
100.0 % |
- 7 |
- 7 |
+ 6 |
+ 6 |
- PoolLogic.sol |
+ PoolLogic.sol |
-
+
|
100.0 % |
37 |
@@ -231,9 +231,9 @@
7 |
- SupplyLogic.sol |
+ SupplyLogic.sol |
-
+
|
100.0 % |
60 |
@@ -246,27 +246,27 @@
4 |
- ValidationLogic.sol |
+ ValidationLogic.sol |
-
+
|
100.0 % |
- 132 |
- 132 |
+ 110 |
+ 110 |
- |
|
|
100.0 % |
- 17 |
- 17 |
+ 15 |
+ 15 |
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/index-sort-f.html b/report/protocol/libraries/logic/index-sort-f.html
similarity index 60%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/index-sort-f.html
rename to report/protocol/libraries/logic/index-sort-f.html
index 6975312e..d083a5b9 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/index-sort-f.html
+++ b/report/protocol/libraries/logic/index-sort-f.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic
-
+ LCOV - lcov.info.p - protocol/libraries/logic
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../../../glass.png) |
+ File ![Click to sort table by file name Sort by file name](../../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../glass.png) |
Rate |
@@ -96,13 +96,13 @@
Hit |
- IsolationModeLogic.sol |
+ EModeLogic.sol |
-
+
|
100.0 % |
- 9 |
- 9 |
+ 5 |
+ 5 |
- |
|
|
@@ -111,69 +111,69 @@
1 |
- BridgeLogic.sol |
+ IsolationModeLogic.sol |
-
+
|
100.0 % |
- 28 |
- 28 |
+ 9 |
+ 9 |
- |
|
|
100.0 % |
- 2 |
- 2 |
+ 1 |
+ 1 |
- EModeLogic.sol |
+ BorrowLogic.sol |
-
+
|
100.0 % |
- 12 |
- 12 |
+ 41 |
+ 41 |
- |
|
|
100.0 % |
- 3 |
- 3 |
+ 2 |
+ 2 |
- FlashLoanLogic.sol |
+ BridgeLogic.sol |
-
+
|
100.0 % |
- 38 |
- 38 |
+ 28 |
+ 28 |
- |
|
|
100.0 % |
- 3 |
- 3 |
+ 2 |
+ 2 |
- BorrowLogic.sol |
+ FlashLoanLogic.sol |
-
+
|
- 88.1 % |
- 67 |
- 59 |
+ 100.0 % |
+ 38 |
+ 38 |
- |
|
|
100.0 % |
- 4 |
- 4 |
+ 3 |
+ 3 |
- SupplyLogic.sol |
+ SupplyLogic.sol |
-
+
|
100.0 % |
60 |
@@ -186,39 +186,39 @@
4 |
- ConfiguratorLogic.sol |
+ ConfiguratorLogic.sol |
-
+
|
100.0 % |
- 33 |
- 33 |
+ 29 |
+ 29 |
- |
|
|
100.0 % |
- 6 |
- 6 |
+ 5 |
+ 5 |
- LiquidationLogic.sol |
+ LiquidationLogic.sol |
-
+
|
- 95.5 % |
- 88 |
- 84 |
+ 98.6 % |
+ 74 |
+ 73 |
- |
|
|
100.0 % |
- 7 |
- 7 |
+ 6 |
+ 6 |
- PoolLogic.sol |
+ PoolLogic.sol |
-
+
|
100.0 % |
37 |
@@ -231,42 +231,42 @@
7 |
- CalldataLogic.sol |
+ CalldataLogic.sol |
-
+
|
100.0 % |
- 72 |
- 72 |
+ 62 |
+ 62 |
- |
|
|
100.0 % |
- 10 |
- 10 |
+ 8 |
+ 8 |
- ValidationLogic.sol |
+ ValidationLogic.sol |
-
+
|
100.0 % |
- 132 |
- 132 |
+ 110 |
+ 110 |
- |
|
|
100.0 % |
- 17 |
- 17 |
+ 15 |
+ 15 |
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/index-sort-l.html b/report/protocol/libraries/logic/index-sort-l.html
similarity index 60%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/index-sort-l.html
rename to report/protocol/libraries/logic/index-sort-l.html
index fe96817d..408cb650 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/index-sort-l.html
+++ b/report/protocol/libraries/logic/index-sort-l.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic
-
+ LCOV - lcov.info.p - protocol/libraries/logic
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../../../glass.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../glass.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../updown.png) |
Rate |
@@ -96,39 +96,39 @@
Hit |
- BorrowLogic.sol |
+ LiquidationLogic.sol |
-
+
|
- 88.1 % |
- 67 |
- 59 |
+ 98.6 % |
+ 74 |
+ 73 |
- |
|
|
100.0 % |
- 4 |
- 4 |
+ 6 |
+ 6 |
- LiquidationLogic.sol |
+ EModeLogic.sol |
-
+
|
- 95.5 % |
- 88 |
- 84 |
+ 100.0 % |
+ 5 |
+ 5 |
- |
|
|
100.0 % |
- 7 |
- 7 |
+ 1 |
+ 1 |
- IsolationModeLogic.sol |
+ IsolationModeLogic.sol |
-
+
|
100.0 % |
9 |
@@ -141,24 +141,9 @@
1 |
- EModeLogic.sol |
+ BridgeLogic.sol |
-
- |
- 100.0 % |
- 12 |
- 12 |
- - |
- |
- |
- 100.0 % |
- 3 |
- 3 |
-
-
- BridgeLogic.sol |
-
-
+
|
100.0 % |
28 |
@@ -171,24 +156,24 @@
2 |
- ConfiguratorLogic.sol |
+ ConfiguratorLogic.sol |
-
+
|
100.0 % |
- 33 |
- 33 |
+ 29 |
+ 29 |
- |
|
|
100.0 % |
- 6 |
- 6 |
+ 5 |
+ 5 |
- PoolLogic.sol |
+ PoolLogic.sol |
-
+
|
100.0 % |
37 |
@@ -201,9 +186,9 @@
7 |
- FlashLoanLogic.sol |
+ FlashLoanLogic.sol |
-
+
|
100.0 % |
38 |
@@ -216,9 +201,24 @@
3 |
- SupplyLogic.sol |
+ BorrowLogic.sol |
+
+
+ |
+ 100.0 % |
+ 41 |
+ 41 |
+ - |
+ |
+ |
+ 100.0 % |
+ 2 |
+ 2 |
+
+
+ SupplyLogic.sol |
-
+
|
100.0 % |
60 |
@@ -231,42 +231,42 @@
4 |
- CalldataLogic.sol |
+ CalldataLogic.sol |
-
+
|
100.0 % |
- 72 |
- 72 |
+ 62 |
+ 62 |
- |
|
|
100.0 % |
- 10 |
- 10 |
+ 8 |
+ 8 |
- ValidationLogic.sol |
+ ValidationLogic.sol |
-
+
|
100.0 % |
- 132 |
- 132 |
+ 110 |
+ 110 |
- |
|
|
100.0 % |
- 17 |
- 17 |
+ 15 |
+ 15 |
diff --git a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/index.html b/report/protocol/libraries/logic/index.html
similarity index 60%
rename from report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/index.html
rename to report/protocol/libraries/logic/index.html
index 61e0232b..750492df 100644
--- a/report/core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic/index.html
+++ b/report/protocol/libraries/logic/index.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/logic/src/core/contracts/protocol/libraries/logic
-
+ LCOV - lcov.info.p - protocol/libraries/logic
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../../../glass.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../../../glass.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../updown.png) |
Rate |
@@ -96,24 +96,24 @@
Hit |
- BorrowLogic.sol |
+ BorrowLogic.sol |
-
+
|
- 88.1 % |
- 67 |
- 59 |
+ 100.0 % |
+ 41 |
+ 41 |
- |
|
|
100.0 % |
- 4 |
- 4 |
+ 2 |
+ 2 |
- BridgeLogic.sol |
+ BridgeLogic.sol |
-
+
|
100.0 % |
28 |
@@ -126,54 +126,54 @@
2 |
- CalldataLogic.sol |
+ CalldataLogic.sol |
-
+
|
100.0 % |
- 72 |
- 72 |
+ 62 |
+ 62 |
- |
|
|
100.0 % |
- 10 |
- 10 |
+ 8 |
+ 8 |
- ConfiguratorLogic.sol |
+ ConfiguratorLogic.sol |
-
+
|
100.0 % |
- 33 |
- 33 |
+ 29 |
+ 29 |
- |
|
|
100.0 % |
- 6 |
- 6 |
+ 5 |
+ 5 |
- EModeLogic.sol |
+ EModeLogic.sol |
-
+
|
100.0 % |
- 12 |
- 12 |
+ 5 |
+ 5 |
- |
|
|
100.0 % |
- 3 |
- 3 |
+ 1 |
+ 1 |
- FlashLoanLogic.sol |
+ FlashLoanLogic.sol |
-
+
|
100.0 % |
38 |
@@ -186,9 +186,9 @@
3 |
- IsolationModeLogic.sol |
+ IsolationModeLogic.sol |
-
+
|
100.0 % |
9 |
@@ -201,24 +201,24 @@
1 |
- LiquidationLogic.sol |
+ LiquidationLogic.sol |
-
+
|
- 95.5 % |
- 88 |
- 84 |
+ 98.6 % |
+ 74 |
+ 73 |
- |
|
|
100.0 % |
- 7 |
- 7 |
+ 6 |
+ 6 |
- PoolLogic.sol |
+ PoolLogic.sol |
-
+
|
100.0 % |
37 |
@@ -231,9 +231,9 @@
7 |
- SupplyLogic.sol |
+ SupplyLogic.sol |
-
+
|
100.0 % |
60 |
@@ -246,27 +246,27 @@
4 |
- ValidationLogic.sol |
+ ValidationLogic.sol |
-
+
|
100.0 % |
- 132 |
- 132 |
+ 110 |
+ 110 |
- |
|
|
100.0 % |
- 17 |
- 17 |
+ 15 |
+ 15 |
diff --git a/report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/MathUtils.sol.func-c.html b/report/protocol/libraries/math/MathUtils.sol.func-c.html
similarity index 66%
rename from report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/MathUtils.sol.func-c.html
rename to report/protocol/libraries/math/MathUtils.sol.func-c.html
index 64f7e490..4000a122 100644
--- a/report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/MathUtils.sol.func-c.html
+++ b/report/protocol/libraries/math/MathUtils.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/MathUtils.sol - functions
-
+ LCOV - lcov.info.p - protocol/libraries/math/MathUtils.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -37,7 +37,7 @@
-
+
|
@@ -53,35 +53,35 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../glass.png) |
MathUtils.calculateLinearInterest |
- 19762 |
+ 21122 |
MathUtils.calculateCompoundedInterest |
- 39477 |
+ 27028 |
@@ -89,8 +89,8 @@
diff --git a/report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/MathUtils.sol.func.html b/report/protocol/libraries/math/MathUtils.sol.func.html
similarity index 66%
rename from report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/MathUtils.sol.func.html
rename to report/protocol/libraries/math/MathUtils.sol.func.html
index 2618d9a6..07920843 100644
--- a/report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/MathUtils.sol.func.html
+++ b/report/protocol/libraries/math/MathUtils.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/MathUtils.sol - functions
-
+ LCOV - lcov.info.p - protocol/libraries/math/MathUtils.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -37,7 +37,7 @@
-
+
|
@@ -53,35 +53,35 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../updown.png) |
MathUtils.calculateCompoundedInterest |
- 39477 |
+ 27028 |
MathUtils.calculateLinearInterest |
- 19762 |
+ 21122 |
@@ -89,8 +89,8 @@
diff --git a/report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/MathUtils.sol.gcov.html b/report/protocol/libraries/math/MathUtils.sol.gcov.html
similarity index 84%
rename from report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/MathUtils.sol.gcov.html
rename to report/protocol/libraries/math/MathUtils.sol.gcov.html
index 0bd46234..998460ce 100644
--- a/report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/MathUtils.sol.gcov.html
+++ b/report/protocol/libraries/math/MathUtils.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/MathUtils.sol
-
+ LCOV - lcov.info.p - protocol/libraries/math/MathUtils.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -37,7 +37,7 @@
-
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -91,17 +91,17 @@
20 : : * @param lastUpdateTimestamp The timestamp of the last update of the interest
21 : : * @return The interest rate linearly accumulated during the timeDelta, in ray
22 : : */
- 23 : 19762 : function calculateLinearInterest(
+ 23 : : function calculateLinearInterest(
24 : : uint256 rate,
25 : : uint40 lastUpdateTimestamp
26 : : ) internal view returns (uint256) {
27 : : //solium-disable-next-line
- 28 : 59286 : uint256 result = rate * (block.timestamp - uint256(lastUpdateTimestamp));
+ 28 : 21122 : uint256 result = rate * (block.timestamp - uint256(lastUpdateTimestamp));
29 : : unchecked {
- 30 : 39524 : result = result / SECONDS_PER_YEAR;
+ 30 : 21122 : result = result / SECONDS_PER_YEAR;
31 : : }
32 : :
- 33 : 59286 : return WadRayMath.RAY + result;
+ 33 : 21122 : return WadRayMath.RAY + result;
34 : : }
35 : :
36 : : /**
@@ -118,41 +118,41 @@
47 : : * @param lastUpdateTimestamp The timestamp of the last update of the interest
48 : : * @return The interest rate compounded during the timeDelta, in ray
49 : : */
- 50 : 39477 : function calculateCompoundedInterest(
+ 50 : : function calculateCompoundedInterest(
51 : : uint256 rate,
52 : : uint40 lastUpdateTimestamp,
53 : : uint256 currentTimestamp
54 : : ) internal pure returns (uint256) {
55 : : //solium-disable-next-line
- 56 : 104820 : uint256 exp = currentTimestamp - uint256(lastUpdateTimestamp);
+ 56 : 13515 : uint256 exp = currentTimestamp - uint256(lastUpdateTimestamp);
57 : :
- 58 : 52410 : if (exp == 0) {
- 59 : 2 : return WadRayMath.RAY;
+ 58 : 13515 : if (exp == 0) {
+ 59 : 1 : return WadRayMath.RAY;
60 : : }
61 : :
- 62 : 52408 : uint256 expMinusOne;
- 63 : 52408 : uint256 expMinusTwo;
- 64 : 52408 : uint256 basePowerTwo;
- 65 : 52408 : uint256 basePowerThree;
+ 62 : 13514 : uint256 expMinusOne;
+ 63 : 13514 : uint256 expMinusTwo;
+ 64 : 13514 : uint256 basePowerTwo;
+ 65 : 13514 : uint256 basePowerThree;
66 : : unchecked {
- 67 : 52408 : expMinusOne = exp - 1;
+ 67 : 13514 : expMinusOne = exp - 1;
68 : :
- 69 : 52408 : expMinusTwo = exp > 2 ? exp - 2 : 0;
+ 69 : 13514 : expMinusTwo = exp > 2 ? exp - 2 : 0;
70 : :
- 71 : 52408 : basePowerTwo = rate.rayMul(rate) / (SECONDS_PER_YEAR * SECONDS_PER_YEAR);
- 72 : 52408 : basePowerThree = basePowerTwo.rayMul(rate) / SECONDS_PER_YEAR;
+ 71 : 13514 : basePowerTwo = rate.rayMul(rate) / (SECONDS_PER_YEAR * SECONDS_PER_YEAR);
+ 72 : 13514 : basePowerThree = basePowerTwo.rayMul(rate) / SECONDS_PER_YEAR;
73 : : }
74 : :
- 75 : 104816 : uint256 secondTerm = exp * expMinusOne * basePowerTwo;
+ 75 : 13514 : uint256 secondTerm = exp * expMinusOne * basePowerTwo;
76 : : unchecked {
- 77 : 52408 : secondTerm /= 2;
+ 77 : 13514 : secondTerm /= 2;
78 : : }
- 79 : 131020 : uint256 thirdTerm = exp * expMinusOne * expMinusTwo * basePowerThree;
+ 79 : 13514 : uint256 thirdTerm = exp * expMinusOne * expMinusTwo * basePowerThree;
80 : : unchecked {
- 81 : 52408 : thirdTerm /= 6;
+ 81 : 13514 : thirdTerm /= 6;
82 : : }
83 : :
- 84 : 157224 : return WadRayMath.RAY + (rate * exp) / SECONDS_PER_YEAR + secondTerm + thirdTerm;
+ 84 : 13514 : return WadRayMath.RAY + (rate * exp) / SECONDS_PER_YEAR + secondTerm + thirdTerm;
85 : : }
86 : :
87 : : /**
@@ -165,7 +165,7 @@
94 : : uint256 rate,
95 : : uint40 lastUpdateTimestamp
96 : : ) internal view returns (uint256) {
- 97 : 39816 : return calculateCompoundedInterest(rate, lastUpdateTimestamp, block.timestamp);
+ 97 : 13513 : return calculateCompoundedInterest(rate, lastUpdateTimestamp, block.timestamp);
98 : : }
99 : : }
@@ -175,8 +175,8 @@
diff --git a/report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/PercentageMath.sol.func-c.html b/report/protocol/libraries/math/PercentageMath.sol.func-c.html
similarity index 64%
rename from report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/PercentageMath.sol.func-c.html
rename to report/protocol/libraries/math/PercentageMath.sol.func-c.html
index 5361ea87..c249258b 100644
--- a/report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/PercentageMath.sol.func-c.html
+++ b/report/protocol/libraries/math/PercentageMath.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/PercentageMath.sol - functions
-
+ LCOV - lcov.info.p - protocol/libraries/math/PercentageMath.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,12 +32,12 @@
|
-
-
+
+
-
+
|
@@ -53,35 +53,35 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../glass.png) |
PercentageMath.percentDiv |
- 19136 |
+ 30126 |
PercentageMath.percentMul |
- 100989 |
+ 158440 |
@@ -89,8 +89,8 @@
diff --git a/report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/PercentageMath.sol.func.html b/report/protocol/libraries/math/PercentageMath.sol.func.html
similarity index 64%
rename from report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/PercentageMath.sol.func.html
rename to report/protocol/libraries/math/PercentageMath.sol.func.html
index ab030e28..1695ad80 100644
--- a/report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/PercentageMath.sol.func.html
+++ b/report/protocol/libraries/math/PercentageMath.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/PercentageMath.sol - functions
-
+ LCOV - lcov.info.p - protocol/libraries/math/PercentageMath.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,12 +32,12 @@
|
-
-
+
+
-
+
|
@@ -53,35 +53,35 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../updown.png) |
PercentageMath.percentDiv |
- 19136 |
+ 30126 |
PercentageMath.percentMul |
- 100989 |
+ 158440 |
@@ -89,8 +89,8 @@
diff --git a/report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/PercentageMath.sol.gcov.html b/report/protocol/libraries/math/PercentageMath.sol.gcov.html
similarity index 84%
rename from report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/PercentageMath.sol.gcov.html
rename to report/protocol/libraries/math/PercentageMath.sol.gcov.html
index f7058a46..65415a84 100644
--- a/report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/PercentageMath.sol.gcov.html
+++ b/report/protocol/libraries/math/PercentageMath.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/PercentageMath.sol
-
+ LCOV - lcov.info.p - protocol/libraries/math/PercentageMath.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,12 +32,12 @@
|
-
-
+
+
-
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -93,19 +93,19 @@
22 : : * @param percentage The percentage of the value to be calculated
23 : : * @return result value percentmul percentage
24 : : */
- 25 : 100989 : function percentMul(uint256 value, uint256 percentage) internal pure returns (uint256 result) {
+ 25 : : function percentMul(uint256 value, uint256 percentage) internal pure returns (uint256 result) {
26 : : // to avoid overflow, value <= (type(uint256).max - HALF_PERCENTAGE_FACTOR) / percentage
27 : : assembly {
- 28 : 100989 : if iszero(
+ 28 : 158440 : if iszero(
29 : : or(
30 : : iszero(percentage),
31 : : iszero(gt(value, div(sub(not(0), HALF_PERCENTAGE_FACTOR), percentage)))
32 : : )
33 : : ) {
- 34 : : revert(0, 0)
+ 34 : 303 : revert(0, 0)
35 : : }
36 : :
- 37 : 201340 : result := div(add(mul(value, percentage), HALF_PERCENTAGE_FACTOR), PERCENTAGE_FACTOR)
+ 37 : 158137 : result := div(add(mul(value, percentage), HALF_PERCENTAGE_FACTOR), PERCENTAGE_FACTOR)
38 : : }
39 : : }
40 : :
@@ -116,17 +116,17 @@
45 : : * @param percentage The percentage of the value to be calculated
46 : : * @return result value percentdiv percentage
47 : : */
- 48 : 19136 : function percentDiv(uint256 value, uint256 percentage) internal pure returns (uint256 result) {
+ 48 : : function percentDiv(uint256 value, uint256 percentage) internal pure returns (uint256 result) {
49 : : // to avoid overflow, value <= (type(uint256).max - halfPercentage) / PERCENTAGE_FACTOR
50 : : assembly {
- 51 : 19136 : if or(
+ 51 : 30126 : if or(
52 : : iszero(percentage),
53 : : iszero(iszero(gt(value, div(sub(not(0), div(percentage, 2)), PERCENTAGE_FACTOR))))
54 : : ) {
- 55 : : revert(0, 0)
+ 55 : 74 : revert(0, 0)
56 : : }
57 : :
- 58 : 37888 : result := div(add(mul(value, PERCENTAGE_FACTOR), div(percentage, 2)), percentage)
+ 58 : 30052 : result := div(add(mul(value, PERCENTAGE_FACTOR), div(percentage, 2)), percentage)
59 : : }
60 : : }
61 : : }
@@ -137,8 +137,8 @@
diff --git a/report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/WadRayMath.sol.func-c.html b/report/protocol/libraries/math/WadRayMath.sol.func-c.html
similarity index 67%
rename from report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/WadRayMath.sol.func-c.html
rename to report/protocol/libraries/math/WadRayMath.sol.func-c.html
index a02ca863..aa6c47cb 100644
--- a/report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/WadRayMath.sol.func-c.html
+++ b/report/protocol/libraries/math/WadRayMath.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/WadRayMath.sol - functions
-
+ LCOV - lcov.info.p - protocol/libraries/math/WadRayMath.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -31,13 +31,13 @@
|
-
-
-
+
+
+
-
+
|
@@ -53,21 +53,21 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../glass.png) |
@@ -79,37 +79,37 @@
- WadRayMath.rayToWad |
+ WadRayMath.wadToRay |
- 2003 |
+ 1945 |
- WadRayMath.wadDiv |
+ WadRayMath.rayToWad |
- 15325 |
+ 2003 |
- WadRayMath.wadToRay |
+ WadRayMath.wadDiv |
- 77131 |
+ 23533 |
WadRayMath.rayDiv |
- 173648 |
+ 280644 |
WadRayMath.rayMul |
- 479205 |
+ 719133 |
@@ -117,8 +117,8 @@
diff --git a/report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/WadRayMath.sol.func.html b/report/protocol/libraries/math/WadRayMath.sol.func.html
similarity index 67%
rename from report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/WadRayMath.sol.func.html
rename to report/protocol/libraries/math/WadRayMath.sol.func.html
index 820bd34b..88a84a37 100644
--- a/report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/WadRayMath.sol.func.html
+++ b/report/protocol/libraries/math/WadRayMath.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/WadRayMath.sol - functions
-
+ LCOV - lcov.info.p - protocol/libraries/math/WadRayMath.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -31,13 +31,13 @@
|
-
-
-
+
+
+
-
+
|
@@ -53,35 +53,35 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../updown.png) |
WadRayMath.rayDiv |
- 173648 |
+ 280644 |
WadRayMath.rayMul |
- 479205 |
+ 719133 |
@@ -95,7 +95,7 @@
WadRayMath.wadDiv |
- 15325 |
+ 23533 |
@@ -109,7 +109,7 @@
WadRayMath.wadToRay |
- 77131 |
+ 1945 |
@@ -117,8 +117,8 @@
diff --git a/report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/WadRayMath.sol.gcov.html b/report/protocol/libraries/math/WadRayMath.sol.gcov.html
similarity index 83%
rename from report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/WadRayMath.sol.gcov.html
rename to report/protocol/libraries/math/WadRayMath.sol.gcov.html
index 78bbe0d7..1aab3e38 100644
--- a/report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/WadRayMath.sol.gcov.html
+++ b/report/protocol/libraries/math/WadRayMath.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/WadRayMath.sol
-
+ LCOV - lcov.info.p - protocol/libraries/math/WadRayMath.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -31,13 +31,13 @@
|
-
-
-
+
+
+
-
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -97,14 +97,14 @@
26 : : * @param b Wad
27 : : * @return c = a*b, in wad
28 : : */
- 29 : 1006 : function wadMul(uint256 a, uint256 b) internal pure returns (uint256 c) {
+ 29 : : function wadMul(uint256 a, uint256 b) internal pure returns (uint256 c) {
30 : : // to avoid overflow, a <= (type(uint256).max - HALF_WAD) / b
31 : : assembly {
- 32 : 1006 : if iszero(or(iszero(b), iszero(gt(a, div(sub(not(0), HALF_WAD), b))))) {
- 33 : : revert(0, 0)
+ 32 : 1006 : if iszero(or(iszero(b), iszero(gt(a, div(sub(not(0), HALF_WAD), b))))) {
+ 33 : 314 : revert(0, 0)
34 : : }
35 : :
- 36 : 1382 : c := div(add(mul(a, b), HALF_WAD), WAD)
+ 36 : 692 : c := div(add(mul(a, b), HALF_WAD), WAD)
37 : : }
38 : : }
39 : :
@@ -115,14 +115,14 @@
44 : : * @param b Wad
45 : : * @return c = a/b, in wad
46 : : */
- 47 : 15325 : function wadDiv(uint256 a, uint256 b) internal pure returns (uint256 c) {
+ 47 : : function wadDiv(uint256 a, uint256 b) internal pure returns (uint256 c) {
48 : : // to avoid overflow, a <= (type(uint256).max - halfB) / WAD
49 : : assembly {
- 50 : 15325 : if or(iszero(b), iszero(iszero(gt(a, div(sub(not(0), div(b, 2)), WAD))))) {
- 51 : : revert(0, 0)
+ 50 : 23533 : if or(iszero(b), iszero(iszero(gt(a, div(sub(not(0), div(b, 2)), WAD))))) {
+ 51 : 169 : revert(0, 0)
52 : : }
53 : :
- 54 : 30170 : c := div(add(mul(a, WAD), div(b, 2)), b)
+ 54 : 23364 : c := div(add(mul(a, WAD), div(b, 2)), b)
55 : : }
56 : : }
57 : :
@@ -133,14 +133,14 @@
62 : : * @param b Ray
63 : : * @return c = a raymul b
64 : : */
- 65 : 479205 : function rayMul(uint256 a, uint256 b) internal pure returns (uint256 c) {
+ 65 : : function rayMul(uint256 a, uint256 b) internal pure returns (uint256 c) {
66 : : // to avoid overflow, a <= (type(uint256).max - HALF_RAY) / b
67 : : assembly {
- 68 : 479205 : if iszero(or(iszero(b), iszero(gt(a, div(sub(not(0), HALF_RAY), b))))) {
- 69 : : revert(0, 0)
+ 68 : 719133 : if iszero(or(iszero(b), iszero(gt(a, div(sub(not(0), HALF_RAY), b))))) {
+ 69 : 0 : revert(0, 0)
70 : : }
71 : :
- 72 : 958410 : c := div(add(mul(a, b), HALF_RAY), RAY)
+ 72 : 719133 : c := div(add(mul(a, b), HALF_RAY), RAY)
73 : : }
74 : : }
75 : :
@@ -151,14 +151,14 @@
80 : : * @param b Ray
81 : : * @return c = a raydiv b
82 : : */
- 83 : 173648 : function rayDiv(uint256 a, uint256 b) internal pure returns (uint256 c) {
+ 83 : : function rayDiv(uint256 a, uint256 b) internal pure returns (uint256 c) {
84 : : // to avoid overflow, a <= (type(uint256).max - halfB) / RAY
85 : : assembly {
- 86 : 173648 : if or(iszero(b), iszero(iszero(gt(a, div(sub(not(0), div(b, 2)), RAY))))) {
- 87 : : revert(0, 0)
+ 86 : 280644 : if or(iszero(b), iszero(iszero(gt(a, div(sub(not(0), div(b, 2)), RAY))))) {
+ 87 : 0 : revert(0, 0)
88 : : }
89 : :
- 90 : 347296 : c := div(add(mul(a, RAY), div(b, 2)), b)
+ 90 : 280644 : c := div(add(mul(a, RAY), div(b, 2)), b)
91 : : }
92 : : }
93 : :
@@ -168,12 +168,12 @@
97 : : * @param a Ray
98 : : * @return b = a converted to wad, rounded half up to the nearest wad
99 : : */
- 100 : 2003 : function rayToWad(uint256 a) internal pure returns (uint256 b) {
+ 100 : : function rayToWad(uint256 a) internal pure returns (uint256 b) {
101 : : assembly {
- 102 : 4006 : b := div(a, WAD_RAY_RATIO)
- 103 : : let remainder := mod(a, WAD_RAY_RATIO)
+ 102 : 2003 : b := div(a, WAD_RAY_RATIO)
+ 103 : 2003 : let remainder := mod(a, WAD_RAY_RATIO)
104 : 2003 : if iszero(lt(remainder, div(WAD_RAY_RATIO, 2))) {
- 105 : 576 : b := add(b, 1)
+ 105 : 558 : b := add(b, 1)
106 : : }
107 : : }
108 : : }
@@ -184,13 +184,13 @@
113 : : * @param a Wad
114 : : * @return b = a converted in ray
115 : : */
- 116 : 77131 : function wadToRay(uint256 a) internal pure returns (uint256 b) {
+ 116 : : function wadToRay(uint256 a) internal pure returns (uint256 b) {
117 : : // to avoid overflow, b/WAD_RAY_RATIO == a
118 : : assembly {
- 119 : 154262 : b := mul(a, WAD_RAY_RATIO)
+ 119 : 1945 : b := mul(a, WAD_RAY_RATIO)
120 : :
- 121 : 77131 : if iszero(eq(div(b, WAD_RAY_RATIO), a)) {
- 122 : : revert(0, 0)
+ 121 : 1945 : if iszero(eq(div(b, WAD_RAY_RATIO), a)) {
+ 122 : 112 : revert(0, 0)
123 : : }
124 : : }
125 : : }
@@ -202,8 +202,8 @@
diff --git a/report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/index-sort-b.html b/report/protocol/libraries/math/index-sort-b.html
similarity index 64%
rename from report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/index-sort-b.html
rename to report/protocol/libraries/math/index-sort-b.html
index 71bac976..5eaa5eb6 100644
--- a/report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/index-sort-b.html
+++ b/report/protocol/libraries/math/index-sort-b.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math
-
+ LCOV - lcov.info.p - protocol/libraries/math
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -31,13 +31,13 @@
|
-
-
-
+
+
+
-
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../../../glass.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../glass.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../updown.png) |
Rate |
@@ -96,9 +96,9 @@
Hit |
- MathUtils.sol |
+ MathUtils.sol |
-
+
|
100.0 % |
20 |
@@ -111,13 +111,13 @@
2 |
- PercentageMath.sol |
+ PercentageMath.sol |
-
+
|
100.0 % |
- 4 |
- 4 |
+ 6 |
+ 6 |
- |
|
|
@@ -126,13 +126,13 @@
2 |
- WadRayMath.sol |
+ WadRayMath.sol |
-
+
|
- 100.0 % |
- 13 |
- 13 |
+ 89.5 % |
+ 19 |
+ 17 |
- |
|
|
@@ -145,8 +145,8 @@
diff --git a/report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/index-sort-f.html b/report/protocol/libraries/math/index-sort-f.html
similarity index 64%
rename from report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/index-sort-f.html
rename to report/protocol/libraries/math/index-sort-f.html
index cb969e10..196574ae 100644
--- a/report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/index-sort-f.html
+++ b/report/protocol/libraries/math/index-sort-f.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math
-
+ LCOV - lcov.info.p - protocol/libraries/math
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -31,13 +31,13 @@
|
-
-
-
+
+
+
-
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../../../glass.png) |
+ File ![Click to sort table by file name Sort by file name](../../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../glass.png) |
Rate |
@@ -96,9 +96,9 @@
Hit |
- MathUtils.sol |
+ MathUtils.sol |
-
+
|
100.0 % |
20 |
@@ -111,13 +111,13 @@
2 |
- PercentageMath.sol |
+ PercentageMath.sol |
-
+
|
100.0 % |
- 4 |
- 4 |
+ 6 |
+ 6 |
- |
|
|
@@ -126,13 +126,13 @@
2 |
- WadRayMath.sol |
+ WadRayMath.sol |
-
+
|
- 100.0 % |
- 13 |
- 13 |
+ 89.5 % |
+ 19 |
+ 17 |
- |
|
|
@@ -145,8 +145,8 @@
diff --git a/report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/index-sort-l.html b/report/protocol/libraries/math/index-sort-l.html
similarity index 64%
rename from report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/index-sort-l.html
rename to report/protocol/libraries/math/index-sort-l.html
index 5a3881c2..3b7d6d76 100644
--- a/report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/index-sort-l.html
+++ b/report/protocol/libraries/math/index-sort-l.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math
-
+ LCOV - lcov.info.p - protocol/libraries/math
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -31,13 +31,13 @@
|
-
-
-
+
+
+
-
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../../../glass.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../glass.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../updown.png) |
Rate |
@@ -96,39 +96,39 @@
Hit |
- PercentageMath.sol |
+ WadRayMath.sol |
-
+
|
- 100.0 % |
- 4 |
- 4 |
+ 89.5 % |
+ 19 |
+ 17 |
- |
|
|
100.0 % |
- 2 |
- 2 |
+ 6 |
+ 6 |
- WadRayMath.sol |
+ PercentageMath.sol |
-
+
|
100.0 % |
- 13 |
- 13 |
+ 6 |
+ 6 |
- |
|
|
100.0 % |
- 6 |
- 6 |
+ 2 |
+ 2 |
- MathUtils.sol |
+ MathUtils.sol |
-
+
|
100.0 % |
20 |
@@ -145,8 +145,8 @@
diff --git a/report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/index.html b/report/protocol/libraries/math/index.html
similarity index 64%
rename from report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/index.html
rename to report/protocol/libraries/math/index.html
index fb38af2f..fb57a734 100644
--- a/report/core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math/index.html
+++ b/report/protocol/libraries/math/index.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/libraries/math/src/core/contracts/protocol/libraries/math
-
+ LCOV - lcov.info.p - protocol/libraries/math
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -31,13 +31,13 @@
|
-
-
-
+
+
+
-
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../../../glass.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../../../glass.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../updown.png) |
Rate |
@@ -96,9 +96,9 @@
Hit |
- MathUtils.sol |
+ MathUtils.sol |
-
+
|
100.0 % |
20 |
@@ -111,13 +111,13 @@
2 |
- PercentageMath.sol |
+ PercentageMath.sol |
-
+
|
100.0 % |
- 4 |
- 4 |
+ 6 |
+ 6 |
- |
|
|
@@ -126,13 +126,13 @@
2 |
- WadRayMath.sol |
+ WadRayMath.sol |
-
+
|
- 100.0 % |
- 13 |
- 13 |
+ 89.5 % |
+ 19 |
+ 17 |
- |
|
|
@@ -145,8 +145,8 @@
diff --git a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/L2Pool.sol.func-c.html b/report/protocol/pool/L2Pool.sol.func-c.html
similarity index 66%
rename from report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/L2Pool.sol.func-c.html
rename to report/protocol/pool/L2Pool.sol.func-c.html
index bd46015b..fdaff8d1 100644
--- a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/L2Pool.sol.func-c.html
+++ b/report/protocol/pool/L2Pool.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/pool/src/core/contracts/protocol/pool/L2Pool.sol - functions
-
+ LCOV - lcov.info.p - protocol/pool/L2Pool.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,33 +53,26 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../glass.png) |
- L2Pool.liquidationCall |
-
- 1 |
-
-
-
-
- L2Pool.rebalanceStableBorrowRate |
+ L2Pool.liquidationCall |
1 |
@@ -100,14 +93,7 @@
- L2Pool.setUserUseReserveAsCollateral |
-
- 1 |
-
-
-
-
- L2Pool.swapBorrowRateMode |
+ L2Pool.setUserUseReserveAsCollateral |
1 |
@@ -152,8 +138,8 @@
diff --git a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/L2Pool.sol.func.html b/report/protocol/pool/L2Pool.sol.func.html
similarity index 66%
rename from report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/L2Pool.sol.func.html
rename to report/protocol/pool/L2Pool.sol.func.html
index 5cb0e702..5d8dfdfa 100644
--- a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/L2Pool.sol.func.html
+++ b/report/protocol/pool/L2Pool.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/pool/src/core/contracts/protocol/pool/L2Pool.sol - functions
-
+ LCOV - lcov.info.p - protocol/pool/L2Pool.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,21 +53,21 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../updown.png) |
@@ -79,14 +79,7 @@
- L2Pool.liquidationCall |
-
- 1 |
-
-
-
-
- L2Pool.rebalanceStableBorrowRate |
+ L2Pool.liquidationCall |
1 |
@@ -114,7 +107,7 @@
- L2Pool.setUserUseReserveAsCollateral |
+ L2Pool.setUserUseReserveAsCollateral |
1 |
@@ -133,13 +126,6 @@
1000 |
-
-
- L2Pool.swapBorrowRateMode |
-
- 1 |
-
-
L2Pool.withdraw |
@@ -152,8 +138,8 @@
diff --git a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/L2Pool.sol.gcov.html b/report/protocol/pool/L2Pool.sol.gcov.html
similarity index 66%
rename from report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/L2Pool.sol.gcov.html
rename to report/protocol/pool/L2Pool.sol.gcov.html
index 5ba63d60..6ce0cf48 100644
--- a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/L2Pool.sol.gcov.html
+++ b/report/protocol/pool/L2Pool.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/pool/src/core/contracts/protocol/pool/L2Pool.sol
-
+ LCOV - lcov.info.p - protocol/pool/L2Pool.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -85,110 +85,92 @@
14 : : */
15 : : abstract contract L2Pool is Pool, IL2Pool {
16 : : /// @inheritdoc IL2Pool
- 17 : 7 : function supply(bytes32 args) external override {
- 18 : 21 : (address asset, uint256 amount, uint16 referralCode) = CalldataLogic.decodeSupplyParams(
+ 17 : : function supply(bytes32 args) external override {
+ 18 : 7 : (address asset, uint256 amount, uint16 referralCode) = CalldataLogic.decodeSupplyParams(
19 : : _reservesList,
20 : : args
21 : : );
22 : :
- 23 : 14 : supply(asset, amount, msg.sender, referralCode);
+ 23 : 7 : supply(asset, amount, msg.sender, referralCode);
24 : : }
25 : :
26 : : /// @inheritdoc IL2Pool
- 27 : 1000 : function supplyWithPermit(bytes32 args, bytes32 r, bytes32 s) external override {
- 28 : 3000 : (address asset, uint256 amount, uint16 referralCode, uint256 deadline, uint8 v) = CalldataLogic
+ 27 : : function supplyWithPermit(bytes32 args, bytes32 r, bytes32 s) external override {
+ 28 : 1000 : (address asset, uint256 amount, uint16 referralCode, uint256 deadline, uint8 v) = CalldataLogic
29 : : .decodeSupplyWithPermitParams(_reservesList, args);
30 : :
- 31 : 2000 : supplyWithPermit(asset, amount, msg.sender, referralCode, deadline, v, r, s);
+ 31 : 1000 : supplyWithPermit(asset, amount, msg.sender, referralCode, deadline, v, r, s);
32 : : }
33 : :
34 : : /// @inheritdoc IL2Pool
- 35 : 2 : function withdraw(bytes32 args) external override returns (uint256) {
- 36 : 6 : (address asset, uint256 amount) = CalldataLogic.decodeWithdrawParams(_reservesList, args);
+ 35 : : function withdraw(bytes32 args) external override returns (uint256) {
+ 36 : 2 : (address asset, uint256 amount) = CalldataLogic.decodeWithdrawParams(_reservesList, args);
37 : :
- 38 : 6 : return withdraw(asset, amount, msg.sender);
+ 38 : 2 : return withdraw(asset, amount, msg.sender);
39 : : }
40 : :
41 : : /// @inheritdoc IL2Pool
- 42 : 3 : function borrow(bytes32 args) external override {
- 43 : 9 : (address asset, uint256 amount, uint256 interestRateMode, uint16 referralCode) = CalldataLogic
+ 42 : : function borrow(bytes32 args) external override {
+ 43 : 3 : (address asset, uint256 amount, uint256 interestRateMode, uint16 referralCode) = CalldataLogic
44 : : .decodeBorrowParams(_reservesList, args);
45 : :
- 46 : 6 : borrow(asset, amount, interestRateMode, referralCode, msg.sender);
+ 46 : 3 : borrow(asset, amount, interestRateMode, referralCode, msg.sender);
47 : : }
48 : :
49 : : /// @inheritdoc IL2Pool
- 50 : 1 : function repay(bytes32 args) external override returns (uint256) {
- 51 : 3 : (address asset, uint256 amount, uint256 interestRateMode) = CalldataLogic.decodeRepayParams(
+ 50 : : function repay(bytes32 args) external override returns (uint256) {
+ 51 : 1 : (address asset, uint256 amount, uint256 interestRateMode) = CalldataLogic.decodeRepayParams(
52 : : _reservesList,
53 : : args
54 : : );
55 : :
- 56 : 3 : return repay(asset, amount, interestRateMode, msg.sender);
+ 56 : 1 : return repay(asset, amount, interestRateMode, msg.sender);
57 : : }
58 : :
59 : : /// @inheritdoc IL2Pool
- 60 : 1000 : function repayWithPermit(bytes32 args, bytes32 r, bytes32 s) external override returns (uint256) {
- 61 : 2000 : (
+ 60 : : function repayWithPermit(bytes32 args, bytes32 r, bytes32 s) external override returns (uint256) {
+ 61 : 1000 : (
62 : : address asset,
63 : : uint256 amount,
64 : : uint256 interestRateMode,
65 : : uint256 deadline,
66 : : uint8 v
- 67 : 2000 : ) = CalldataLogic.decodeRepayWithPermitParams(_reservesList, args);
+ 67 : 1000 : ) = CalldataLogic.decodeRepayWithPermitParams(_reservesList, args);
68 : :
- 69 : 3000 : return repayWithPermit(asset, amount, interestRateMode, msg.sender, deadline, v, r, s);
+ 69 : 1000 : return repayWithPermit(asset, amount, interestRateMode, msg.sender, deadline, v, r, s);
70 : : }
71 : :
72 : : /// @inheritdoc IL2Pool
- 73 : 1 : function repayWithATokens(bytes32 args) external override returns (uint256) {
- 74 : 3 : (address asset, uint256 amount, uint256 interestRateMode) = CalldataLogic.decodeRepayParams(
+ 73 : : function repayWithATokens(bytes32 args) external override returns (uint256) {
+ 74 : 1 : (address asset, uint256 amount, uint256 interestRateMode) = CalldataLogic.decodeRepayParams(
75 : : _reservesList,
76 : : args
77 : : );
78 : :
- 79 : 3 : return repayWithATokens(asset, amount, interestRateMode);
+ 79 : 1 : return repayWithATokens(asset, amount, interestRateMode);
80 : : }
81 : :
82 : : /// @inheritdoc IL2Pool
- 83 : 1 : function swapBorrowRateMode(bytes32 args) external override {
- 84 : 3 : (address asset, uint256 interestRateMode) = CalldataLogic.decodeSwapBorrowRateModeParams(
+ 83 : : function setUserUseReserveAsCollateral(bytes32 args) external override {
+ 84 : 1 : (address asset, bool useAsCollateral) = CalldataLogic.decodeSetUserUseReserveAsCollateralParams(
85 : : _reservesList,
86 : : args
87 : : );
- 88 : 2 : swapBorrowRateMode(asset, interestRateMode);
+ 88 : 1 : setUserUseReserveAsCollateral(asset, useAsCollateral);
89 : : }
90 : :
91 : : /// @inheritdoc IL2Pool
- 92 : 1 : function rebalanceStableBorrowRate(bytes32 args) external override {
- 93 : 3 : (address asset, address user) = CalldataLogic.decodeRebalanceStableBorrowRateParams(
- 94 : : _reservesList,
- 95 : : args
- 96 : : );
- 97 : 2 : rebalanceStableBorrowRate(asset, user);
- 98 : : }
- 99 : :
- 100 : : /// @inheritdoc IL2Pool
- 101 : 1 : function setUserUseReserveAsCollateral(bytes32 args) external override {
- 102 : 3 : (address asset, bool useAsCollateral) = CalldataLogic.decodeSetUserUseReserveAsCollateralParams(
- 103 : : _reservesList,
- 104 : : args
- 105 : : );
- 106 : 2 : setUserUseReserveAsCollateral(asset, useAsCollateral);
- 107 : : }
- 108 : :
- 109 : : /// @inheritdoc IL2Pool
- 110 : 1 : function liquidationCall(bytes32 args1, bytes32 args2) external override {
- 111 : 2 : (
- 112 : : address collateralAsset,
- 113 : : address debtAsset,
- 114 : : address user,
- 115 : : uint256 debtToCover,
- 116 : : bool receiveAToken
- 117 : 2 : ) = CalldataLogic.decodeLiquidationCallParams(_reservesList, args1, args2);
- 118 : 2 : liquidationCall(collateralAsset, debtAsset, user, debtToCover, receiveAToken);
- 119 : : }
- 120 : : }
+ 92 : : function liquidationCall(bytes32 args1, bytes32 args2) external override {
+ 93 : 1 : (
+ 94 : : address collateralAsset,
+ 95 : : address debtAsset,
+ 96 : : address user,
+ 97 : : uint256 debtToCover,
+ 98 : : bool receiveAToken
+ 99 : 1 : ) = CalldataLogic.decodeLiquidationCallParams(_reservesList, args1, args2);
+ 100 : 1 : liquidationCall(collateralAsset, debtAsset, user, debtToCover, receiveAToken);
+ 101 : : }
+ 102 : : }
@@ -196,8 +178,8 @@
diff --git a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/Pool.sol.func-c.html b/report/protocol/pool/Pool.sol.func-c.html
similarity index 62%
rename from report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/Pool.sol.func-c.html
rename to report/protocol/pool/Pool.sol.func-c.html
index 25ce9a96..8a0cf110 100644
--- a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/Pool.sol.func-c.html
+++ b/report/protocol/pool/Pool.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/pool/src/core/contracts/protocol/pool/Pool.sol - functions
-
+ LCOV - lcov.info.p - protocol/pool/Pool.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,448 +53,490 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../glass.png) |
- Pool.swapToVariable |
+ Pool.getReserveAddressById |
- 0 |
+ 1 |
- Pool.getReserveAddressById |
+ Pool.getBorrowLogic |
- 1 |
+ 2 |
- Pool.getReservesCount |
+ Pool.getBridgeLogic |
- 1 |
+ 2 |
- Pool.getBorrowLogic |
+ Pool.getEModeLogic |
2 |
- Pool.getBridgeLogic |
+ Pool.getFlashLoanLogic |
2 |
- Pool.getEModeLogic |
+ Pool.getLiquidationLogic |
2 |
- Pool.getFlashLoanLogic |
+ Pool.getPoolLogic |
2 |
- Pool.getLiquidationLogic |
+ Pool.getReservesCount |
2 |
- Pool.getPoolLogic |
+ Pool.getSupplyLogic |
2 |
- Pool.getSupplyLogic |
+ Pool.getEModeCategoryData |
- 2 |
+ 3 |
- Pool.MAX_NUMBER_RESERVES |
+ Pool.mintToTreasury |
- 3 |
+ 4 |
- Pool.MAX_STABLE_RATE_BORROW_SIZE_PERCENT |
+ Pool.backUnbacked |
- 3 |
+ 9 |
- Pool.mintToTreasury |
+ Pool.flashLoanSimple |
- 4 |
+ 11 |
- Pool.rebalanceStableBorrowRate |
+ Pool.mintUnbacked |
- 4 |
+ 17 |
- Pool.getReserveDataExtended |
+ Pool.onlyBridge |
- 6 |
+ 17 |
- Pool.swapBorrowRateMode |
+ Pool.repay |
- 7 |
+ 23 |
- Pool.backUnbacked |
+ Pool.BRIDGE_PROTOCOL_FEE |
- 9 |
+ 25 |
- Pool.flashLoan |
+ Pool.getEModeCategoryLabel |
- 10 |
+ 25 |
- Pool.flashLoanSimple |
+ Pool._onlyBridge |
- 10 |
+ 26 |
- Pool.deposit |
+ Pool.setUserUseReserveAsCollateral |
- 17 |
+ 42 |
- Pool.mintUnbacked |
+ Pool. |
- 17 |
+ 44 |
- Pool.setUserEMode |
+ Pool.getEModeCategoryCollateralConfig |
- 17 |
+ 110 |
- Pool.repay |
+ Pool.repayWithATokens |
- 22 |
+ 1005 |
- Pool.BRIDGE_PROTOCOL_FEE |
+ Pool.flashLoan |
- 25 |
+ 1011 |
- Pool._onlyBridge |
+ Pool.FLASHLOAN_PREMIUM_TO_PROTOCOL |
- 26 |
+ 1365 |
- Pool.setUserUseReserveAsCollateral |
+ Pool.FLASHLOAN_PREMIUM_TOTAL |
- 42 |
+ 1368 |
- Pool.withdraw |
+ Pool.syncIndexesState |
- 43 |
+ 1994 |
- Pool.getEModeCategoryData |
+ Pool.syncRatesState |
- 46 |
+ 1994 |
- Pool.repayWithATokens |
+ Pool._onlyPoolAdmin |
- 1005 |
+ 2000 |
- Pool.finalizeTransfer |
+ Pool.onlyPoolAdmin |
- 1036 |
+ 2000 |
- Pool.FLASHLOAN_PREMIUM_TO_PROTOCOL |
+ Pool.rescueTokens |
- 1215 |
+ 2000 |
- Pool.FLASHLOAN_PREMIUM_TOTAL |
+ Pool.MAX_NUMBER_RESERVES |
- 1218 |
+ 2002 |
- Pool.syncIndexesState |
+ Pool.dropReserve |
- 1751 |
+ 2007 |
- Pool.syncRatesState |
+ Pool.updateBridgeProtocolFee |
- 1751 |
+ 2013 |
- Pool._onlyPoolAdmin |
+ Pool.withdraw |
- 2000 |
+ 2043 |
- Pool.rescueTokens |
+ Pool.repayWithPermit |
- 2000 |
+ 3000 |
- Pool.dropReserve |
+ Pool.supplyWithPermit |
- 2007 |
+ 3000 |
- Pool.updateBridgeProtocolFee |
+ Pool.updateFlashloanPremiums |
- 2013 |
+ 3362 |
- Pool.configureEModeCategory |
+ Pool.resetIsolationModeTotalDebt |
- 2027 |
+ 3951 |
- Pool.repayWithPermit |
+ Pool.getUserEMode |
- 3000 |
+ 5016 |
- Pool.supplyWithPermit |
+ Pool.getReserveDataExtended |
- 3000 |
+ 6011 |
+
+
+
+
+ Pool.onlyPoolConfigurator |
+
+ 6046 |
+
+
+
+
+ Pool.setReserveInterestRateStrategyAddress |
+
+ 6046 |
+
+
+
+
+ Pool.configureEModeCategoryBorrowableBitmap |
+
+ 7010 |
+
+
+
+
+ Pool.getUserConfiguration |
+
+ 7029 |
+
+
+
+
+ Pool.getEModeCategoryBorrowableBitmap |
+
+ 7035 |
+
+
+
+
+ Pool.getVirtualUnderlyingBalance |
+
+ 8111 |
- Pool.getUserEMode |
+ Pool.getLiquidationGracePeriod |
- 3012 |
+ 8756 |
- Pool.getUserAccountData |
+ Pool.getUserAccountData |
- 3013 |
+ 10015 |
- Pool.updateFlashloanPremiums |
+ Pool.setUserEMode |
- 3212 |
+ 10023 |
- Pool.resetIsolationModeTotalDebt |
+ Pool.configureEModeCategoryCollateralBitmap |
- 3751 |
+ 10039 |
- Pool.getLiquidationGracePeriod |
+ Pool.getEModeCategoryCollateralBitmap |
- 5512 |
+ 10064 |
- Pool.setReserveInterestRateStrategyAddress |
+ Pool.configureEModeCategory |
- 6006 |
+ 12029 |
- Pool.getUserConfiguration |
+ Pool.liquidationCall |
- 6030 |
+ 14500 |
- Pool.getVirtualUnderlyingBalance |
+ Pool.getReservesList |
- 6030 |
+ 16076 |
- Pool.getReservesList |
+ Pool.borrow |
- 6043 |
+ 16105 |
- Pool.initReserve |
+ Pool.setLiquidationGracePeriod |
- 6882 |
+ 16412 |
- Pool.borrow |
+ Pool.finalizeTransfer |
- 9113 |
+ 17042 |
- Pool.supply |
+ Pool.deposit |
- 9558 |
+ 20025 |
- Pool.liquidationCall |
+ Pool.supply |
- 11291 |
+ 20483 |
- Pool.setLiquidationGracePeriod |
+ Pool.getReserveNormalizedVariableDebt |
- 13028 |
+ 29583 |
- Pool.getReserveData |
+ Pool.getReserveData |
- 22204 |
+ 83030 |
- Pool.getReserveNormalizedVariableDebt |
+ Pool.getReserveNormalizedIncome |
- 25218 |
+ 115423 |
- Pool.getReserveNormalizedIncome |
+ Pool.getConfiguration |
- 31404 |
+ 162047 |
- Pool.setConfiguration |
+ Pool.initReserve |
- 38058 |
+ 170016 |
- Pool.getConfiguration |
+ Pool.setConfiguration |
- 41450 |
+ 210599 |
- Pool._onlyPoolConfigurator |
+ Pool._onlyPoolConfigurator |
- 80486 |
+ 447472 |
@@ -502,8 +544,8 @@
diff --git a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/Pool.sol.func.html b/report/protocol/pool/Pool.sol.func.html
similarity index 62%
rename from report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/Pool.sol.func.html
rename to report/protocol/pool/Pool.sol.func.html
index ca1ea3f4..7757b8f3 100644
--- a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/Pool.sol.func.html
+++ b/report/protocol/pool/Pool.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/pool/src/core/contracts/protocol/pool/Pool.sol - functions
-
+ LCOV - lcov.info.p - protocol/pool/Pool.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,448 +53,490 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../updown.png) |
- Pool.BRIDGE_PROTOCOL_FEE |
+ Pool. |
- 25 |
+ 44 |
- Pool.FLASHLOAN_PREMIUM_TOTAL |
+ Pool.BRIDGE_PROTOCOL_FEE |
- 1218 |
+ 25 |
- Pool.FLASHLOAN_PREMIUM_TO_PROTOCOL |
+ Pool.FLASHLOAN_PREMIUM_TOTAL |
- 1215 |
+ 1368 |
- Pool.MAX_NUMBER_RESERVES |
+ Pool.FLASHLOAN_PREMIUM_TO_PROTOCOL |
- 3 |
+ 1365 |
- Pool.MAX_STABLE_RATE_BORROW_SIZE_PERCENT |
+ Pool.MAX_NUMBER_RESERVES |
- 3 |
+ 2002 |
- Pool._onlyBridge |
+ Pool._onlyBridge |
26 |
- Pool._onlyPoolAdmin |
+ Pool._onlyPoolAdmin |
2000 |
- Pool._onlyPoolConfigurator |
+ Pool._onlyPoolConfigurator |
- 80486 |
+ 447472 |
- Pool.backUnbacked |
+ Pool.backUnbacked |
9 |
- Pool.borrow |
+ Pool.borrow |
- 9113 |
+ 16105 |
- Pool.configureEModeCategory |
+ Pool.configureEModeCategory |
- 2027 |
+ 12029 |
- Pool.deposit |
+ Pool.configureEModeCategoryBorrowableBitmap |
- 17 |
+ 7010 |
+
+
+
+
+ Pool.configureEModeCategoryCollateralBitmap |
+
+ 10039 |
- Pool.dropReserve |
+ Pool.deposit |
+
+ 20025 |
+
+
+
+
+ Pool.dropReserve |
2007 |
- Pool.finalizeTransfer |
+ Pool.finalizeTransfer |
- 1036 |
+ 17042 |
- Pool.flashLoan |
+ Pool.flashLoan |
- 10 |
+ 1011 |
- Pool.flashLoanSimple |
+ Pool.flashLoanSimple |
- 10 |
+ 11 |
- Pool.getBorrowLogic |
+ Pool.getBorrowLogic |
2 |
- Pool.getBridgeLogic |
+ Pool.getBridgeLogic |
2 |
- Pool.getConfiguration |
+ Pool.getConfiguration |
- 41450 |
+ 162047 |
- Pool.getEModeCategoryData |
+ Pool.getEModeCategoryBorrowableBitmap |
- 46 |
+ 7035 |
- Pool.getEModeLogic |
+ Pool.getEModeCategoryCollateralBitmap |
+
+ 10064 |
+
+
+
+
+ Pool.getEModeCategoryCollateralConfig |
+
+ 110 |
+
+
+
+
+ Pool.getEModeCategoryData |
+
+ 3 |
+
+
+
+
+ Pool.getEModeCategoryLabel |
+
+ 25 |
+
+
+
+
+ Pool.getEModeLogic |
2 |
- Pool.getFlashLoanLogic |
+ Pool.getFlashLoanLogic |
2 |
- Pool.getLiquidationGracePeriod |
+ Pool.getLiquidationGracePeriod |
- 5512 |
+ 8756 |
- Pool.getLiquidationLogic |
+ Pool.getLiquidationLogic |
2 |
- Pool.getPoolLogic |
+ Pool.getPoolLogic |
2 |
- Pool.getReserveAddressById |
+ Pool.getReserveAddressById |
1 |
- Pool.getReserveData |
+ Pool.getReserveData |
- 22204 |
+ 83030 |
- Pool.getReserveDataExtended |
+ Pool.getReserveDataExtended |
- 6 |
+ 6011 |
- Pool.getReserveNormalizedIncome |
+ Pool.getReserveNormalizedIncome |
- 31404 |
+ 115423 |
- Pool.getReserveNormalizedVariableDebt |
+ Pool.getReserveNormalizedVariableDebt |
- 25218 |
+ 29583 |
- Pool.getReservesCount |
+ Pool.getReservesCount |
- 1 |
+ 2 |
- Pool.getReservesList |
+ Pool.getReservesList |
- 6043 |
+ 16076 |
- Pool.getSupplyLogic |
+ Pool.getSupplyLogic |
2 |
- Pool.getUserAccountData |
+ Pool.getUserAccountData |
- 3013 |
+ 10015 |
- Pool.getUserConfiguration |
+ Pool.getUserConfiguration |
- 6030 |
+ 7029 |
- Pool.getUserEMode |
+ Pool.getUserEMode |
- 3012 |
+ 5016 |
- Pool.getVirtualUnderlyingBalance |
+ Pool.getVirtualUnderlyingBalance |
- 6030 |
+ 8111 |
- Pool.initReserve |
+ Pool.initReserve |
- 6882 |
+ 170016 |
- Pool.liquidationCall |
+ Pool.liquidationCall |
- 11291 |
+ 14500 |
- Pool.mintToTreasury |
+ Pool.mintToTreasury |
4 |
- Pool.mintUnbacked |
+ Pool.mintUnbacked |
17 |
- Pool.rebalanceStableBorrowRate |
+ Pool.onlyBridge |
- 4 |
+ 17 |
- Pool.repay |
+ Pool.onlyPoolAdmin |
- 22 |
+ 2000 |
- Pool.repayWithATokens |
+ Pool.onlyPoolConfigurator |
- 1005 |
+ 6046 |
- Pool.repayWithPermit |
+ Pool.repay |
- 3000 |
+ 23 |
- Pool.rescueTokens |
+ Pool.repayWithATokens |
- 2000 |
+ 1005 |
- Pool.resetIsolationModeTotalDebt |
+ Pool.repayWithPermit |
- 3751 |
+ 3000 |
- Pool.setConfiguration |
+ Pool.rescueTokens |
- 38058 |
+ 2000 |
- Pool.setLiquidationGracePeriod |
+ Pool.resetIsolationModeTotalDebt |
- 13028 |
+ 3951 |
- Pool.setReserveInterestRateStrategyAddress |
+ Pool.setConfiguration |
- 6006 |
+ 210599 |
- Pool.setUserEMode |
+ Pool.setLiquidationGracePeriod |
- 17 |
+ 16412 |
- Pool.setUserUseReserveAsCollateral |
+ Pool.setReserveInterestRateStrategyAddress |
- 42 |
+ 6046 |
- Pool.supply |
+ Pool.setUserEMode |
- 9558 |
+ 10023 |
- Pool.supplyWithPermit |
+ Pool.setUserUseReserveAsCollateral |
- 3000 |
+ 42 |
- Pool.swapBorrowRateMode |
+ Pool.supply |
- 7 |
+ 20483 |
- Pool.swapToVariable |
+ Pool.supplyWithPermit |
- 0 |
+ 3000 |
- Pool.syncIndexesState |
+ Pool.syncIndexesState |
- 1751 |
+ 1994 |
- Pool.syncRatesState |
+ Pool.syncRatesState |
- 1751 |
+ 1994 |
- Pool.updateBridgeProtocolFee |
+ Pool.updateBridgeProtocolFee |
2013 |
- Pool.updateFlashloanPremiums |
+ Pool.updateFlashloanPremiums |
- 3212 |
+ 3362 |
- Pool.withdraw |
+ Pool.withdraw |
- 43 |
+ 2043 |
@@ -502,8 +544,8 @@
diff --git a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/Pool.sol.gcov.html b/report/protocol/pool/Pool.sol.gcov.html
similarity index 83%
rename from report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/Pool.sol.gcov.html
rename to report/protocol/pool/Pool.sol.gcov.html
index c53efd0f..af32c91e 100644
--- a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/Pool.sol.gcov.html
+++ b/report/protocol/pool/Pool.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/pool/src/core/contracts/protocol/pool/Pool.sol
-
+ LCOV - lcov.info.p - protocol/pool/Pool.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -72,7 +72,7 @@
1 : : // SPDX-License-Identifier: BUSL-1.1
2 : : pragma solidity ^0.8.10;
3 : :
- 4 : : import {VersionedInitializable} from '../libraries/aave-upgradeability/VersionedInitializable.sol';
+ 4 : : import {VersionedInitializable} from '../../misc/aave-upgradeability/VersionedInitializable.sol';
5 : : import {Errors} from '../libraries/helpers/Errors.sol';
6 : : import {ReserveConfiguration} from '../libraries/configuration/ReserveConfiguration.sol';
7 : : import {PoolLogic} from '../libraries/logic/PoolLogic.sol';
@@ -99,824 +99,843 @@
28 : : * # Withdraw
29 : : * # Borrow
30 : : * # Repay
- 31 : : * # Swap their loans between variable and stable rate
- 32 : : * # Enable/disable their supplied assets as collateral rebalance stable rate borrow positions
- 33 : : * # Liquidate positions
- 34 : : * # Execute Flash Loans
- 35 : : * @dev To be covered by a proxy contract, owned by the PoolAddressesProvider of the specific market
- 36 : : * @dev All admin functions are callable by the PoolConfigurator contract defined also in the
- 37 : : * PoolAddressesProvider
- 38 : : */
- 39 : : abstract contract Pool is VersionedInitializable, PoolStorage, IPool {
- 40 : : using ReserveLogic for DataTypes.ReserveData;
- 41 : :
- 42 : : IPoolAddressesProvider public immutable ADDRESSES_PROVIDER;
- 43 : :
- 44 : : /**
- 45 : : * @dev Only pool configurator can call functions marked by this modifier.
- 46 : : */
- 47 : : modifier onlyPoolConfigurator() {
- 48 : : _onlyPoolConfigurator();
- 49 : : _;
- 50 : : }
- 51 : :
- 52 : : /**
- 53 : : * @dev Only pool admin can call functions marked by this modifier.
- 54 : : */
- 55 : : modifier onlyPoolAdmin() {
- 56 : : _onlyPoolAdmin();
- 57 : : _;
- 58 : : }
- 59 : :
- 60 : : /**
- 61 : : * @dev Only bridge can call functions marked by this modifier.
- 62 : : */
- 63 : : modifier onlyBridge() {
- 64 : : _onlyBridge();
- 65 : : _;
- 66 : : }
- 67 : :
- 68 : 80486 : function _onlyPoolConfigurator() internal view virtual {
- 69 : 160972 : require(
- 70 : : ADDRESSES_PROVIDER.getPoolConfigurator() == msg.sender,
- 71 : : Errors.CALLER_NOT_POOL_CONFIGURATOR
- 72 : : );
- 73 : : }
- 74 : :
- 75 : 2000 : function _onlyPoolAdmin() internal view virtual {
- 76 : 4000 : require(
- 77 : : IACLManager(ADDRESSES_PROVIDER.getACLManager()).isPoolAdmin(msg.sender),
- 78 : : Errors.CALLER_NOT_POOL_ADMIN
- 79 : : );
- 80 : : }
- 81 : :
- 82 : 26 : function _onlyBridge() internal view virtual {
- 83 : 52 : require(
- 84 : : IACLManager(ADDRESSES_PROVIDER.getACLManager()).isBridge(msg.sender),
- 85 : : Errors.CALLER_NOT_BRIDGE
- 86 : : );
- 87 : : }
- 88 : :
- 89 : : /**
- 90 : : * @dev Constructor.
- 91 : : * @param provider The address of the PoolAddressesProvider contract
- 92 : : */
- 93 : : constructor(IPoolAddressesProvider provider) {
- 94 : : ADDRESSES_PROVIDER = provider;
- 95 : : }
- 96 : :
- 97 : : /**
- 98 : : * @notice Initializes the Pool.
- 99 : : * @dev Function is invoked by the proxy contract when the Pool contract is added to the
- 100 : : * PoolAddressesProvider of the market.
- 101 : : * @dev Caching the address of the PoolAddressesProvider in order to reduce gas consumption on subsequent operations
- 102 : : * @param provider The address of the PoolAddressesProvider
- 103 : : */
- 104 : : function initialize(IPoolAddressesProvider provider) external virtual;
- 105 : :
- 106 : : /// @inheritdoc IPool
- 107 : 17 : function mintUnbacked(
- 108 : : address asset,
- 109 : : uint256 amount,
- 110 : : address onBehalfOf,
- 111 : : uint16 referralCode
- 112 : : ) external virtual override onlyBridge {
- 113 : 32 : BridgeLogic.executeMintUnbacked(
- 114 : : _reserves,
- 115 : : _reservesList,
- 116 : : _usersConfig[onBehalfOf],
- 117 : : asset,
- 118 : : amount,
- 119 : : onBehalfOf,
- 120 : : referralCode
- 121 : : );
- 122 : : }
- 123 : :
- 124 : : /// @inheritdoc IPool
- 125 : 9 : function backUnbacked(
- 126 : : address asset,
- 127 : : uint256 amount,
- 128 : : uint256 fee
- 129 : : ) external virtual override onlyBridge returns (uint256) {
- 130 : 18 : return
- 131 : 18 : BridgeLogic.executeBackUnbacked(_reserves[asset], asset, amount, fee, _bridgeProtocolFee);
- 132 : : }
- 133 : :
- 134 : : /// @inheritdoc IPool
- 135 : 9558 : function supply(
- 136 : : address asset,
- 137 : : uint256 amount,
- 138 : : address onBehalfOf,
- 139 : : uint16 referralCode
- 140 : : ) public virtual override {
- 141 : 19130 : SupplyLogic.executeSupply(
- 142 : : _reserves,
- 143 : : _reservesList,
- 144 : : _usersConfig[onBehalfOf],
- 145 : : DataTypes.ExecuteSupplyParams({
- 146 : : asset: asset,
- 147 : : amount: amount,
- 148 : : onBehalfOf: onBehalfOf,
- 149 : : referralCode: referralCode
- 150 : : })
- 151 : : );
- 152 : : }
- 153 : :
- 154 : : /// @inheritdoc IPool
- 155 : 3000 : function supplyWithPermit(
- 156 : : address asset,
- 157 : : uint256 amount,
- 158 : : address onBehalfOf,
- 159 : : uint16 referralCode,
- 160 : : uint256 deadline,
- 161 : : uint8 permitV,
- 162 : : bytes32 permitR,
- 163 : : bytes32 permitS
- 164 : : ) public virtual override {
- 165 : : try
- 166 : 8000 : IERC20WithPermit(asset).permit(
- 167 : : msg.sender,
- 168 : : address(this),
- 169 : : amount,
- 170 : : deadline,
- 171 : : permitV,
- 172 : : permitR,
- 173 : : permitS
- 174 : : )
- 175 : : {} catch {}
- 176 : 8000 : SupplyLogic.executeSupply(
- 177 : : _reserves,
- 178 : : _reservesList,
- 179 : : _usersConfig[onBehalfOf],
- 180 : : DataTypes.ExecuteSupplyParams({
- 181 : : asset: asset,
- 182 : : amount: amount,
- 183 : : onBehalfOf: onBehalfOf,
- 184 : : referralCode: referralCode
- 185 : : })
- 186 : : );
- 187 : : }
- 188 : :
- 189 : : /// @inheritdoc IPool
- 190 : 43 : function withdraw(
- 191 : : address asset,
- 192 : : uint256 amount,
- 193 : : address to
- 194 : : ) public virtual override returns (uint256) {
- 195 : 90 : return
- 196 : 90 : SupplyLogic.executeWithdraw(
- 197 : : _reserves,
- 198 : : _reservesList,
- 199 : : _eModeCategories,
- 200 : : _usersConfig[msg.sender],
- 201 : : DataTypes.ExecuteWithdrawParams({
- 202 : : asset: asset,
- 203 : : amount: amount,
- 204 : : to: to,
- 205 : : reservesCount: _reservesCount,
- 206 : : oracle: ADDRESSES_PROVIDER.getPriceOracle(),
- 207 : : userEModeCategory: _usersEModeCategory[msg.sender]
- 208 : : })
- 209 : : );
- 210 : : }
- 211 : :
- 212 : : /// @inheritdoc IPool
- 213 : 9113 : function borrow(
- 214 : : address asset,
- 215 : : uint256 amount,
- 216 : : uint256 interestRateMode,
- 217 : : uint16 referralCode,
- 218 : : address onBehalfOf
- 219 : : ) public virtual override {
- 220 : 18232 : BorrowLogic.executeBorrow(
- 221 : : _reserves,
- 222 : : _reservesList,
- 223 : : _eModeCategories,
- 224 : : _usersConfig[onBehalfOf],
- 225 : : DataTypes.ExecuteBorrowParams({
- 226 : : asset: asset,
- 227 : : user: msg.sender,
- 228 : : onBehalfOf: onBehalfOf,
- 229 : : amount: amount,
- 230 : : interestRateMode: DataTypes.InterestRateMode(interestRateMode),
- 231 : : referralCode: referralCode,
- 232 : : releaseUnderlying: true,
- 233 : : maxStableRateBorrowSizePercent: _maxStableRateBorrowSizePercent,
- 234 : : reservesCount: _reservesCount,
- 235 : : oracle: ADDRESSES_PROVIDER.getPriceOracle(),
- 236 : : userEModeCategory: _usersEModeCategory[onBehalfOf],
- 237 : : priceOracleSentinel: ADDRESSES_PROVIDER.getPriceOracleSentinel()
- 238 : : })
- 239 : : );
- 240 : : }
- 241 : :
- 242 : : /// @inheritdoc IPool
- 243 : 22 : function repay(
- 244 : : address asset,
- 245 : : uint256 amount,
- 246 : : uint256 interestRateMode,
- 247 : : address onBehalfOf
- 248 : : ) public virtual override returns (uint256) {
- 249 : 46 : return
- 250 : 46 : BorrowLogic.executeRepay(
- 251 : : _reserves,
- 252 : : _reservesList,
- 253 : : _usersConfig[onBehalfOf],
- 254 : : DataTypes.ExecuteRepayParams({
- 255 : : asset: asset,
- 256 : : amount: amount,
- 257 : : interestRateMode: DataTypes.InterestRateMode(interestRateMode),
- 258 : : onBehalfOf: onBehalfOf,
- 259 : : useATokens: false
- 260 : : })
- 261 : : );
- 262 : : }
- 263 : :
- 264 : : /// @inheritdoc IPool
- 265 : 3000 : function repayWithPermit(
- 266 : : address asset,
- 267 : : uint256 amount,
- 268 : : uint256 interestRateMode,
- 269 : : address onBehalfOf,
- 270 : : uint256 deadline,
- 271 : : uint8 permitV,
- 272 : : bytes32 permitR,
- 273 : : bytes32 permitS
- 274 : : ) public virtual override returns (uint256) {
- 275 : : try
- 276 : 8000 : IERC20WithPermit(asset).permit(
- 277 : : msg.sender,
- 278 : : address(this),
- 279 : : amount,
- 280 : : deadline,
- 281 : : permitV,
- 282 : : permitR,
- 283 : : permitS
- 284 : : )
- 285 : : {} catch {}
- 286 : :
- 287 : : {
- 288 : 12000 : DataTypes.ExecuteRepayParams memory params = DataTypes.ExecuteRepayParams({
- 289 : : asset: asset,
- 290 : : amount: amount,
- 291 : : interestRateMode: DataTypes.InterestRateMode(interestRateMode),
- 292 : : onBehalfOf: onBehalfOf,
- 293 : : useATokens: false
- 294 : : });
- 295 : 12000 : return BorrowLogic.executeRepay(_reserves, _reservesList, _usersConfig[onBehalfOf], params);
- 296 : : }
- 297 : : }
- 298 : :
- 299 : : /// @inheritdoc IPool
- 300 : 1005 : function repayWithATokens(
- 301 : : address asset,
- 302 : : uint256 amount,
- 303 : : uint256 interestRateMode
- 304 : : ) public virtual override returns (uint256) {
- 305 : 2012 : return
- 306 : 2012 : BorrowLogic.executeRepay(
- 307 : : _reserves,
- 308 : : _reservesList,
- 309 : : _usersConfig[msg.sender],
- 310 : : DataTypes.ExecuteRepayParams({
- 311 : : asset: asset,
- 312 : : amount: amount,
- 313 : : interestRateMode: DataTypes.InterestRateMode(interestRateMode),
- 314 : : onBehalfOf: msg.sender,
- 315 : : useATokens: true
- 316 : : })
- 317 : : );
- 318 : : }
- 319 : :
- 320 : : /// @inheritdoc IPool
- 321 : 7 : function swapBorrowRateMode(address asset, uint256 interestRateMode) public virtual override {
- 322 : 16 : BorrowLogic.executeSwapBorrowRateMode(
- 323 : : _reserves[asset],
- 324 : : _usersConfig[msg.sender],
- 325 : : asset,
- 326 : : msg.sender,
- 327 : : DataTypes.InterestRateMode(interestRateMode)
- 328 : : );
- 329 : : }
- 330 : :
- 331 : : /// @inheritdoc IPool
- 332 : 0 : function swapToVariable(address asset, address user) public virtual override {
- 333 : 0 : BorrowLogic.executeSwapBorrowRateMode(
- 334 : : _reserves[asset],
- 335 : : _usersConfig[user],
- 336 : : asset,
- 337 : : user,
- 338 : : DataTypes.InterestRateMode.STABLE
- 339 : : );
- 340 : : }
- 341 : :
- 342 : : /// @inheritdoc IPool
- 343 : 4 : function rebalanceStableBorrowRate(address asset, address user) public virtual override {
- 344 : 10 : BorrowLogic.executeRebalanceStableBorrowRate(_reserves[asset], asset, user);
- 345 : : }
- 346 : :
- 347 : : /// @inheritdoc IPool
- 348 : 42 : function setUserUseReserveAsCollateral(
- 349 : : address asset,
- 350 : : bool useAsCollateral
- 351 : : ) public virtual override {
- 352 : 86 : SupplyLogic.executeUseReserveAsCollateral(
- 353 : : _reserves,
- 354 : : _reservesList,
- 355 : : _eModeCategories,
- 356 : : _usersConfig[msg.sender],
- 357 : : asset,
- 358 : : useAsCollateral,
- 359 : : _reservesCount,
- 360 : : ADDRESSES_PROVIDER.getPriceOracle(),
- 361 : : _usersEModeCategory[msg.sender]
- 362 : : );
- 363 : : }
- 364 : :
- 365 : : /// @inheritdoc IPool
- 366 : 11291 : function liquidationCall(
- 367 : : address collateralAsset,
- 368 : : address debtAsset,
- 369 : : address user,
- 370 : : uint256 debtToCover,
- 371 : : bool receiveAToken
+ 31 : : * # Enable/disable their supplied assets as collateral
+ 32 : : * # Liquidate positions
+ 33 : : * # Execute Flash Loans
+ 34 : : * @dev To be covered by a proxy contract, owned by the PoolAddressesProvider of the specific market
+ 35 : : * @dev All admin functions are callable by the PoolConfigurator contract defined also in the
+ 36 : : * PoolAddressesProvider
+ 37 : : */
+ 38 : : abstract contract Pool is VersionedInitializable, PoolStorage, IPool {
+ 39 : : using ReserveLogic for DataTypes.ReserveData;
+ 40 : :
+ 41 : : IPoolAddressesProvider public immutable ADDRESSES_PROVIDER;
+ 42 : :
+ 43 : : /**
+ 44 : : * @dev Only pool configurator can call functions marked by this modifier.
+ 45 : : */
+ 46 : : modifier onlyPoolConfigurator() {
+ 47 : 6046 : _onlyPoolConfigurator();
+ 48 : : _;
+ 49 : : }
+ 50 : :
+ 51 : : /**
+ 52 : : * @dev Only pool admin can call functions marked by this modifier.
+ 53 : : */
+ 54 : : modifier onlyPoolAdmin() {
+ 55 : 2000 : _onlyPoolAdmin();
+ 56 : : _;
+ 57 : : }
+ 58 : :
+ 59 : : /**
+ 60 : : * @dev Only bridge can call functions marked by this modifier.
+ 61 : : */
+ 62 : : modifier onlyBridge() {
+ 63 : 17 : _onlyBridge();
+ 64 : : _;
+ 65 : : }
+ 66 : :
+ 67 : : function _onlyPoolConfigurator() internal view virtual {
+ 68 : 447472 : require(
+ 69 : : ADDRESSES_PROVIDER.getPoolConfigurator() == msg.sender,
+ 70 : : Errors.CALLER_NOT_POOL_CONFIGURATOR
+ 71 : : );
+ 72 : : }
+ 73 : :
+ 74 : : function _onlyPoolAdmin() internal view virtual {
+ 75 : 2000 : require(
+ 76 : : IACLManager(ADDRESSES_PROVIDER.getACLManager()).isPoolAdmin(msg.sender),
+ 77 : : Errors.CALLER_NOT_POOL_ADMIN
+ 78 : : );
+ 79 : : }
+ 80 : :
+ 81 : : function _onlyBridge() internal view virtual {
+ 82 : 26 : require(
+ 83 : : IACLManager(ADDRESSES_PROVIDER.getACLManager()).isBridge(msg.sender),
+ 84 : : Errors.CALLER_NOT_BRIDGE
+ 85 : : );
+ 86 : : }
+ 87 : :
+ 88 : : /**
+ 89 : : * @dev Constructor.
+ 90 : : * @param provider The address of the PoolAddressesProvider contract
+ 91 : : */
+ 92 : : constructor(IPoolAddressesProvider provider) {
+ 93 : 44 : ADDRESSES_PROVIDER = provider;
+ 94 : : }
+ 95 : :
+ 96 : : /**
+ 97 : : * @notice Initializes the Pool.
+ 98 : : * @dev Function is invoked by the proxy contract when the Pool contract is added to the
+ 99 : : * PoolAddressesProvider of the market.
+ 100 : : * @dev Caching the address of the PoolAddressesProvider in order to reduce gas consumption on subsequent operations
+ 101 : : * @param provider The address of the PoolAddressesProvider
+ 102 : : */
+ 103 : : function initialize(IPoolAddressesProvider provider) external virtual;
+ 104 : :
+ 105 : : /// @inheritdoc IPool
+ 106 : : function mintUnbacked(
+ 107 : : address asset,
+ 108 : : uint256 amount,
+ 109 : : address onBehalfOf,
+ 110 : : uint16 referralCode
+ 111 : : ) external virtual override onlyBridge {
+ 112 : 16 : BridgeLogic.executeMintUnbacked(
+ 113 : : _reserves,
+ 114 : : _reservesList,
+ 115 : : _usersConfig[onBehalfOf],
+ 116 : : asset,
+ 117 : : amount,
+ 118 : : onBehalfOf,
+ 119 : : referralCode
+ 120 : : );
+ 121 : : }
+ 122 : :
+ 123 : : /// @inheritdoc IPool
+ 124 : : function backUnbacked(
+ 125 : : address asset,
+ 126 : : uint256 amount,
+ 127 : : uint256 fee
+ 128 : : ) external virtual override onlyBridge returns (uint256) {
+ 129 : 9 : return
+ 130 : 9 : BridgeLogic.executeBackUnbacked(_reserves[asset], asset, amount, fee, _bridgeProtocolFee);
+ 131 : : }
+ 132 : :
+ 133 : : /// @inheritdoc IPool
+ 134 : : function supply(
+ 135 : : address asset,
+ 136 : : uint256 amount,
+ 137 : : address onBehalfOf,
+ 138 : : uint16 referralCode
+ 139 : : ) public virtual override {
+ 140 : 20490 : SupplyLogic.executeSupply(
+ 141 : : _reserves,
+ 142 : : _reservesList,
+ 143 : : _usersConfig[onBehalfOf],
+ 144 : : DataTypes.ExecuteSupplyParams({
+ 145 : : asset: asset,
+ 146 : : amount: amount,
+ 147 : : onBehalfOf: onBehalfOf,
+ 148 : : referralCode: referralCode
+ 149 : : })
+ 150 : : );
+ 151 : : }
+ 152 : :
+ 153 : : /// @inheritdoc IPool
+ 154 : : function supplyWithPermit(
+ 155 : : address asset,
+ 156 : : uint256 amount,
+ 157 : : address onBehalfOf,
+ 158 : : uint16 referralCode,
+ 159 : : uint256 deadline,
+ 160 : : uint8 permitV,
+ 161 : : bytes32 permitR,
+ 162 : : bytes32 permitS
+ 163 : : ) public virtual override {
+ 164 : : try
+ 165 : 4000 : IERC20WithPermit(asset).permit(
+ 166 : : msg.sender,
+ 167 : : address(this),
+ 168 : : amount,
+ 169 : : deadline,
+ 170 : : permitV,
+ 171 : : permitR,
+ 172 : : permitS
+ 173 : : )
+ 174 : 0 : {} catch {}
+ 175 : 4000 : SupplyLogic.executeSupply(
+ 176 : : _reserves,
+ 177 : : _reservesList,
+ 178 : : _usersConfig[onBehalfOf],
+ 179 : : DataTypes.ExecuteSupplyParams({
+ 180 : : asset: asset,
+ 181 : : amount: amount,
+ 182 : : onBehalfOf: onBehalfOf,
+ 183 : : referralCode: referralCode
+ 184 : : })
+ 185 : : );
+ 186 : : }
+ 187 : :
+ 188 : : /// @inheritdoc IPool
+ 189 : : function withdraw(
+ 190 : : address asset,
+ 191 : : uint256 amount,
+ 192 : : address to
+ 193 : : ) public virtual override returns (uint256) {
+ 194 : 2045 : return
+ 195 : 2045 : SupplyLogic.executeWithdraw(
+ 196 : : _reserves,
+ 197 : : _reservesList,
+ 198 : : _eModeCategories,
+ 199 : : _usersConfig[msg.sender],
+ 200 : : DataTypes.ExecuteWithdrawParams({
+ 201 : : asset: asset,
+ 202 : : amount: amount,
+ 203 : : to: to,
+ 204 : : reservesCount: _reservesCount,
+ 205 : : oracle: ADDRESSES_PROVIDER.getPriceOracle(),
+ 206 : : userEModeCategory: _usersEModeCategory[msg.sender]
+ 207 : : })
+ 208 : : );
+ 209 : : }
+ 210 : :
+ 211 : : /// @inheritdoc IPool
+ 212 : : function borrow(
+ 213 : : address asset,
+ 214 : : uint256 amount,
+ 215 : : uint256 interestRateMode,
+ 216 : : uint16 referralCode,
+ 217 : : address onBehalfOf
+ 218 : : ) public virtual override {
+ 219 : 16108 : BorrowLogic.executeBorrow(
+ 220 : : _reserves,
+ 221 : : _reservesList,
+ 222 : : _eModeCategories,
+ 223 : : _usersConfig[onBehalfOf],
+ 224 : : DataTypes.ExecuteBorrowParams({
+ 225 : : asset: asset,
+ 226 : : user: msg.sender,
+ 227 : : onBehalfOf: onBehalfOf,
+ 228 : : amount: amount,
+ 229 : : interestRateMode: DataTypes.InterestRateMode(interestRateMode),
+ 230 : : referralCode: referralCode,
+ 231 : : releaseUnderlying: true,
+ 232 : : reservesCount: _reservesCount,
+ 233 : : oracle: ADDRESSES_PROVIDER.getPriceOracle(),
+ 234 : : userEModeCategory: _usersEModeCategory[onBehalfOf],
+ 235 : : priceOracleSentinel: ADDRESSES_PROVIDER.getPriceOracleSentinel()
+ 236 : : })
+ 237 : : );
+ 238 : : }
+ 239 : :
+ 240 : : /// @inheritdoc IPool
+ 241 : : function repay(
+ 242 : : address asset,
+ 243 : : uint256 amount,
+ 244 : : uint256 interestRateMode,
+ 245 : : address onBehalfOf
+ 246 : : ) public virtual override returns (uint256) {
+ 247 : 24 : return
+ 248 : 24 : BorrowLogic.executeRepay(
+ 249 : : _reserves,
+ 250 : : _reservesList,
+ 251 : : _usersConfig[onBehalfOf],
+ 252 : : DataTypes.ExecuteRepayParams({
+ 253 : : asset: asset,
+ 254 : : amount: amount,
+ 255 : : interestRateMode: DataTypes.InterestRateMode(interestRateMode),
+ 256 : : onBehalfOf: onBehalfOf,
+ 257 : : useATokens: false
+ 258 : : })
+ 259 : : );
+ 260 : : }
+ 261 : :
+ 262 : : /// @inheritdoc IPool
+ 263 : : function repayWithPermit(
+ 264 : : address asset,
+ 265 : : uint256 amount,
+ 266 : : uint256 interestRateMode,
+ 267 : : address onBehalfOf,
+ 268 : : uint256 deadline,
+ 269 : : uint8 permitV,
+ 270 : : bytes32 permitR,
+ 271 : : bytes32 permitS
+ 272 : : ) public virtual override returns (uint256) {
+ 273 : : try
+ 274 : 4000 : IERC20WithPermit(asset).permit(
+ 275 : : msg.sender,
+ 276 : : address(this),
+ 277 : : amount,
+ 278 : : deadline,
+ 279 : : permitV,
+ 280 : : permitR,
+ 281 : : permitS
+ 282 : : )
+ 283 : 0 : {} catch {}
+ 284 : :
+ 285 : : {
+ 286 : 4000 : DataTypes.ExecuteRepayParams memory params = DataTypes.ExecuteRepayParams({
+ 287 : : asset: asset,
+ 288 : : amount: amount,
+ 289 : : interestRateMode: DataTypes.InterestRateMode(interestRateMode),
+ 290 : : onBehalfOf: onBehalfOf,
+ 291 : : useATokens: false
+ 292 : : });
+ 293 : 4000 : return BorrowLogic.executeRepay(_reserves, _reservesList, _usersConfig[onBehalfOf], params);
+ 294 : : }
+ 295 : : }
+ 296 : :
+ 297 : : /// @inheritdoc IPool
+ 298 : : function repayWithATokens(
+ 299 : : address asset,
+ 300 : : uint256 amount,
+ 301 : : uint256 interestRateMode
+ 302 : : ) public virtual override returns (uint256) {
+ 303 : 1006 : return
+ 304 : 1006 : BorrowLogic.executeRepay(
+ 305 : : _reserves,
+ 306 : : _reservesList,
+ 307 : : _usersConfig[msg.sender],
+ 308 : : DataTypes.ExecuteRepayParams({
+ 309 : : asset: asset,
+ 310 : : amount: amount,
+ 311 : : interestRateMode: DataTypes.InterestRateMode(interestRateMode),
+ 312 : : onBehalfOf: msg.sender,
+ 313 : : useATokens: true
+ 314 : : })
+ 315 : : );
+ 316 : : }
+ 317 : :
+ 318 : : /// @inheritdoc IPool
+ 319 : : function setUserUseReserveAsCollateral(
+ 320 : : address asset,
+ 321 : : bool useAsCollateral
+ 322 : : ) public virtual override {
+ 323 : 43 : SupplyLogic.executeUseReserveAsCollateral(
+ 324 : : _reserves,
+ 325 : : _reservesList,
+ 326 : : _eModeCategories,
+ 327 : : _usersConfig[msg.sender],
+ 328 : : asset,
+ 329 : : useAsCollateral,
+ 330 : : _reservesCount,
+ 331 : : ADDRESSES_PROVIDER.getPriceOracle(),
+ 332 : : _usersEModeCategory[msg.sender]
+ 333 : : );
+ 334 : : }
+ 335 : :
+ 336 : : /// @inheritdoc IPool
+ 337 : : function liquidationCall(
+ 338 : : address collateralAsset,
+ 339 : : address debtAsset,
+ 340 : : address user,
+ 341 : : uint256 debtToCover,
+ 342 : : bool receiveAToken
+ 343 : : ) public virtual override {
+ 344 : 14501 : LiquidationLogic.executeLiquidationCall(
+ 345 : : _reserves,
+ 346 : : _reservesList,
+ 347 : : _usersConfig,
+ 348 : : _eModeCategories,
+ 349 : : DataTypes.ExecuteLiquidationCallParams({
+ 350 : : reservesCount: _reservesCount,
+ 351 : : debtToCover: debtToCover,
+ 352 : : collateralAsset: collateralAsset,
+ 353 : : debtAsset: debtAsset,
+ 354 : : user: user,
+ 355 : : receiveAToken: receiveAToken,
+ 356 : : priceOracle: ADDRESSES_PROVIDER.getPriceOracle(),
+ 357 : : userEModeCategory: _usersEModeCategory[user],
+ 358 : : priceOracleSentinel: ADDRESSES_PROVIDER.getPriceOracleSentinel()
+ 359 : : })
+ 360 : : );
+ 361 : : }
+ 362 : :
+ 363 : : /// @inheritdoc IPool
+ 364 : : function flashLoan(
+ 365 : : address receiverAddress,
+ 366 : : address[] calldata assets,
+ 367 : : uint256[] calldata amounts,
+ 368 : : uint256[] calldata interestRateModes,
+ 369 : : address onBehalfOf,
+ 370 : : bytes calldata params,
+ 371 : : uint16 referralCode
372 : : ) public virtual override {
- 373 : 22584 : LiquidationLogic.executeLiquidationCall(
- 374 : : _reserves,
- 375 : : _reservesList,
- 376 : : _usersConfig,
- 377 : : _eModeCategories,
- 378 : : DataTypes.ExecuteLiquidationCallParams({
- 379 : : reservesCount: _reservesCount,
- 380 : : debtToCover: debtToCover,
- 381 : : collateralAsset: collateralAsset,
- 382 : : debtAsset: debtAsset,
- 383 : : user: user,
- 384 : : receiveAToken: receiveAToken,
- 385 : : priceOracle: ADDRESSES_PROVIDER.getPriceOracle(),
- 386 : : userEModeCategory: _usersEModeCategory[user],
- 387 : : priceOracleSentinel: ADDRESSES_PROVIDER.getPriceOracleSentinel()
- 388 : : })
- 389 : : );
- 390 : : }
+ 373 : 1011 : DataTypes.FlashloanParams memory flashParams = DataTypes.FlashloanParams({
+ 374 : : receiverAddress: receiverAddress,
+ 375 : : assets: assets,
+ 376 : : amounts: amounts,
+ 377 : : interestRateModes: interestRateModes,
+ 378 : : onBehalfOf: onBehalfOf,
+ 379 : : params: params,
+ 380 : : referralCode: referralCode,
+ 381 : : flashLoanPremiumToProtocol: _flashLoanPremiumToProtocol,
+ 382 : : flashLoanPremiumTotal: _flashLoanPremiumTotal,
+ 383 : : reservesCount: _reservesCount,
+ 384 : : addressesProvider: address(ADDRESSES_PROVIDER),
+ 385 : : pool: address(this),
+ 386 : : userEModeCategory: _usersEModeCategory[onBehalfOf],
+ 387 : : isAuthorizedFlashBorrower: IACLManager(ADDRESSES_PROVIDER.getACLManager()).isFlashBorrower(
+ 388 : : msg.sender
+ 389 : : )
+ 390 : : });
391 : :
- 392 : : /// @inheritdoc IPool
- 393 : 10 : function flashLoan(
- 394 : : address receiverAddress,
- 395 : : address[] calldata assets,
- 396 : : uint256[] calldata amounts,
- 397 : : uint256[] calldata interestRateModes,
- 398 : : address onBehalfOf,
- 399 : : bytes calldata params,
- 400 : : uint16 referralCode
- 401 : : ) public virtual override {
- 402 : 30 : DataTypes.FlashloanParams memory flashParams = DataTypes.FlashloanParams({
- 403 : : receiverAddress: receiverAddress,
- 404 : : assets: assets,
- 405 : : amounts: amounts,
- 406 : : interestRateModes: interestRateModes,
- 407 : : onBehalfOf: onBehalfOf,
- 408 : : params: params,
- 409 : : referralCode: referralCode,
- 410 : : flashLoanPremiumToProtocol: _flashLoanPremiumToProtocol,
- 411 : : flashLoanPremiumTotal: _flashLoanPremiumTotal,
- 412 : : maxStableRateBorrowSizePercent: _maxStableRateBorrowSizePercent,
- 413 : : reservesCount: _reservesCount,
- 414 : : addressesProvider: address(ADDRESSES_PROVIDER),
- 415 : : pool: address(this),
- 416 : : userEModeCategory: _usersEModeCategory[onBehalfOf],
- 417 : : isAuthorizedFlashBorrower: IACLManager(ADDRESSES_PROVIDER.getACLManager()).isFlashBorrower(
- 418 : : msg.sender
- 419 : : )
- 420 : : });
- 421 : :
- 422 : 20 : FlashLoanLogic.executeFlashLoan(
- 423 : : _reserves,
- 424 : : _reservesList,
- 425 : : _eModeCategories,
- 426 : : _usersConfig[onBehalfOf],
- 427 : : flashParams
- 428 : : );
- 429 : : }
- 430 : :
- 431 : : /// @inheritdoc IPool
- 432 : 10 : function flashLoanSimple(
- 433 : : address receiverAddress,
- 434 : : address asset,
- 435 : : uint256 amount,
- 436 : : bytes calldata params,
- 437 : : uint16 referralCode
- 438 : : ) public virtual override {
- 439 : 30 : DataTypes.FlashloanSimpleParams memory flashParams = DataTypes.FlashloanSimpleParams({
- 440 : : receiverAddress: receiverAddress,
- 441 : : asset: asset,
- 442 : : amount: amount,
- 443 : : params: params,
- 444 : : referralCode: referralCode,
- 445 : : flashLoanPremiumToProtocol: _flashLoanPremiumToProtocol,
- 446 : : flashLoanPremiumTotal: _flashLoanPremiumTotal
- 447 : : });
- 448 : 20 : FlashLoanLogic.executeFlashLoanSimple(_reserves[asset], flashParams);
- 449 : : }
- 450 : :
- 451 : : /// @inheritdoc IPool
- 452 : 4 : function mintToTreasury(address[] calldata assets) external virtual override {
- 453 : 8 : PoolLogic.executeMintToTreasury(_reserves, assets);
+ 392 : 1011 : FlashLoanLogic.executeFlashLoan(
+ 393 : : _reserves,
+ 394 : : _reservesList,
+ 395 : : _eModeCategories,
+ 396 : : _usersConfig[onBehalfOf],
+ 397 : : flashParams
+ 398 : : );
+ 399 : : }
+ 400 : :
+ 401 : : /// @inheritdoc IPool
+ 402 : : function flashLoanSimple(
+ 403 : : address receiverAddress,
+ 404 : : address asset,
+ 405 : : uint256 amount,
+ 406 : : bytes calldata params,
+ 407 : : uint16 referralCode
+ 408 : : ) public virtual override {
+ 409 : 11 : DataTypes.FlashloanSimpleParams memory flashParams = DataTypes.FlashloanSimpleParams({
+ 410 : : receiverAddress: receiverAddress,
+ 411 : : asset: asset,
+ 412 : : amount: amount,
+ 413 : : params: params,
+ 414 : : referralCode: referralCode,
+ 415 : : flashLoanPremiumToProtocol: _flashLoanPremiumToProtocol,
+ 416 : : flashLoanPremiumTotal: _flashLoanPremiumTotal
+ 417 : : });
+ 418 : 11 : FlashLoanLogic.executeFlashLoanSimple(_reserves[asset], flashParams);
+ 419 : : }
+ 420 : :
+ 421 : : /// @inheritdoc IPool
+ 422 : : function mintToTreasury(address[] calldata assets) external virtual override {
+ 423 : 4 : PoolLogic.executeMintToTreasury(_reserves, assets);
+ 424 : : }
+ 425 : :
+ 426 : : /// @inheritdoc IPool
+ 427 : : function getReserveDataExtended(
+ 428 : : address asset
+ 429 : : ) external view returns (DataTypes.ReserveData memory) {
+ 430 : 6011 : return _reserves[asset];
+ 431 : : }
+ 432 : :
+ 433 : : /// @inheritdoc IPool
+ 434 : : function getReserveData(
+ 435 : : address asset
+ 436 : : ) external view virtual override returns (DataTypes.ReserveDataLegacy memory) {
+ 437 : 83030 : DataTypes.ReserveData memory reserve = _reserves[asset];
+ 438 : 83030 : DataTypes.ReserveDataLegacy memory res;
+ 439 : :
+ 440 : 83030 : res.configuration = reserve.configuration;
+ 441 : 83030 : res.liquidityIndex = reserve.liquidityIndex;
+ 442 : 83030 : res.currentLiquidityRate = reserve.currentLiquidityRate;
+ 443 : 83030 : res.variableBorrowIndex = reserve.variableBorrowIndex;
+ 444 : 83030 : res.currentVariableBorrowRate = reserve.currentVariableBorrowRate;
+ 445 : 83030 : res.lastUpdateTimestamp = reserve.lastUpdateTimestamp;
+ 446 : 83030 : res.id = reserve.id;
+ 447 : 83030 : res.aTokenAddress = reserve.aTokenAddress;
+ 448 : 83030 : res.variableDebtTokenAddress = reserve.variableDebtTokenAddress;
+ 449 : 83030 : res.interestRateStrategyAddress = reserve.interestRateStrategyAddress;
+ 450 : 83030 : res.accruedToTreasury = reserve.accruedToTreasury;
+ 451 : 83030 : res.unbacked = reserve.unbacked;
+ 452 : 83030 : res.isolationModeTotalDebt = reserve.isolationModeTotalDebt;
+ 453 : 83030 : return res;
454 : : }
455 : :
456 : : /// @inheritdoc IPool
- 457 : 6 : function getReserveDataExtended(
+ 457 : : function getVirtualUnderlyingBalance(
458 : : address asset
- 459 : : ) external view returns (DataTypes.ReserveData memory) {
- 460 : 12 : return _reserves[asset];
+ 459 : : ) external view virtual override returns (uint128) {
+ 460 : 8111 : return _reserves[asset].virtualUnderlyingBalance;
461 : : }
462 : :
463 : : /// @inheritdoc IPool
- 464 : 22204 : function getReserveData(
- 465 : : address asset
- 466 : : ) external view virtual override returns (DataTypes.ReserveDataLegacy memory) {
- 467 : 44408 : DataTypes.ReserveData memory reserve = _reserves[asset];
- 468 : 44408 : DataTypes.ReserveDataLegacy memory res;
- 469 : :
- 470 : 44408 : res.configuration = reserve.configuration;
- 471 : 44408 : res.liquidityIndex = reserve.liquidityIndex;
- 472 : 44408 : res.currentLiquidityRate = reserve.currentLiquidityRate;
- 473 : 44408 : res.variableBorrowIndex = reserve.variableBorrowIndex;
- 474 : 44408 : res.currentVariableBorrowRate = reserve.currentVariableBorrowRate;
- 475 : 44408 : res.currentStableBorrowRate = reserve.currentStableBorrowRate;
- 476 : 44408 : res.lastUpdateTimestamp = reserve.lastUpdateTimestamp;
- 477 : 44408 : res.id = reserve.id;
- 478 : 44408 : res.aTokenAddress = reserve.aTokenAddress;
- 479 : 44408 : res.stableDebtTokenAddress = reserve.stableDebtTokenAddress;
- 480 : 44408 : res.variableDebtTokenAddress = reserve.variableDebtTokenAddress;
- 481 : 44408 : res.interestRateStrategyAddress = reserve.interestRateStrategyAddress;
- 482 : 44408 : res.accruedToTreasury = reserve.accruedToTreasury;
- 483 : 44408 : res.unbacked = reserve.unbacked;
- 484 : 44408 : res.isolationModeTotalDebt = reserve.isolationModeTotalDebt;
- 485 : 44408 : return res;
- 486 : : }
- 487 : :
- 488 : : /// @inheritdoc IPool
- 489 : 6030 : function getVirtualUnderlyingBalance(
- 490 : : address asset
- 491 : : ) external view virtual override returns (uint128) {
- 492 : 12060 : return _reserves[asset].virtualUnderlyingBalance;
+ 464 : : function getUserAccountData(
+ 465 : : address user
+ 466 : : )
+ 467 : : external
+ 468 : : view
+ 469 : : virtual
+ 470 : : override
+ 471 : : returns (
+ 472 : : uint256 totalCollateralBase,
+ 473 : : uint256 totalDebtBase,
+ 474 : : uint256 availableBorrowsBase,
+ 475 : : uint256 currentLiquidationThreshold,
+ 476 : : uint256 ltv,
+ 477 : : uint256 healthFactor
+ 478 : : )
+ 479 : : {
+ 480 : 10015 : return
+ 481 : 10015 : PoolLogic.executeGetUserAccountData(
+ 482 : : _reserves,
+ 483 : : _reservesList,
+ 484 : : _eModeCategories,
+ 485 : : DataTypes.CalculateUserAccountDataParams({
+ 486 : : userConfig: _usersConfig[user],
+ 487 : : reservesCount: _reservesCount,
+ 488 : : user: user,
+ 489 : : oracle: ADDRESSES_PROVIDER.getPriceOracle(),
+ 490 : : userEModeCategory: _usersEModeCategory[user]
+ 491 : : })
+ 492 : : );
493 : : }
494 : :
495 : : /// @inheritdoc IPool
- 496 : 3013 : function getUserAccountData(
- 497 : : address user
- 498 : : )
- 499 : : external
- 500 : : view
- 501 : : virtual
- 502 : : override
- 503 : : returns (
- 504 : : uint256 totalCollateralBase,
- 505 : : uint256 totalDebtBase,
- 506 : : uint256 availableBorrowsBase,
- 507 : : uint256 currentLiquidationThreshold,
- 508 : : uint256 ltv,
- 509 : : uint256 healthFactor
- 510 : : )
- 511 : : {
- 512 : 6026 : return
- 513 : 6026 : PoolLogic.executeGetUserAccountData(
- 514 : : _reserves,
- 515 : : _reservesList,
- 516 : : _eModeCategories,
- 517 : : DataTypes.CalculateUserAccountDataParams({
- 518 : : userConfig: _usersConfig[user],
- 519 : : reservesCount: _reservesCount,
- 520 : : user: user,
- 521 : : oracle: ADDRESSES_PROVIDER.getPriceOracle(),
- 522 : : userEModeCategory: _usersEModeCategory[user]
- 523 : : })
- 524 : : );
- 525 : : }
- 526 : :
- 527 : : /// @inheritdoc IPool
- 528 : 41450 : function getConfiguration(
- 529 : : address asset
- 530 : : ) external view virtual override returns (DataTypes.ReserveConfigurationMap memory) {
- 531 : 82900 : return _reserves[asset].configuration;
- 532 : : }
- 533 : :
- 534 : : /// @inheritdoc IPool
- 535 : 6030 : function getUserConfiguration(
- 536 : : address user
- 537 : : ) external view virtual override returns (DataTypes.UserConfigurationMap memory) {
- 538 : 12060 : return _usersConfig[user];
- 539 : : }
- 540 : :
- 541 : : /// @inheritdoc IPool
- 542 : 31404 : function getReserveNormalizedIncome(
- 543 : : address asset
- 544 : : ) external view virtual override returns (uint256) {
- 545 : 94212 : return _reserves[asset].getNormalizedIncome();
- 546 : : }
- 547 : :
- 548 : : /// @inheritdoc IPool
- 549 : 25218 : function getReserveNormalizedVariableDebt(
- 550 : : address asset
- 551 : : ) external view virtual override returns (uint256) {
- 552 : 75654 : return _reserves[asset].getNormalizedDebt();
- 553 : : }
- 554 : :
- 555 : : /// @inheritdoc IPool
- 556 : 6043 : function getReservesList() external view virtual override returns (address[] memory) {
- 557 : 12086 : uint256 reservesListCount = _reservesCount;
- 558 : 12086 : uint256 droppedReservesCount = 0;
- 559 : 18129 : address[] memory reservesList = new address[](reservesListCount);
- 560 : :
- 561 : 56395 : for (uint256 i = 0; i < reservesListCount; i++) {
- 562 : 57399 : if (_reservesList[i] != address(0)) {
- 563 : 38264 : reservesList[i - droppedReservesCount] = _reservesList[i];
- 564 : : } else {
- 565 : 2 : droppedReservesCount++;
- 566 : : }
- 567 : : }
+ 496 : : function getConfiguration(
+ 497 : : address asset
+ 498 : : ) external view virtual override returns (DataTypes.ReserveConfigurationMap memory) {
+ 499 : 162047 : return _reserves[asset].configuration;
+ 500 : : }
+ 501 : :
+ 502 : : /// @inheritdoc IPool
+ 503 : : function getUserConfiguration(
+ 504 : : address user
+ 505 : : ) external view virtual override returns (DataTypes.UserConfigurationMap memory) {
+ 506 : 7029 : return _usersConfig[user];
+ 507 : : }
+ 508 : :
+ 509 : : /// @inheritdoc IPool
+ 510 : : function getReserveNormalizedIncome(
+ 511 : : address asset
+ 512 : : ) external view virtual override returns (uint256) {
+ 513 : 115423 : return _reserves[asset].getNormalizedIncome();
+ 514 : : }
+ 515 : :
+ 516 : : /// @inheritdoc IPool
+ 517 : : function getReserveNormalizedVariableDebt(
+ 518 : : address asset
+ 519 : : ) external view virtual override returns (uint256) {
+ 520 : 29583 : return _reserves[asset].getNormalizedDebt();
+ 521 : : }
+ 522 : :
+ 523 : : /// @inheritdoc IPool
+ 524 : : function getReservesList() external view virtual override returns (address[] memory) {
+ 525 : 16076 : uint256 reservesListCount = _reservesCount;
+ 526 : 16076 : uint256 droppedReservesCount = 0;
+ 527 : 16076 : address[] memory reservesList = new address[](reservesListCount);
+ 528 : :
+ 529 : 16076 : for (uint256 i = 0; i < reservesListCount; i++) {
+ 530 : 82300 : if (_reservesList[i] != address(0)) {
+ 531 : 82299 : reservesList[i - droppedReservesCount] = _reservesList[i];
+ 532 : : } else {
+ 533 : 1 : droppedReservesCount++;
+ 534 : : }
+ 535 : : }
+ 536 : :
+ 537 : : // Reduces the length of the reserves array by `droppedReservesCount`
+ 538 : : assembly {
+ 539 : 16076 : mstore(reservesList, sub(reservesListCount, droppedReservesCount))
+ 540 : : }
+ 541 : 16076 : return reservesList;
+ 542 : : }
+ 543 : :
+ 544 : : /// @inheritdoc IPool
+ 545 : : function getReservesCount() external view virtual override returns (uint256) {
+ 546 : 2 : return _reservesCount;
+ 547 : : }
+ 548 : :
+ 549 : : /// @inheritdoc IPool
+ 550 : : function getReserveAddressById(uint16 id) external view returns (address) {
+ 551 : 1 : return _reservesList[id];
+ 552 : : }
+ 553 : :
+ 554 : : /// @inheritdoc IPool
+ 555 : : function BRIDGE_PROTOCOL_FEE() public view virtual override returns (uint256) {
+ 556 : 25 : return _bridgeProtocolFee;
+ 557 : : }
+ 558 : :
+ 559 : : /// @inheritdoc IPool
+ 560 : : function FLASHLOAN_PREMIUM_TOTAL() public view virtual override returns (uint128) {
+ 561 : 1368 : return _flashLoanPremiumTotal;
+ 562 : : }
+ 563 : :
+ 564 : : /// @inheritdoc IPool
+ 565 : : function FLASHLOAN_PREMIUM_TO_PROTOCOL() public view virtual override returns (uint128) {
+ 566 : 1365 : return _flashLoanPremiumToProtocol;
+ 567 : : }
568 : :
- 569 : : // Reduces the length of the reserves array by `droppedReservesCount`
- 570 : : assembly {
- 571 : : mstore(reservesList, sub(reservesListCount, droppedReservesCount))
- 572 : : }
- 573 : 12086 : return reservesList;
- 574 : : }
- 575 : :
- 576 : : /// @inheritdoc IPool
- 577 : 1 : function getReservesCount() external view virtual override returns (uint256) {
- 578 : 2 : return _reservesCount;
- 579 : : }
- 580 : :
- 581 : : /// @inheritdoc IPool
- 582 : 1 : function getReserveAddressById(uint16 id) external view returns (address) {
- 583 : 2 : return _reservesList[id];
- 584 : : }
- 585 : :
- 586 : : /// @inheritdoc IPool
- 587 : 3 : function MAX_STABLE_RATE_BORROW_SIZE_PERCENT() public view virtual override returns (uint256) {
- 588 : 6 : return _maxStableRateBorrowSizePercent;
- 589 : : }
- 590 : :
- 591 : : /// @inheritdoc IPool
- 592 : 25 : function BRIDGE_PROTOCOL_FEE() public view virtual override returns (uint256) {
- 593 : 50 : return _bridgeProtocolFee;
- 594 : : }
- 595 : :
- 596 : : /// @inheritdoc IPool
- 597 : 1218 : function FLASHLOAN_PREMIUM_TOTAL() public view virtual override returns (uint128) {
- 598 : 2436 : return _flashLoanPremiumTotal;
- 599 : : }
- 600 : :
- 601 : : /// @inheritdoc IPool
- 602 : 1215 : function FLASHLOAN_PREMIUM_TO_PROTOCOL() public view virtual override returns (uint128) {
- 603 : 2430 : return _flashLoanPremiumToProtocol;
- 604 : : }
- 605 : :
- 606 : : /// @inheritdoc IPool
- 607 : 3 : function MAX_NUMBER_RESERVES() public view virtual override returns (uint16) {
- 608 : 5770 : return ReserveConfiguration.MAX_RESERVES_COUNT;
- 609 : : }
- 610 : :
- 611 : : /// @inheritdoc IPool
- 612 : 1036 : function finalizeTransfer(
- 613 : : address asset,
- 614 : : address from,
- 615 : : address to,
- 616 : : uint256 amount,
- 617 : : uint256 balanceFromBefore,
- 618 : : uint256 balanceToBefore
- 619 : : ) external virtual override {
- 620 : 2072 : require(msg.sender == _reserves[asset].aTokenAddress, Errors.CALLER_NOT_ATOKEN);
- 621 : 2072 : SupplyLogic.executeFinalizeTransfer(
- 622 : : _reserves,
- 623 : : _reservesList,
- 624 : : _eModeCategories,
- 625 : : _usersConfig,
- 626 : : DataTypes.FinalizeTransferParams({
- 627 : : asset: asset,
- 628 : : from: from,
- 629 : : to: to,
- 630 : : amount: amount,
- 631 : : balanceFromBefore: balanceFromBefore,
- 632 : : balanceToBefore: balanceToBefore,
- 633 : : reservesCount: _reservesCount,
- 634 : : oracle: ADDRESSES_PROVIDER.getPriceOracle(),
- 635 : : fromEModeCategory: _usersEModeCategory[from]
- 636 : : })
- 637 : : );
- 638 : : }
- 639 : :
- 640 : : /// @inheritdoc IPool
- 641 : 6882 : function initReserve(
- 642 : : address asset,
- 643 : : address aTokenAddress,
- 644 : : address stableDebtAddress,
- 645 : : address variableDebtAddress,
- 646 : : address interestRateStrategyAddress
- 647 : : ) external virtual override onlyPoolConfigurator {
- 648 : : if (
- 649 : 5764 : PoolLogic.executeInitReserve(
- 650 : : _reserves,
- 651 : : _reservesList,
- 652 : : DataTypes.InitReserveParams({
- 653 : : asset: asset,
- 654 : : aTokenAddress: aTokenAddress,
- 655 : : stableDebtAddress: stableDebtAddress,
- 656 : : variableDebtAddress: variableDebtAddress,
- 657 : : interestRateStrategyAddress: interestRateStrategyAddress,
- 658 : : reservesCount: _reservesCount,
- 659 : : maxNumberReserves: MAX_NUMBER_RESERVES()
- 660 : : })
- 661 : : )
- 662 : : ) {
- 663 : 5762 : _reservesCount++;
- 664 : : }
- 665 : : }
- 666 : :
- 667 : : /// @inheritdoc IPool
- 668 : 2007 : function dropReserve(address asset) external virtual override onlyPoolConfigurator {
- 669 : 14 : PoolLogic.executeDropReserve(_reserves, _reservesList, asset);
- 670 : : }
- 671 : :
- 672 : : /// @inheritdoc IPool
- 673 : 6006 : function setReserveInterestRateStrategyAddress(
- 674 : : address asset,
- 675 : : address rateStrategyAddress
- 676 : : ) external virtual override onlyPoolConfigurator {
- 677 : 8012 : require(asset != address(0), Errors.ZERO_ADDRESS_NOT_VALID);
- 678 : 4012 : require(_reserves[asset].id != 0 || _reservesList[0] == asset, Errors.ASSET_NOT_LISTED);
- 679 : :
- 680 : 12 : _reserves[asset].interestRateStrategyAddress = rateStrategyAddress;
- 681 : : }
- 682 : :
- 683 : : /// @inheritdoc IPool
- 684 : 1751 : function syncIndexesState(address asset) external virtual override onlyPoolConfigurator {
- 685 : 3502 : DataTypes.ReserveData storage reserve = _reserves[asset];
- 686 : 5253 : DataTypes.ReserveCache memory reserveCache = reserve.cache();
- 687 : :
- 688 : 3502 : reserve.updateState(reserveCache);
- 689 : : }
- 690 : :
- 691 : : /// @inheritdoc IPool
- 692 : 1751 : function syncRatesState(address asset) external virtual override onlyPoolConfigurator {
- 693 : 3502 : DataTypes.ReserveData storage reserve = _reserves[asset];
- 694 : 5253 : DataTypes.ReserveCache memory reserveCache = reserve.cache();
- 695 : :
- 696 : 3502 : ReserveLogic.updateInterestRatesAndVirtualBalance(reserve, reserveCache, asset, 0, 0);
+ 569 : : /// @inheritdoc IPool
+ 570 : : function MAX_NUMBER_RESERVES() public view virtual override returns (uint16) {
+ 571 : 168018 : return ReserveConfiguration.MAX_RESERVES_COUNT;
+ 572 : : }
+ 573 : :
+ 574 : : /// @inheritdoc IPool
+ 575 : : function finalizeTransfer(
+ 576 : : address asset,
+ 577 : : address from,
+ 578 : : address to,
+ 579 : : uint256 amount,
+ 580 : : uint256 balanceFromBefore,
+ 581 : : uint256 balanceToBefore
+ 582 : : ) external virtual override {
+ 583 : 17042 : require(msg.sender == _reserves[asset].aTokenAddress, Errors.CALLER_NOT_ATOKEN);
+ 584 : 17042 : SupplyLogic.executeFinalizeTransfer(
+ 585 : : _reserves,
+ 586 : : _reservesList,
+ 587 : : _eModeCategories,
+ 588 : : _usersConfig,
+ 589 : : DataTypes.FinalizeTransferParams({
+ 590 : : asset: asset,
+ 591 : : from: from,
+ 592 : : to: to,
+ 593 : : amount: amount,
+ 594 : : balanceFromBefore: balanceFromBefore,
+ 595 : : balanceToBefore: balanceToBefore,
+ 596 : : reservesCount: _reservesCount,
+ 597 : : oracle: ADDRESSES_PROVIDER.getPriceOracle(),
+ 598 : : fromEModeCategory: _usersEModeCategory[from]
+ 599 : : })
+ 600 : : );
+ 601 : : }
+ 602 : :
+ 603 : : /// @inheritdoc IPool
+ 604 : : function initReserve(
+ 605 : : address asset,
+ 606 : : address aTokenAddress,
+ 607 : : address variableDebtAddress,
+ 608 : : address interestRateStrategyAddress
+ 609 : : ) external virtual override onlyPoolConfigurator {
+ 610 : : if (
+ 611 : 166016 : PoolLogic.executeInitReserve(
+ 612 : : _reserves,
+ 613 : : _reservesList,
+ 614 : : DataTypes.InitReserveParams({
+ 615 : : asset: asset,
+ 616 : : aTokenAddress: aTokenAddress,
+ 617 : : variableDebtAddress: variableDebtAddress,
+ 618 : : interestRateStrategyAddress: interestRateStrategyAddress,
+ 619 : : reservesCount: _reservesCount,
+ 620 : : maxNumberReserves: MAX_NUMBER_RESERVES()
+ 621 : : })
+ 622 : : )
+ 623 : : ) {
+ 624 : 165016 : _reservesCount++;
+ 625 : : }
+ 626 : : }
+ 627 : :
+ 628 : : /// @inheritdoc IPool
+ 629 : : function dropReserve(address asset) external virtual override onlyPoolConfigurator {
+ 630 : 7 : PoolLogic.executeDropReserve(_reserves, _reservesList, asset);
+ 631 : : }
+ 632 : :
+ 633 : : /// @inheritdoc IPool
+ 634 : : function setReserveInterestRateStrategyAddress(
+ 635 : : address asset,
+ 636 : : address rateStrategyAddress
+ 637 : : ) external virtual override onlyPoolConfigurator {
+ 638 : 4046 : require(asset != address(0), Errors.ZERO_ADDRESS_NOT_VALID);
+ 639 : 2046 : require(_reserves[asset].id != 0 || _reservesList[0] == asset, Errors.ASSET_NOT_LISTED);
+ 640 : :
+ 641 : 46 : _reserves[asset].interestRateStrategyAddress = rateStrategyAddress;
+ 642 : : }
+ 643 : :
+ 644 : : /// @inheritdoc IPool
+ 645 : : function syncIndexesState(address asset) external virtual override onlyPoolConfigurator {
+ 646 : 1994 : DataTypes.ReserveData storage reserve = _reserves[asset];
+ 647 : 1994 : DataTypes.ReserveCache memory reserveCache = reserve.cache();
+ 648 : :
+ 649 : 1994 : reserve.updateState(reserveCache);
+ 650 : : }
+ 651 : :
+ 652 : : /// @inheritdoc IPool
+ 653 : : function syncRatesState(address asset) external virtual override onlyPoolConfigurator {
+ 654 : 1994 : DataTypes.ReserveData storage reserve = _reserves[asset];
+ 655 : 1994 : DataTypes.ReserveCache memory reserveCache = reserve.cache();
+ 656 : :
+ 657 : 1994 : ReserveLogic.updateInterestRatesAndVirtualBalance(reserve, reserveCache, asset, 0, 0);
+ 658 : : }
+ 659 : :
+ 660 : : /// @inheritdoc IPool
+ 661 : : function setConfiguration(
+ 662 : : address asset,
+ 663 : : DataTypes.ReserveConfigurationMap calldata configuration
+ 664 : : ) external virtual override onlyPoolConfigurator {
+ 665 : 208599 : require(asset != address(0), Errors.ZERO_ADDRESS_NOT_VALID);
+ 666 : 208599 : require(_reserves[asset].id != 0 || _reservesList[0] == asset, Errors.ASSET_NOT_LISTED);
+ 667 : 208599 : _reserves[asset].configuration = configuration;
+ 668 : : }
+ 669 : :
+ 670 : : /// @inheritdoc IPool
+ 671 : : function updateBridgeProtocolFee(
+ 672 : : uint256 protocolFee
+ 673 : : ) external virtual override onlyPoolConfigurator {
+ 674 : 13 : _bridgeProtocolFee = protocolFee;
+ 675 : : }
+ 676 : :
+ 677 : : /// @inheritdoc IPool
+ 678 : : function updateFlashloanPremiums(
+ 679 : : uint128 flashLoanPremiumTotal,
+ 680 : : uint128 flashLoanPremiumToProtocol
+ 681 : : ) external virtual override onlyPoolConfigurator {
+ 682 : 1362 : _flashLoanPremiumTotal = flashLoanPremiumTotal;
+ 683 : 1362 : _flashLoanPremiumToProtocol = flashLoanPremiumToProtocol;
+ 684 : : }
+ 685 : :
+ 686 : : /// @inheritdoc IPool
+ 687 : : function configureEModeCategory(
+ 688 : : uint8 id,
+ 689 : : DataTypes.EModeCategoryBaseConfiguration memory category
+ 690 : : ) external virtual override onlyPoolConfigurator {
+ 691 : : // category 0 is reserved for volatile heterogeneous assets and it's always disabled
+ 692 : 10029 : require(id != 0, Errors.EMODE_CATEGORY_RESERVED);
+ 693 : 10029 : _eModeCategories[id].ltv = category.ltv;
+ 694 : 10029 : _eModeCategories[id].liquidationThreshold = category.liquidationThreshold;
+ 695 : 10029 : _eModeCategories[id].liquidationBonus = category.liquidationBonus;
+ 696 : 10029 : _eModeCategories[id].label = category.label;
697 : : }
698 : :
699 : : /// @inheritdoc IPool
- 700 : 38058 : function setConfiguration(
- 701 : : address asset,
- 702 : : DataTypes.ReserveConfigurationMap calldata configuration
+ 700 : : function configureEModeCategoryCollateralBitmap(
+ 701 : : uint8 id,
+ 702 : : uint128 collateralBitmap
703 : : ) external virtual override onlyPoolConfigurator {
- 704 : 72116 : require(asset != address(0), Errors.ZERO_ADDRESS_NOT_VALID);
- 705 : 72116 : require(_reserves[asset].id != 0 || _reservesList[0] == asset, Errors.ASSET_NOT_LISTED);
- 706 : 72116 : _reserves[asset].configuration = configuration;
+ 704 : : // category 0 is reserved for volatile heterogeneous assets and it's always disabled
+ 705 : 10039 : require(id != 0, Errors.EMODE_CATEGORY_RESERVED);
+ 706 : 10039 : _eModeCategories[id].collateralBitmap = collateralBitmap;
707 : : }
708 : :
709 : : /// @inheritdoc IPool
- 710 : 2013 : function updateBridgeProtocolFee(
- 711 : : uint256 protocolFee
- 712 : : ) external virtual override onlyPoolConfigurator {
- 713 : 26 : _bridgeProtocolFee = protocolFee;
- 714 : : }
- 715 : :
- 716 : : /// @inheritdoc IPool
- 717 : 3212 : function updateFlashloanPremiums(
- 718 : : uint128 flashLoanPremiumTotal,
- 719 : : uint128 flashLoanPremiumToProtocol
- 720 : : ) external virtual override onlyPoolConfigurator {
- 721 : 2424 : _flashLoanPremiumTotal = flashLoanPremiumTotal;
- 722 : 2424 : _flashLoanPremiumToProtocol = flashLoanPremiumToProtocol;
- 723 : : }
- 724 : :
- 725 : : /// @inheritdoc IPool
- 726 : 2027 : function configureEModeCategory(
- 727 : : uint8 id,
- 728 : : DataTypes.EModeCategory memory category
- 729 : : ) external virtual override onlyPoolConfigurator {
- 730 : : // category 0 is reserved for volatile heterogeneous assets and it's always disabled
- 731 : 54 : require(id != 0, Errors.EMODE_CATEGORY_RESERVED);
- 732 : 54 : _eModeCategories[id] = category;
- 733 : : }
- 734 : :
- 735 : : /// @inheritdoc IPool
- 736 : 46 : function getEModeCategoryData(
- 737 : : uint8 id
- 738 : : ) external view virtual override returns (DataTypes.EModeCategory memory) {
- 739 : 92 : return _eModeCategories[id];
- 740 : : }
- 741 : :
- 742 : : /// @inheritdoc IPool
- 743 : 17 : function setUserEMode(uint8 categoryId) external virtual override {
- 744 : 34 : EModeLogic.executeSetUserEMode(
- 745 : : _reserves,
- 746 : : _reservesList,
- 747 : : _eModeCategories,
- 748 : : _usersEModeCategory,
- 749 : : _usersConfig[msg.sender],
- 750 : : DataTypes.ExecuteSetUserEModeParams({
- 751 : : reservesCount: _reservesCount,
- 752 : : oracle: ADDRESSES_PROVIDER.getPriceOracle(),
- 753 : : categoryId: categoryId
- 754 : : })
- 755 : : );
- 756 : : }
- 757 : :
- 758 : : /// @inheritdoc IPool
- 759 : 3012 : function getUserEMode(address user) external view virtual override returns (uint256) {
- 760 : 6024 : return _usersEModeCategory[user];
- 761 : : }
- 762 : :
- 763 : : /// @inheritdoc IPool
- 764 : 3751 : function resetIsolationModeTotalDebt(
- 765 : : address asset
- 766 : : ) external virtual override onlyPoolConfigurator {
- 767 : 3502 : PoolLogic.executeResetIsolationModeTotalDebt(_reserves, asset);
- 768 : : }
- 769 : :
- 770 : : /// @inheritdoc IPool
- 771 : 5512 : function getLiquidationGracePeriod(address asset) external virtual override returns (uint40) {
- 772 : 11024 : return _reserves[asset].liquidationGracePeriodUntil;
- 773 : : }
- 774 : :
- 775 : : /// @inheritdoc IPool
- 776 : 13028 : function setLiquidationGracePeriod(
- 777 : : address asset,
- 778 : : uint40 until
- 779 : : ) external virtual override onlyPoolConfigurator {
- 780 : 22056 : require(_reserves[asset].id != 0 || _reservesList[0] == asset, Errors.ASSET_NOT_LISTED);
- 781 : 18056 : PoolLogic.executeSetLiquidationGracePeriod(_reserves, asset, until);
- 782 : : }
- 783 : :
- 784 : : /// @inheritdoc IPool
- 785 : 2000 : function rescueTokens(
- 786 : : address token,
- 787 : : address to,
- 788 : : uint256 amount
- 789 : : ) external virtual override onlyPoolAdmin {
- 790 : 4000 : PoolLogic.executeRescueTokens(token, to, amount);
- 791 : : }
- 792 : :
- 793 : : /// @inheritdoc IPool
- 794 : : /// @dev Deprecated: maintained for compatibility purposes
- 795 : 17 : function deposit(
+ 710 : : function configureEModeCategoryBorrowableBitmap(
+ 711 : : uint8 id,
+ 712 : : uint128 borrowableBitmap
+ 713 : : ) external virtual override onlyPoolConfigurator {
+ 714 : : // category 0 is reserved for volatile heterogeneous assets and it's always disabled
+ 715 : 7010 : require(id != 0, Errors.EMODE_CATEGORY_RESERVED);
+ 716 : 7010 : _eModeCategories[id].borrowableBitmap = borrowableBitmap;
+ 717 : : }
+ 718 : :
+ 719 : : /// @inheritdoc IPool
+ 720 : : function getEModeCategoryData(
+ 721 : : uint8 id
+ 722 : : ) external view virtual override returns (DataTypes.EModeCategoryLegacy memory) {
+ 723 : 3 : DataTypes.EModeCategory memory category = _eModeCategories[id];
+ 724 : 3 : return
+ 725 : : DataTypes.EModeCategoryLegacy({
+ 726 : : ltv: category.ltv,
+ 727 : : liquidationThreshold: category.liquidationThreshold,
+ 728 : : liquidationBonus: category.liquidationBonus,
+ 729 : : priceSource: address(0),
+ 730 : : label: category.label
+ 731 : : });
+ 732 : : }
+ 733 : :
+ 734 : : /// @inheritdoc IPool
+ 735 : : function getEModeCategoryCollateralConfig(
+ 736 : : uint8 id
+ 737 : : ) external view returns (DataTypes.CollateralConfig memory) {
+ 738 : 110 : return
+ 739 : : DataTypes.CollateralConfig({
+ 740 : : ltv: _eModeCategories[id].ltv,
+ 741 : : liquidationThreshold: _eModeCategories[id].liquidationThreshold,
+ 742 : : liquidationBonus: _eModeCategories[id].liquidationBonus
+ 743 : : });
+ 744 : : }
+ 745 : :
+ 746 : : /// @inheritdoc IPool
+ 747 : : function getEModeCategoryLabel(uint8 id) external view returns (string memory) {
+ 748 : 25 : return _eModeCategories[id].label;
+ 749 : : }
+ 750 : :
+ 751 : : /// @inheritdoc IPool
+ 752 : : function getEModeCategoryCollateralBitmap(uint8 id) external view returns (uint128) {
+ 753 : 10064 : return _eModeCategories[id].collateralBitmap;
+ 754 : : }
+ 755 : :
+ 756 : : /// @inheritdoc IPool
+ 757 : : function getEModeCategoryBorrowableBitmap(uint8 id) external view returns (uint128) {
+ 758 : 7035 : return _eModeCategories[id].borrowableBitmap;
+ 759 : : }
+ 760 : :
+ 761 : : /// @inheritdoc IPool
+ 762 : : function setUserEMode(uint8 categoryId) external virtual override {
+ 763 : 10023 : EModeLogic.executeSetUserEMode(
+ 764 : : _reserves,
+ 765 : : _reservesList,
+ 766 : : _eModeCategories,
+ 767 : : _usersEModeCategory,
+ 768 : : _usersConfig[msg.sender],
+ 769 : : DataTypes.ExecuteSetUserEModeParams({
+ 770 : : reservesCount: _reservesCount,
+ 771 : : oracle: ADDRESSES_PROVIDER.getPriceOracle(),
+ 772 : : categoryId: categoryId
+ 773 : : })
+ 774 : : );
+ 775 : : }
+ 776 : :
+ 777 : : /// @inheritdoc IPool
+ 778 : : function getUserEMode(address user) external view virtual override returns (uint256) {
+ 779 : 5016 : return _usersEModeCategory[user];
+ 780 : : }
+ 781 : :
+ 782 : : /// @inheritdoc IPool
+ 783 : : function resetIsolationModeTotalDebt(
+ 784 : : address asset
+ 785 : : ) external virtual override onlyPoolConfigurator {
+ 786 : 1951 : PoolLogic.executeResetIsolationModeTotalDebt(_reserves, asset);
+ 787 : : }
+ 788 : :
+ 789 : : /// @inheritdoc IPool
+ 790 : : function getLiquidationGracePeriod(address asset) external virtual override returns (uint40) {
+ 791 : 8756 : return _reserves[asset].liquidationGracePeriodUntil;
+ 792 : : }
+ 793 : :
+ 794 : : /// @inheritdoc IPool
+ 795 : : function setLiquidationGracePeriod(
796 : : address asset,
- 797 : : uint256 amount,
- 798 : : address onBehalfOf,
- 799 : : uint16 referralCode
- 800 : : ) external virtual override {
- 801 : 34 : SupplyLogic.executeSupply(
- 802 : : _reserves,
- 803 : : _reservesList,
- 804 : : _usersConfig[onBehalfOf],
- 805 : : DataTypes.ExecuteSupplyParams({
- 806 : : asset: asset,
- 807 : : amount: amount,
- 808 : : onBehalfOf: onBehalfOf,
- 809 : : referralCode: referralCode
- 810 : : })
- 811 : : );
- 812 : : }
- 813 : :
- 814 : : /// @inheritdoc IPool
- 815 : 2 : function getFlashLoanLogic() external pure returns (address) {
- 816 : 6 : return address(FlashLoanLogic);
- 817 : : }
- 818 : :
- 819 : : /// @inheritdoc IPool
- 820 : 2 : function getBorrowLogic() external pure returns (address) {
- 821 : 6 : return address(BorrowLogic);
- 822 : : }
- 823 : :
- 824 : : /// @inheritdoc IPool
- 825 : 2 : function getBridgeLogic() external pure returns (address) {
- 826 : 6 : return address(BridgeLogic);
- 827 : : }
- 828 : :
- 829 : : /// @inheritdoc IPool
- 830 : 2 : function getEModeLogic() external pure returns (address) {
- 831 : 6 : return address(EModeLogic);
- 832 : : }
- 833 : :
- 834 : : /// @inheritdoc IPool
- 835 : 2 : function getLiquidationLogic() external pure returns (address) {
- 836 : 6 : return address(LiquidationLogic);
- 837 : : }
- 838 : :
- 839 : : /// @inheritdoc IPool
- 840 : 2 : function getPoolLogic() external pure returns (address) {
- 841 : 6 : return address(PoolLogic);
- 842 : : }
- 843 : :
- 844 : : /// @inheritdoc IPool
- 845 : 2 : function getSupplyLogic() external pure returns (address) {
- 846 : 6 : return address(SupplyLogic);
- 847 : : }
- 848 : : }
+ 797 : : uint40 until
+ 798 : : ) external virtual override onlyPoolConfigurator {
+ 799 : 14412 : require(_reserves[asset].id != 0 || _reservesList[0] == asset, Errors.ASSET_NOT_LISTED);
+ 800 : 12412 : PoolLogic.executeSetLiquidationGracePeriod(_reserves, asset, until);
+ 801 : : }
+ 802 : :
+ 803 : : /// @inheritdoc IPool
+ 804 : : function rescueTokens(
+ 805 : : address token,
+ 806 : : address to,
+ 807 : : uint256 amount
+ 808 : : ) external virtual override onlyPoolAdmin {
+ 809 : 2000 : PoolLogic.executeRescueTokens(token, to, amount);
+ 810 : : }
+ 811 : :
+ 812 : : /// @inheritdoc IPool
+ 813 : : /// @dev Deprecated: maintained for compatibility purposes
+ 814 : : function deposit(
+ 815 : : address asset,
+ 816 : : uint256 amount,
+ 817 : : address onBehalfOf,
+ 818 : : uint16 referralCode
+ 819 : : ) external virtual override {
+ 820 : 20025 : SupplyLogic.executeSupply(
+ 821 : : _reserves,
+ 822 : : _reservesList,
+ 823 : : _usersConfig[onBehalfOf],
+ 824 : : DataTypes.ExecuteSupplyParams({
+ 825 : : asset: asset,
+ 826 : : amount: amount,
+ 827 : : onBehalfOf: onBehalfOf,
+ 828 : : referralCode: referralCode
+ 829 : : })
+ 830 : : );
+ 831 : : }
+ 832 : :
+ 833 : : /// @inheritdoc IPool
+ 834 : : function getFlashLoanLogic() external pure returns (address) {
+ 835 : 2 : return address(FlashLoanLogic);
+ 836 : : }
+ 837 : :
+ 838 : : /// @inheritdoc IPool
+ 839 : : function getBorrowLogic() external pure returns (address) {
+ 840 : 2 : return address(BorrowLogic);
+ 841 : : }
+ 842 : :
+ 843 : : /// @inheritdoc IPool
+ 844 : : function getBridgeLogic() external pure returns (address) {
+ 845 : 2 : return address(BridgeLogic);
+ 846 : : }
+ 847 : :
+ 848 : : /// @inheritdoc IPool
+ 849 : : function getEModeLogic() external pure returns (address) {
+ 850 : 2 : return address(EModeLogic);
+ 851 : : }
+ 852 : :
+ 853 : : /// @inheritdoc IPool
+ 854 : : function getLiquidationLogic() external pure returns (address) {
+ 855 : 2 : return address(LiquidationLogic);
+ 856 : : }
+ 857 : :
+ 858 : : /// @inheritdoc IPool
+ 859 : : function getPoolLogic() external pure returns (address) {
+ 860 : 2 : return address(PoolLogic);
+ 861 : : }
+ 862 : :
+ 863 : : /// @inheritdoc IPool
+ 864 : : function getSupplyLogic() external pure returns (address) {
+ 865 : 2 : return address(SupplyLogic);
+ 866 : : }
+ 867 : : }
@@ -924,8 +943,8 @@
diff --git a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/PoolConfigurator.sol.func-c.html b/report/protocol/pool/PoolConfigurator.sol.func-c.html
similarity index 56%
rename from report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/PoolConfigurator.sol.func-c.html
rename to report/protocol/pool/PoolConfigurator.sol.func-c.html
index 0246f91c..b8fd358e 100644
--- a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/PoolConfigurator.sol.func-c.html
+++ b/report/protocol/pool/PoolConfigurator.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/pool/src/core/contracts/protocol/pool/PoolConfigurator.sol - functions
-
+ LCOV - lcov.info.p - protocol/pool/PoolConfigurator.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
+
+
-
-
+
|
-
-
-
+
+
+
|
@@ -53,294 +53,322 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../glass.png) |
- PoolConfigurator._onlyEmergencyAdmin |
+ PoolConfigurator.getConfiguratorLogic |
- 0 |
+ 1 |
- PoolConfigurator.setReserveInterestRateData |
+ PoolConfigurator._checkNoBorrowers |
- 0 |
+ 3 |
- PoolConfigurator.getConfiguratorLogic |
+ PoolConfigurator.setUnbackedMintCap |
- 1 |
+ 7 |
- PoolConfigurator.updateAToken |
+ PoolConfigurator.updateBridgeProtocolFee |
- 2 |
+ 14 |
- PoolConfigurator.updateStableDebtToken |
+ PoolConfigurator._updateInterestRateStrategy |
- 2 |
+ 46 |
- PoolConfigurator.updateVariableDebtToken |
+ PoolConfigurator.updateAToken |
- 2 |
+ 1001 |
- PoolConfigurator._checkNoBorrowers |
+ PoolConfigurator.updateVariableDebtToken |
- 3 |
+ 1001 |
- PoolConfigurator._updateInterestRateStrategy |
+ PoolConfigurator.setReserveInterestRateData |
- 4 |
+ 1002 |
- PoolConfigurator.setReserveInterestRateStrategyAddress |
+ PoolConfigurator.dropReserve |
- 5 |
+ 1005 |
- PoolConfigurator.dropReserve |
+ PoolConfigurator.setReserveActive |
- 6 |
+ 1011 |
- PoolConfigurator.setUnbackedMintCap |
+ PoolConfigurator.setReserveInterestRateStrategyAddress |
- 7 |
+ 1044 |
- PoolConfigurator.setReserveActive |
+ PoolConfigurator.onlyPoolAdmin |
- 14 |
+ 1682 |
- PoolConfigurator.updateBridgeProtocolFee |
+ PoolConfigurator.updateFlashloanPremiumToProtocol |
- 14 |
+ 1682 |
- PoolConfigurator.setEModeCategory |
+ PoolConfigurator.updateFlashloanPremiumTotal |
- 38 |
+ 1682 |
- PoolConfigurator.updateFlashloanPremiumToProtocol |
+ PoolConfigurator.setSiloedBorrowing |
- 608 |
+ 1949 |
- PoolConfigurator.updateFlashloanPremiumTotal |
+ PoolConfigurator.setLiquidationProtocolFee |
- 608 |
+ 1954 |
- PoolConfigurator._onlyRiskOrPoolOrEmergencyAdmins |
+ PoolConfigurator.setBorrowableInIsolation |
- 1011 |
+ 1959 |
- PoolConfigurator.setReserveFreeze |
+ PoolConfigurator.disableLiquidationGracePeriod |
- 1011 |
+ 2001 |
- PoolConfigurator._onlyPoolAdmin |
+ PoolConfigurator.onlyEmergencyOrPoolAdmin |
- 1256 |
+ 2003 |
- PoolConfigurator.setReserveFactor |
+ PoolConfigurator.setReserveFactor |
- 1749 |
+ 2949 |
- PoolConfigurator.setReserveFlashLoaning |
+ PoolConfigurator.setBorrowCap |
- 1749 |
+ 2957 |
- PoolConfigurator.setSiloedBorrowing |
+ PoolConfigurator.setDebtCeiling |
- 1749 |
+ 2964 |
- PoolConfigurator.setReserveBorrowing |
+ PoolConfigurator._checkNoSuppliers |
- 1751 |
+ 2971 |
- PoolConfigurator.setLiquidationProtocolFee |
+ PoolConfigurator.getPendingLtv |
- 1754 |
+ 3003 |
- PoolConfigurator.setBorrowCap |
+ PoolConfigurator._onlyRiskOrPoolOrEmergencyAdmins |
- 1759 |
+ 3014 |
- PoolConfigurator.setBorrowableInIsolation |
+ PoolConfigurator.onlyRiskOrPoolOrEmergencyAdmins |
- 1759 |
+ 3014 |
- PoolConfigurator.setSupplyCap |
+ PoolConfigurator.setReserveFreeze |
- 1762 |
+ 3014 |
- PoolConfigurator.setDebtCeiling |
+ PoolConfigurator.setReserveFlashLoaning |
- 1765 |
+ 3948 |
- PoolConfigurator._checkNoSuppliers |
+ PoolConfigurator.setSupplyCap |
- 1774 |
+ 3963 |
- PoolConfigurator.setAssetEModeCategory |
+ PoolConfigurator.setPoolPause |
- 1786 |
+ 4003 |
- PoolConfigurator.setReserveStableRateBorrowing |
+ PoolConfigurator.setReserveBorrowing |
- 1933 |
+ 5947 |
- PoolConfigurator.getPendingLtv |
+ PoolConfigurator.onlyRiskOrPoolAdmins |
- 2003 |
+ 7010 |
- PoolConfigurator._onlyAssetListingOrPoolAdmins |
+ PoolConfigurator.setAssetBorrowableInEMode |
- 2592 |
+ 7010 |
- PoolConfigurator.initReserves |
+ PoolConfigurator._onlyPoolAdmin |
- 2592 |
+ 7396 |
- PoolConfigurator.setPoolPause |
+ PoolConfigurator._onlyAssetListingOrPoolAdmins |
- 3003 |
+ 8651 |
+
+
+
+
+ PoolConfigurator.initReserves |
+
+ 8651 |
+
+
+
+
+ PoolConfigurator.onlyAssetListingOrPoolAdmins |
+
+ 8651 |
+
+
+
+
+ PoolConfigurator.configureReserveAsCollateral |
+
+ 10952 |
+
+
+
+
+ PoolConfigurator.setEModeCategory |
+
+ 11035 |
- PoolConfigurator.configureReserveAsCollateral |
+ PoolConfigurator.setAssetCollateralInEMode |
- 4757 |
+ 11039 |
- PoolConfigurator.setReservePause |
+ PoolConfigurator.setReservePause |
- 8891 |
+ 14013 |
- PoolConfigurator._onlyPoolOrEmergencyAdmin |
+ PoolConfigurator._onlyPoolOrEmergencyAdmin |
- 14903 |
+ 24030 |
- PoolConfigurator._onlyRiskOrPoolAdmins |
+ PoolConfigurator._onlyRiskOrPoolAdmins |
- 24323 |
+ 70679 |
@@ -348,8 +376,8 @@
diff --git a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/PoolConfigurator.sol.func.html b/report/protocol/pool/PoolConfigurator.sol.func.html
similarity index 56%
rename from report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/PoolConfigurator.sol.func.html
rename to report/protocol/pool/PoolConfigurator.sol.func.html
index 3bc91cd2..5bdd150a 100644
--- a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/PoolConfigurator.sol.func.html
+++ b/report/protocol/pool/PoolConfigurator.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/pool/src/core/contracts/protocol/pool/PoolConfigurator.sol - functions
-
+ LCOV - lcov.info.p - protocol/pool/PoolConfigurator.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
+
+
-
-
+
|
-
-
-
+
+
+
|
@@ -53,294 +53,322 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../updown.png) |
- PoolConfigurator._checkNoBorrowers |
+ PoolConfigurator._checkNoBorrowers |
3 |
- PoolConfigurator._checkNoSuppliers |
+ PoolConfigurator._checkNoSuppliers |
- 1774 |
+ 2971 |
- PoolConfigurator._onlyAssetListingOrPoolAdmins |
+ PoolConfigurator._onlyAssetListingOrPoolAdmins |
- 2592 |
+ 8651 |
- PoolConfigurator._onlyEmergencyAdmin |
+ PoolConfigurator._onlyPoolAdmin |
- 0 |
+ 7396 |
- PoolConfigurator._onlyPoolAdmin |
+ PoolConfigurator._onlyPoolOrEmergencyAdmin |
- 1256 |
+ 24030 |
- PoolConfigurator._onlyPoolOrEmergencyAdmin |
+ PoolConfigurator._onlyRiskOrPoolAdmins |
- 14903 |
+ 70679 |
- PoolConfigurator._onlyRiskOrPoolAdmins |
+ PoolConfigurator._onlyRiskOrPoolOrEmergencyAdmins |
- 24323 |
+ 3014 |
- PoolConfigurator._onlyRiskOrPoolOrEmergencyAdmins |
+ PoolConfigurator._updateInterestRateStrategy |
- 1011 |
+ 46 |
- PoolConfigurator._updateInterestRateStrategy |
+ PoolConfigurator.configureReserveAsCollateral |
- 4 |
+ 10952 |
- PoolConfigurator.configureReserveAsCollateral |
+ PoolConfigurator.disableLiquidationGracePeriod |
- 4757 |
+ 2001 |
- PoolConfigurator.dropReserve |
+ PoolConfigurator.dropReserve |
- 6 |
+ 1005 |
- PoolConfigurator.getConfiguratorLogic |
+ PoolConfigurator.getConfiguratorLogic |
1 |
- PoolConfigurator.getPendingLtv |
+ PoolConfigurator.getPendingLtv |
- 2003 |
+ 3003 |
- PoolConfigurator.initReserves |
+ PoolConfigurator.initReserves |
- 2592 |
+ 8651 |
- PoolConfigurator.setAssetEModeCategory |
+ PoolConfigurator.onlyAssetListingOrPoolAdmins |
- 1786 |
+ 8651 |
- PoolConfigurator.setBorrowCap |
+ PoolConfigurator.onlyEmergencyOrPoolAdmin |
- 1759 |
+ 2003 |
- PoolConfigurator.setBorrowableInIsolation |
+ PoolConfigurator.onlyPoolAdmin |
- 1759 |
+ 1682 |
- PoolConfigurator.setDebtCeiling |
+ PoolConfigurator.onlyRiskOrPoolAdmins |
- 1765 |
+ 7010 |
- PoolConfigurator.setEModeCategory |
+ PoolConfigurator.onlyRiskOrPoolOrEmergencyAdmins |
- 38 |
+ 3014 |
- PoolConfigurator.setLiquidationProtocolFee |
+ PoolConfigurator.setAssetBorrowableInEMode |
- 1754 |
+ 7010 |
- PoolConfigurator.setPoolPause |
+ PoolConfigurator.setAssetCollateralInEMode |
- 3003 |
+ 11039 |
- PoolConfigurator.setReserveActive |
+ PoolConfigurator.setBorrowCap |
+
+ 2957 |
- 14 |
+
+
+
+ PoolConfigurator.setBorrowableInIsolation |
+
+ 1959 |
- PoolConfigurator.setReserveBorrowing |
+ PoolConfigurator.setDebtCeiling |
- 1751 |
+ 2964 |
- PoolConfigurator.setReserveFactor |
+ PoolConfigurator.setEModeCategory |
- 1749 |
+ 11035 |
- PoolConfigurator.setReserveFlashLoaning |
+ PoolConfigurator.setLiquidationProtocolFee |
- 1749 |
+ 1954 |
- PoolConfigurator.setReserveFreeze |
+ PoolConfigurator.setPoolPause |
+
+ 4003 |
+
+
+
+
+ PoolConfigurator.setReserveActive |
1011 |
- PoolConfigurator.setReserveInterestRateData |
+ PoolConfigurator.setReserveBorrowing |
- 0 |
+ 5947 |
- PoolConfigurator.setReserveInterestRateStrategyAddress |
+ PoolConfigurator.setReserveFactor |
- 5 |
+ 2949 |
- PoolConfigurator.setReservePause |
+ PoolConfigurator.setReserveFlashLoaning |
- 8891 |
+ 3948 |
- PoolConfigurator.setReserveStableRateBorrowing |
+ PoolConfigurator.setReserveFreeze |
- 1933 |
+ 3014 |
- PoolConfigurator.setSiloedBorrowing |
+ PoolConfigurator.setReserveInterestRateData |
- 1749 |
+ 1002 |
- PoolConfigurator.setSupplyCap |
+ PoolConfigurator.setReserveInterestRateStrategyAddress |
- 1762 |
+ 1044 |
- PoolConfigurator.setUnbackedMintCap |
+ PoolConfigurator.setReservePause |
- 7 |
+ 14013 |
- PoolConfigurator.updateAToken |
+ PoolConfigurator.setSiloedBorrowing |
- 2 |
+ 1949 |
- PoolConfigurator.updateBridgeProtocolFee |
+ PoolConfigurator.setSupplyCap |
- 14 |
+ 3963 |
- PoolConfigurator.updateFlashloanPremiumToProtocol |
+ PoolConfigurator.setUnbackedMintCap |
+
+ 7 |
+
- 608 |
+
+
+ PoolConfigurator.updateAToken |
+
+ 1001 |
+
+
+
+
+ PoolConfigurator.updateBridgeProtocolFee |
+
+ 14 |
- PoolConfigurator.updateFlashloanPremiumTotal |
+ PoolConfigurator.updateFlashloanPremiumToProtocol |
- 608 |
+ 1682 |
- PoolConfigurator.updateStableDebtToken |
+ PoolConfigurator.updateFlashloanPremiumTotal |
- 2 |
+ 1682 |
- PoolConfigurator.updateVariableDebtToken |
+ PoolConfigurator.updateVariableDebtToken |
- 2 |
+ 1001 |
@@ -348,8 +376,8 @@
diff --git a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/PoolConfigurator.sol.gcov.html b/report/protocol/pool/PoolConfigurator.sol.gcov.html
similarity index 75%
rename from report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/PoolConfigurator.sol.gcov.html
rename to report/protocol/pool/PoolConfigurator.sol.gcov.html
index 39285c10..4e0e3977 100644
--- a/report/core/contracts/protocol/pool/src/core/contracts/protocol/pool/PoolConfigurator.sol.gcov.html
+++ b/report/protocol/pool/PoolConfigurator.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/pool/src/core/contracts/protocol/pool/PoolConfigurator.sol
-
+ LCOV - lcov.info.p - protocol/pool/PoolConfigurator.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
+
+
-
-
+
|
-
-
-
+
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -72,36 +72,36 @@
1 : : // SPDX-License-Identifier: BUSL-1.1
2 : : pragma solidity ^0.8.10;
3 : :
- 4 : : import {VersionedInitializable} from '../libraries/aave-upgradeability/VersionedInitializable.sol';
+ 4 : : import {VersionedInitializable} from '../../misc/aave-upgradeability/VersionedInitializable.sol';
5 : : import {ReserveConfiguration} from '../libraries/configuration/ReserveConfiguration.sol';
- 6 : : import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
- 7 : : import {IDefaultInterestRateStrategyV2} from '../../interfaces/IDefaultInterestRateStrategyV2.sol';
- 8 : : import {Errors} from '../libraries/helpers/Errors.sol';
- 9 : : import {PercentageMath} from '../libraries/math/PercentageMath.sol';
- 10 : : import {DataTypes} from '../libraries/types/DataTypes.sol';
- 11 : : import {ConfiguratorLogic} from '../libraries/logic/ConfiguratorLogic.sol';
- 12 : : import {ConfiguratorInputTypes} from '../libraries/types/ConfiguratorInputTypes.sol';
- 13 : : import {IPoolConfigurator} from '../../interfaces/IPoolConfigurator.sol';
- 14 : : import {IPool} from '../../interfaces/IPool.sol';
- 15 : : import {IACLManager} from '../../interfaces/IACLManager.sol';
- 16 : : import {IPoolDataProvider} from '../../interfaces/IPoolDataProvider.sol';
- 17 : : import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
- 18 : : import {IERC20Detailed} from '../../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
- 19 : :
- 20 : : /**
- 21 : : * @title PoolConfigurator
- 22 : : * @author Aave
- 23 : : * @dev Implements the configuration methods for the Aave protocol
- 24 : : */
- 25 : : abstract contract PoolConfigurator is VersionedInitializable, IPoolConfigurator {
- 26 : : using PercentageMath for uint256;
- 27 : : using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
- 28 : :
- 29 : : IPoolAddressesProvider internal _addressesProvider;
- 30 : : IPool internal _pool;
- 31 : :
- 32 : : mapping(address => uint256) internal _pendingLtv;
- 33 : : mapping(address => bool) internal _isPendingLtvSet;
+ 6 : : import {EModeConfiguration} from '../libraries/configuration/EModeConfiguration.sol';
+ 7 : : import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
+ 8 : : import {IDefaultInterestRateStrategyV2} from '../../interfaces/IDefaultInterestRateStrategyV2.sol';
+ 9 : : import {Errors} from '../libraries/helpers/Errors.sol';
+ 10 : : import {PercentageMath} from '../libraries/math/PercentageMath.sol';
+ 11 : : import {DataTypes} from '../libraries/types/DataTypes.sol';
+ 12 : : import {ConfiguratorLogic} from '../libraries/logic/ConfiguratorLogic.sol';
+ 13 : : import {ConfiguratorInputTypes} from '../libraries/types/ConfiguratorInputTypes.sol';
+ 14 : : import {IPoolConfigurator} from '../../interfaces/IPoolConfigurator.sol';
+ 15 : : import {IPool} from '../../interfaces/IPool.sol';
+ 16 : : import {IACLManager} from '../../interfaces/IACLManager.sol';
+ 17 : : import {IPoolDataProvider} from '../../interfaces/IPoolDataProvider.sol';
+ 18 : : import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
+ 19 : : import {IERC20Detailed} from '../../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
+ 20 : :
+ 21 : : /**
+ 22 : : * @title PoolConfigurator
+ 23 : : * @author Aave
+ 24 : : * @dev Implements the configuration methods for the Aave protocol
+ 25 : : */
+ 26 : : abstract contract PoolConfigurator is VersionedInitializable, IPoolConfigurator {
+ 27 : : using PercentageMath for uint256;
+ 28 : : using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
+ 29 : :
+ 30 : : IPoolAddressesProvider internal _addressesProvider;
+ 31 : : IPool internal _pool;
+ 32 : :
+ 33 : : mapping(address => uint256) internal _pendingLtv;
34 : :
35 : : uint40 public constant MAX_GRACE_PERIOD = 4 hours;
36 : :
@@ -109,610 +109,596 @@
38 : : * @dev Only pool admin can call functions marked by this modifier.
39 : : */
40 : : modifier onlyPoolAdmin() {
- 41 : : _onlyPoolAdmin();
+ 41 : 1682 : _onlyPoolAdmin();
42 : : _;
43 : : }
44 : :
45 : : /**
- 46 : : * @dev Only emergency admin can call functions marked by this modifier.
+ 46 : : * @dev Only emergency or pool admin can call functions marked by this modifier.
47 : : */
- 48 : : modifier onlyEmergencyAdmin() {
- 49 : : _onlyEmergencyAdmin();
+ 48 : : modifier onlyEmergencyOrPoolAdmin() {
+ 49 : 2003 : _onlyPoolOrEmergencyAdmin();
50 : : _;
51 : : }
52 : :
53 : : /**
- 54 : : * @dev Only emergency or pool admin can call functions marked by this modifier.
+ 54 : : * @dev Only asset listing or pool admin can call functions marked by this modifier.
55 : : */
- 56 : : modifier onlyEmergencyOrPoolAdmin() {
- 57 : : _onlyPoolOrEmergencyAdmin();
+ 56 : : modifier onlyAssetListingOrPoolAdmins() {
+ 57 : 8651 : _onlyAssetListingOrPoolAdmins();
58 : : _;
59 : : }
60 : :
61 : : /**
- 62 : : * @dev Only asset listing or pool admin can call functions marked by this modifier.
+ 62 : : * @dev Only risk or pool admin can call functions marked by this modifier.
63 : : */
- 64 : : modifier onlyAssetListingOrPoolAdmins() {
- 65 : : _onlyAssetListingOrPoolAdmins();
+ 64 : : modifier onlyRiskOrPoolAdmins() {
+ 65 : 7010 : _onlyRiskOrPoolAdmins();
66 : : _;
67 : : }
68 : :
69 : : /**
- 70 : : * @dev Only risk or pool admin can call functions marked by this modifier.
+ 70 : : * @dev Only risk, pool or emergency admin can call functions marked by this modifier.
71 : : */
- 72 : : modifier onlyRiskOrPoolAdmins() {
- 73 : : _onlyRiskOrPoolAdmins();
+ 72 : : modifier onlyRiskOrPoolOrEmergencyAdmins() {
+ 73 : 3014 : _onlyRiskOrPoolOrEmergencyAdmins();
74 : : _;
75 : : }
76 : :
- 77 : : /**
- 78 : : * @dev Only risk, pool or emergency admin can call functions marked by this modifier.
- 79 : : */
- 80 : : modifier onlyRiskOrPoolOrEmergencyAdmins() {
- 81 : : _onlyRiskOrPoolOrEmergencyAdmins();
- 82 : : _;
- 83 : : }
+ 77 : : function initialize(IPoolAddressesProvider provider) public virtual;
+ 78 : :
+ 79 : : /// @inheritdoc IPoolConfigurator
+ 80 : : function initReserves(
+ 81 : : ConfiguratorInputTypes.InitReserveInput[] calldata input
+ 82 : : ) external override onlyAssetListingOrPoolAdmins {
+ 83 : 7651 : IPool cachedPool = _pool;
84 : :
- 85 : : function initialize(IPoolAddressesProvider provider) public virtual;
- 86 : :
- 87 : : /// @inheritdoc IPoolConfigurator
- 88 : 2592 : function initReserves(
- 89 : : ConfiguratorInputTypes.InitReserveInput[] calldata input
- 90 : : ) external override onlyAssetListingOrPoolAdmins {
- 91 : 5182 : IPool cachedPool = _pool;
- 92 : 13535 : for (uint256 i = 0; i < input.length; i++) {
- 93 : 7764 : require(IERC20Detailed(input[i].underlyingAsset).decimals() > 5, Errors.INVALID_DECIMALS);
+ 85 : 7651 : for (uint256 i = 0; i < input.length; i++) {
+ 86 : 167016 : ConfiguratorLogic.executeInitReserve(cachedPool, input[i]);
+ 87 : 165016 : emit ReserveInterestRateDataChanged(
+ 88 : : input[i].underlyingAsset,
+ 89 : : input[i].interestRateStrategyAddress,
+ 90 : : input[i].interestRateData
+ 91 : : );
+ 92 : : }
+ 93 : : }
94 : :
- 95 : 5764 : ConfiguratorLogic.executeInitReserve(cachedPool, input[i]);
- 96 : 5762 : emit ReserveInterestRateDataChanged(
- 97 : : input[i].underlyingAsset,
- 98 : : input[i].interestRateStrategyAddress,
- 99 : : input[i].interestRateData
- 100 : : );
- 101 : : }
- 102 : : }
- 103 : :
- 104 : : /// @inheritdoc IPoolConfigurator
- 105 : 6 : function dropReserve(address asset) external override onlyPoolAdmin {
- 106 : 10 : _pool.dropReserve(asset);
- 107 : 2 : emit ReserveDropped(asset);
- 108 : : }
- 109 : :
- 110 : : /// @inheritdoc IPoolConfigurator
- 111 : 2 : function updateAToken(
- 112 : : ConfiguratorInputTypes.UpdateATokenInput calldata input
- 113 : : ) external override onlyPoolAdmin {
- 114 : 2 : ConfiguratorLogic.executeUpdateAToken(_pool, input);
- 115 : : }
- 116 : :
- 117 : : /// @inheritdoc IPoolConfigurator
- 118 : 2 : function updateStableDebtToken(
- 119 : : ConfiguratorInputTypes.UpdateDebtTokenInput calldata input
- 120 : : ) external override onlyPoolAdmin {
- 121 : 2 : ConfiguratorLogic.executeUpdateStableDebtToken(_pool, input);
- 122 : : }
- 123 : :
- 124 : : /// @inheritdoc IPoolConfigurator
- 125 : 2 : function updateVariableDebtToken(
- 126 : : ConfiguratorInputTypes.UpdateDebtTokenInput calldata input
- 127 : : ) external override onlyPoolAdmin {
- 128 : 2 : ConfiguratorLogic.executeUpdateVariableDebtToken(_pool, input);
- 129 : : }
- 130 : :
- 131 : : /// @inheritdoc IPoolConfigurator
- 132 : 1751 : function setReserveBorrowing(address asset, bool enabled) external override onlyRiskOrPoolAdmins {
- 133 : 5250 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
- 134 : 3500 : if (!enabled) {
- 135 : 4 : require(!currentConfig.getStableRateBorrowingEnabled(), Errors.STABLE_BORROWING_ENABLED);
- 136 : : }
- 137 : 3500 : currentConfig.setBorrowingEnabled(enabled);
- 138 : 3500 : _pool.setConfiguration(asset, currentConfig);
- 139 : 3500 : emit ReserveBorrowing(asset, enabled);
- 140 : : }
+ 95 : : /// @inheritdoc IPoolConfigurator
+ 96 : : function dropReserve(address asset) external override onlyPoolAdmin {
+ 97 : 5 : _pool.dropReserve(asset);
+ 98 : 1 : emit ReserveDropped(asset);
+ 99 : : }
+ 100 : :
+ 101 : : /// @inheritdoc IPoolConfigurator
+ 102 : : function updateAToken(
+ 103 : : ConfiguratorInputTypes.UpdateATokenInput calldata input
+ 104 : : ) external override onlyPoolAdmin {
+ 105 : 1 : ConfiguratorLogic.executeUpdateAToken(_pool, input);
+ 106 : : }
+ 107 : :
+ 108 : : /// @inheritdoc IPoolConfigurator
+ 109 : : function updateVariableDebtToken(
+ 110 : : ConfiguratorInputTypes.UpdateDebtTokenInput calldata input
+ 111 : : ) external override onlyPoolAdmin {
+ 112 : 1 : ConfiguratorLogic.executeUpdateVariableDebtToken(_pool, input);
+ 113 : : }
+ 114 : :
+ 115 : : /// @inheritdoc IPoolConfigurator
+ 116 : : function setReserveBorrowing(address asset, bool enabled) external override onlyRiskOrPoolAdmins {
+ 117 : 4947 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
+ 118 : 4947 : currentConfig.setBorrowingEnabled(enabled);
+ 119 : 4947 : _pool.setConfiguration(asset, currentConfig);
+ 120 : 4947 : emit ReserveBorrowing(asset, enabled);
+ 121 : : }
+ 122 : :
+ 123 : : /// @inheritdoc IPoolConfigurator
+ 124 : : function configureReserveAsCollateral(
+ 125 : : address asset,
+ 126 : : uint256 ltv,
+ 127 : : uint256 liquidationThreshold,
+ 128 : : uint256 liquidationBonus
+ 129 : : ) external override onlyRiskOrPoolAdmins {
+ 130 : : //validation of the parameters: the LTV can
+ 131 : : //only be lower or equal than the liquidation threshold
+ 132 : : //(otherwise a loan against the asset would cause instantaneous liquidation)
+ 133 : 9952 : require(ltv <= liquidationThreshold, Errors.INVALID_RESERVE_PARAMS);
+ 134 : :
+ 135 : 7952 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
+ 136 : :
+ 137 : 7952 : if (liquidationThreshold != 0) {
+ 138 : : //liquidation bonus must be bigger than 100.00%, otherwise the liquidator would receive less
+ 139 : : //collateral than needed to cover the debt
+ 140 : 6951 : require(liquidationBonus > PercentageMath.PERCENTAGE_FACTOR, Errors.INVALID_RESERVE_PARAMS);
141 : :
- 142 : : /// @inheritdoc IPoolConfigurator
- 143 : 4757 : function configureReserveAsCollateral(
- 144 : : address asset,
- 145 : : uint256 ltv,
- 146 : : uint256 liquidationThreshold,
- 147 : : uint256 liquidationBonus
- 148 : : ) external override onlyRiskOrPoolAdmins {
- 149 : : //validation of the parameters: the LTV can
- 150 : : //only be lower or equal than the liquidation threshold
- 151 : : //(otherwise a loan against the asset would cause instantaneous liquidation)
- 152 : 9512 : require(ltv <= liquidationThreshold, Errors.INVALID_RESERVE_PARAMS);
- 153 : :
- 154 : 14262 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
+ 142 : : //if threshold * bonus is less than PERCENTAGE_FACTOR, it's guaranteed that at the moment
+ 143 : : //a loan is taken there is enough collateral available to cover the liquidation bonus
+ 144 : 5951 : require(
+ 145 : : liquidationThreshold.percentMul(liquidationBonus) <= PercentageMath.PERCENTAGE_FACTOR,
+ 146 : : Errors.INVALID_RESERVE_PARAMS
+ 147 : : );
+ 148 : : } else {
+ 149 : 1001 : require(liquidationBonus == 0, Errors.INVALID_RESERVE_PARAMS);
+ 150 : : //if the liquidation threshold is being set to 0,
+ 151 : : // the reserve is being disabled as collateral. To do so,
+ 152 : : //we need to ensure no liquidity is supplied
+ 153 : 1001 : _checkNoSuppliers(asset);
+ 154 : : }
155 : :
- 156 : 9508 : if (liquidationThreshold != 0) {
- 157 : : //liquidation bonus must be bigger than 100.00%, otherwise the liquidator would receive less
- 158 : : //collateral than needed to cover the debt
- 159 : 9504 : require(liquidationBonus > PercentageMath.PERCENTAGE_FACTOR, Errors.INVALID_RESERVE_PARAMS);
- 160 : :
- 161 : : //if threshold * bonus is less than PERCENTAGE_FACTOR, it's guaranteed that at the moment
- 162 : : //a loan is taken there is enough collateral available to cover the liquidation bonus
- 163 : 9502 : require(
- 164 : : liquidationThreshold.percentMul(liquidationBonus) <= PercentageMath.PERCENTAGE_FACTOR,
- 165 : : Errors.INVALID_RESERVE_PARAMS
- 166 : : );
- 167 : : } else {
- 168 : 4 : require(liquidationBonus == 0, Errors.INVALID_RESERVE_PARAMS);
- 169 : : //if the liquidation threshold is being set to 0,
- 170 : : // the reserve is being disabled as collateral. To do so,
- 171 : : //we need to ensure no liquidity is supplied
- 172 : 4 : _checkNoSuppliers(asset);
- 173 : : }
+ 156 : 4952 : uint256 newLtv = ltv;
+ 157 : :
+ 158 : 4952 : if (currentConfig.getFrozen()) {
+ 159 : 1000 : _pendingLtv[asset] = ltv;
+ 160 : 1000 : newLtv = 0;
+ 161 : :
+ 162 : 1000 : emit PendingLtvChanged(asset, ltv);
+ 163 : : } else {
+ 164 : 3952 : currentConfig.setLtv(ltv);
+ 165 : : }
+ 166 : :
+ 167 : 4952 : currentConfig.setLiquidationThreshold(liquidationThreshold);
+ 168 : 4952 : currentConfig.setLiquidationBonus(liquidationBonus);
+ 169 : :
+ 170 : 4952 : _pool.setConfiguration(asset, currentConfig);
+ 171 : :
+ 172 : 4952 : emit CollateralConfigurationChanged(asset, newLtv, liquidationThreshold, liquidationBonus);
+ 173 : : }
174 : :
- 175 : 9502 : if (currentConfig.getFrozen()) {
- 176 : 2000 : _pendingLtv[asset] = ltv;
- 177 : 2000 : _isPendingLtvSet[asset] = true;
- 178 : :
- 179 : 2000 : emit PendingLtvChanged(asset, ltv);
- 180 : : } else {
- 181 : 7502 : currentConfig.setLtv(ltv);
- 182 : : }
- 183 : :
- 184 : 9502 : currentConfig.setLiquidationThreshold(liquidationThreshold);
- 185 : 9502 : currentConfig.setLiquidationBonus(liquidationBonus);
+ 175 : : /// @inheritdoc IPoolConfigurator
+ 176 : : function setReserveFlashLoaning(
+ 177 : : address asset,
+ 178 : : bool enabled
+ 179 : : ) external override onlyRiskOrPoolAdmins {
+ 180 : 3948 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
+ 181 : :
+ 182 : 3948 : currentConfig.setFlashLoanEnabled(enabled);
+ 183 : 3948 : _pool.setConfiguration(asset, currentConfig);
+ 184 : 3948 : emit ReserveFlashLoaning(asset, enabled);
+ 185 : : }
186 : :
- 187 : 9502 : _pool.setConfiguration(asset, currentConfig);
- 188 : :
- 189 : 9502 : emit CollateralConfigurationChanged(asset, ltv, liquidationThreshold, liquidationBonus);
- 190 : : }
- 191 : :
- 192 : : /// @inheritdoc IPoolConfigurator
- 193 : 1933 : function setReserveStableRateBorrowing(
- 194 : : address asset,
- 195 : : bool enabled
- 196 : : ) external override onlyRiskOrPoolAdmins {
- 197 : 5796 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
- 198 : 1932 : if (enabled) {
- 199 : 368 : require(currentConfig.getBorrowingEnabled(), Errors.BORROWING_NOT_ENABLED);
- 200 : : }
- 201 : 3862 : currentConfig.setStableRateBorrowingEnabled(enabled);
- 202 : 3862 : _pool.setConfiguration(asset, currentConfig);
- 203 : 3862 : emit ReserveStableRateBorrowing(asset, enabled);
- 204 : : }
- 205 : :
- 206 : : /// @inheritdoc IPoolConfigurator
- 207 : 1749 : function setReserveFlashLoaning(
- 208 : : address asset,
- 209 : : bool enabled
- 210 : : ) external override onlyRiskOrPoolAdmins {
- 211 : 5247 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
- 212 : :
- 213 : 3498 : currentConfig.setFlashLoanEnabled(enabled);
- 214 : 3498 : _pool.setConfiguration(asset, currentConfig);
- 215 : 3498 : emit ReserveFlashLoaning(asset, enabled);
- 216 : : }
- 217 : :
- 218 : : /// @inheritdoc IPoolConfigurator
- 219 : 14 : function setReserveActive(address asset, bool active) external override onlyPoolAdmin {
- 220 : 38 : if (!active) _checkNoSuppliers(asset);
- 221 : 36 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
- 222 : 24 : currentConfig.setActive(active);
- 223 : 24 : _pool.setConfiguration(asset, currentConfig);
- 224 : 24 : emit ReserveActive(asset, active);
- 225 : : }
- 226 : :
- 227 : : /// @inheritdoc IPoolConfigurator
- 228 : 1011 : function setReserveFreeze(
- 229 : : address asset,
- 230 : : bool freeze
- 231 : : ) external override onlyRiskOrPoolOrEmergencyAdmins {
- 232 : 3030 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
- 233 : 2020 : currentConfig.setFrozen(freeze);
- 234 : :
- 235 : 1010 : if (freeze) {
- 236 : 2016 : _pendingLtv[asset] = currentConfig.getLtv();
- 237 : 2016 : _isPendingLtvSet[asset] = true;
- 238 : 2016 : currentConfig.setLtv(0);
- 239 : :
- 240 : 2016 : emit PendingLtvChanged(asset, currentConfig.getLtv());
- 241 : 2 : } else if (_isPendingLtvSet[asset]) {
- 242 : 2 : uint256 ltv = _pendingLtv[asset];
- 243 : 2 : currentConfig.setLtv(ltv);
- 244 : :
- 245 : 2 : delete _pendingLtv[asset];
- 246 : 2 : delete _isPendingLtvSet[asset];
- 247 : :
- 248 : 2 : emit PendingLtvRemoved(asset);
- 249 : : }
- 250 : :
- 251 : 2020 : _pool.setConfiguration(asset, currentConfig);
- 252 : 2020 : emit ReserveFrozen(asset, freeze);
- 253 : : }
- 254 : :
- 255 : : /// @inheritdoc IPoolConfigurator
- 256 : 1759 : function setBorrowableInIsolation(
- 257 : : address asset,
- 258 : : bool borrowable
- 259 : : ) external override onlyRiskOrPoolAdmins {
- 260 : 5277 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
- 261 : 3518 : currentConfig.setBorrowableInIsolation(borrowable);
- 262 : 3518 : _pool.setConfiguration(asset, currentConfig);
- 263 : 3518 : emit BorrowableInIsolationChanged(asset, borrowable);
- 264 : : }
- 265 : :
- 266 : : /// @inheritdoc IPoolConfigurator
- 267 : 8891 : function setReservePause(
- 268 : : address asset,
- 269 : : bool paused,
- 270 : : uint40 gracePeriod
- 271 : : ) public override onlyEmergencyOrPoolAdmin {
- 272 : : // Only setting grace period if the transition is paused -> unpaused
- 273 : 35582 : if (!paused && gracePeriod != 0) {
- 274 : 16056 : require(gracePeriod <= MAX_GRACE_PERIOD, Errors.INVALID_GRACE_PERIOD);
+ 187 : : /// @inheritdoc IPoolConfigurator
+ 188 : : function setReserveActive(address asset, bool active) external override onlyPoolAdmin {
+ 189 : 11 : if (!active) _checkNoSuppliers(asset);
+ 190 : 10 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
+ 191 : 10 : currentConfig.setActive(active);
+ 192 : 10 : _pool.setConfiguration(asset, currentConfig);
+ 193 : 10 : emit ReserveActive(asset, active);
+ 194 : : }
+ 195 : :
+ 196 : : /// @inheritdoc IPoolConfigurator
+ 197 : : function setReserveFreeze(
+ 198 : : address asset,
+ 199 : : bool freeze
+ 200 : : ) external override onlyRiskOrPoolOrEmergencyAdmins {
+ 201 : 2014 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
+ 202 : :
+ 203 : 2014 : require(freeze != currentConfig.getFrozen(), Errors.INVALID_FREEZE_STATE);
+ 204 : :
+ 205 : 2012 : currentConfig.setFrozen(freeze);
+ 206 : :
+ 207 : 2012 : uint256 ltvSet;
+ 208 : 2012 : uint256 pendingLtvSet;
+ 209 : :
+ 210 : 2012 : if (freeze) {
+ 211 : 1010 : pendingLtvSet = currentConfig.getLtv();
+ 212 : 1010 : _pendingLtv[asset] = pendingLtvSet;
+ 213 : 1010 : currentConfig.setLtv(0);
+ 214 : : } else {
+ 215 : 1002 : ltvSet = _pendingLtv[asset];
+ 216 : 1002 : currentConfig.setLtv(ltvSet);
+ 217 : 1002 : delete _pendingLtv[asset];
+ 218 : : }
+ 219 : :
+ 220 : 2012 : emit PendingLtvChanged(asset, pendingLtvSet);
+ 221 : 2012 : emit CollateralConfigurationChanged(
+ 222 : : asset,
+ 223 : : ltvSet,
+ 224 : : currentConfig.getLiquidationThreshold(),
+ 225 : : currentConfig.getLiquidationBonus()
+ 226 : : );
+ 227 : :
+ 228 : 2012 : _pool.setConfiguration(asset, currentConfig);
+ 229 : 2012 : emit ReserveFrozen(asset, freeze);
+ 230 : : }
+ 231 : :
+ 232 : : /// @inheritdoc IPoolConfigurator
+ 233 : : function setBorrowableInIsolation(
+ 234 : : address asset,
+ 235 : : bool borrowable
+ 236 : : ) external override onlyRiskOrPoolAdmins {
+ 237 : 1959 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
+ 238 : 1959 : currentConfig.setBorrowableInIsolation(borrowable);
+ 239 : 1959 : _pool.setConfiguration(asset, currentConfig);
+ 240 : 1959 : emit BorrowableInIsolationChanged(asset, borrowable);
+ 241 : : }
+ 242 : :
+ 243 : : /// @inheritdoc IPoolConfigurator
+ 244 : : function setReservePause(
+ 245 : : address asset,
+ 246 : : bool paused,
+ 247 : : uint40 gracePeriod
+ 248 : : ) public override onlyEmergencyOrPoolAdmin {
+ 249 : 14022 : if (!paused && gracePeriod != 0) {
+ 250 : 10411 : require(gracePeriod <= MAX_GRACE_PERIOD, Errors.INVALID_GRACE_PERIOD);
+ 251 : :
+ 252 : 9411 : uint40 until = uint40(block.timestamp) + gracePeriod;
+ 253 : 9411 : _pool.setLiquidationGracePeriod(asset, until);
+ 254 : 9411 : emit LiquidationGracePeriodChanged(asset, until);
+ 255 : : }
+ 256 : :
+ 257 : 13022 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
+ 258 : 13022 : currentConfig.setPaused(paused);
+ 259 : 13022 : _pool.setConfiguration(asset, currentConfig);
+ 260 : 13022 : emit ReservePaused(asset, paused);
+ 261 : : }
+ 262 : :
+ 263 : : /// @inheritdoc IPoolConfigurator
+ 264 : : function setReservePause(address asset, bool paused) external override onlyEmergencyOrPoolAdmin {
+ 265 : 1001 : setReservePause(asset, paused, 0);
+ 266 : : }
+ 267 : :
+ 268 : : /// @inheritdoc IPoolConfigurator
+ 269 : : function disableLiquidationGracePeriod(address asset) external override onlyEmergencyOrPoolAdmin {
+ 270 : : // set the liquidation grace period in the past to disable liquidation grace period
+ 271 : 1001 : _pool.setLiquidationGracePeriod(asset, 0);
+ 272 : :
+ 273 : 1001 : emit LiquidationGracePeriodDisabled(asset);
+ 274 : : }
275 : :
- 276 : 28112 : uint40 until = uint40(block.timestamp) + gracePeriod;
- 277 : 14056 : _pool.setLiquidationGracePeriod(asset, until);
- 278 : 14056 : emit LiquidationGracePeriodChanged(asset, until);
- 279 : : }
- 280 : :
- 281 : 23700 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
- 282 : 15800 : currentConfig.setPaused(paused);
- 283 : 15800 : _pool.setConfiguration(asset, currentConfig);
- 284 : 15800 : emit ReservePaused(asset, paused);
- 285 : : }
- 286 : :
- 287 : : /// @inheritdoc IPoolConfigurator
- 288 : : function setReservePause(address asset, bool paused) public override onlyEmergencyOrPoolAdmin {
- 289 : 0 : setReservePause(asset, paused, 0);
- 290 : : }
- 291 : :
- 292 : : /// @inheritdoc IPoolConfigurator
- 293 : 1749 : function setReserveFactor(
- 294 : : address asset,
- 295 : : uint256 newReserveFactor
- 296 : : ) external override onlyRiskOrPoolAdmins {
- 297 : 3496 : require(newReserveFactor <= PercentageMath.PERCENTAGE_FACTOR, Errors.INVALID_RESERVE_FACTOR);
- 298 : :
- 299 : 3494 : _pool.syncIndexesState(asset);
+ 276 : : /// @inheritdoc IPoolConfigurator
+ 277 : : function setReserveFactor(
+ 278 : : address asset,
+ 279 : : uint256 newReserveFactor
+ 280 : : ) external override onlyRiskOrPoolAdmins {
+ 281 : 1949 : require(newReserveFactor <= PercentageMath.PERCENTAGE_FACTOR, Errors.INVALID_RESERVE_FACTOR);
+ 282 : :
+ 283 : 1948 : _pool.syncIndexesState(asset);
+ 284 : :
+ 285 : 1948 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
+ 286 : 1948 : uint256 oldReserveFactor = currentConfig.getReserveFactor();
+ 287 : 1948 : currentConfig.setReserveFactor(newReserveFactor);
+ 288 : 1948 : _pool.setConfiguration(asset, currentConfig);
+ 289 : 1948 : emit ReserveFactorChanged(asset, oldReserveFactor, newReserveFactor);
+ 290 : :
+ 291 : 1948 : _pool.syncRatesState(asset);
+ 292 : : }
+ 293 : :
+ 294 : : /// @inheritdoc IPoolConfigurator
+ 295 : : function setDebtCeiling(
+ 296 : : address asset,
+ 297 : : uint256 newDebtCeiling
+ 298 : : ) external override onlyRiskOrPoolAdmins {
+ 299 : 1964 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
300 : :
- 301 : 5241 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
- 302 : 5241 : uint256 oldReserveFactor = currentConfig.getReserveFactor();
- 303 : 3494 : currentConfig.setReserveFactor(newReserveFactor);
- 304 : 3494 : _pool.setConfiguration(asset, currentConfig);
- 305 : 3494 : emit ReserveFactorChanged(asset, oldReserveFactor, newReserveFactor);
- 306 : :
- 307 : 3494 : _pool.syncRatesState(asset);
- 308 : : }
- 309 : :
- 310 : : /// @inheritdoc IPoolConfigurator
- 311 : 1765 : function setDebtCeiling(
- 312 : : address asset,
- 313 : : uint256 newDebtCeiling
- 314 : : ) external override onlyRiskOrPoolAdmins {
- 315 : 5292 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
- 316 : :
- 317 : 5292 : uint256 oldDebtCeiling = currentConfig.getDebtCeiling();
- 318 : 8819 : if (currentConfig.getLiquidationThreshold() != 0 && oldDebtCeiling == 0) {
- 319 : 3520 : _checkNoSuppliers(asset);
- 320 : : }
- 321 : 3526 : currentConfig.setDebtCeiling(newDebtCeiling);
- 322 : 3526 : _pool.setConfiguration(asset, currentConfig);
- 323 : :
- 324 : 3526 : if (newDebtCeiling == 0) {
- 325 : 3498 : _pool.resetIsolationModeTotalDebt(asset);
- 326 : : }
- 327 : :
- 328 : 3526 : emit DebtCeilingChanged(asset, oldDebtCeiling, newDebtCeiling);
- 329 : : }
+ 301 : 1964 : uint256 oldDebtCeiling = currentConfig.getDebtCeiling();
+ 302 : 1964 : if (currentConfig.getLiquidationThreshold() != 0 && oldDebtCeiling == 0) {
+ 303 : 1960 : _checkNoSuppliers(asset);
+ 304 : : }
+ 305 : 1963 : currentConfig.setDebtCeiling(newDebtCeiling);
+ 306 : 1963 : _pool.setConfiguration(asset, currentConfig);
+ 307 : :
+ 308 : 1963 : if (newDebtCeiling == 0) {
+ 309 : 1949 : _pool.resetIsolationModeTotalDebt(asset);
+ 310 : : }
+ 311 : :
+ 312 : 1963 : emit DebtCeilingChanged(asset, oldDebtCeiling, newDebtCeiling);
+ 313 : : }
+ 314 : :
+ 315 : : /// @inheritdoc IPoolConfigurator
+ 316 : : function setSiloedBorrowing(
+ 317 : : address asset,
+ 318 : : bool newSiloed
+ 319 : : ) external override onlyRiskOrPoolAdmins {
+ 320 : 1949 : if (newSiloed) {
+ 321 : 3 : _checkNoBorrowers(asset);
+ 322 : : }
+ 323 : 1948 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
+ 324 : :
+ 325 : 1948 : bool oldSiloed = currentConfig.getSiloedBorrowing();
+ 326 : :
+ 327 : 1948 : currentConfig.setSiloedBorrowing(newSiloed);
+ 328 : :
+ 329 : 1948 : _pool.setConfiguration(asset, currentConfig);
330 : :
- 331 : : /// @inheritdoc IPoolConfigurator
- 332 : 1749 : function setSiloedBorrowing(
- 333 : : address asset,
- 334 : : bool newSiloed
- 335 : : ) external override onlyRiskOrPoolAdmins {
- 336 : 1749 : if (newSiloed) {
- 337 : 6 : _checkNoBorrowers(asset);
- 338 : : }
- 339 : 5244 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
- 340 : :
- 341 : 5244 : bool oldSiloed = currentConfig.getSiloedBorrowing();
- 342 : :
- 343 : 3496 : currentConfig.setSiloedBorrowing(newSiloed);
- 344 : :
- 345 : 3496 : _pool.setConfiguration(asset, currentConfig);
- 346 : :
- 347 : 3496 : emit SiloedBorrowingChanged(asset, oldSiloed, newSiloed);
- 348 : : }
- 349 : :
- 350 : : /// @inheritdoc IPoolConfigurator
- 351 : 1759 : function setBorrowCap(
- 352 : : address asset,
- 353 : : uint256 newBorrowCap
- 354 : : ) external override onlyRiskOrPoolAdmins {
- 355 : 5271 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
- 356 : 5271 : uint256 oldBorrowCap = currentConfig.getBorrowCap();
- 357 : 3514 : currentConfig.setBorrowCap(newBorrowCap);
- 358 : 3512 : _pool.setConfiguration(asset, currentConfig);
- 359 : 3512 : emit BorrowCapChanged(asset, oldBorrowCap, newBorrowCap);
- 360 : : }
- 361 : :
- 362 : : /// @inheritdoc IPoolConfigurator
- 363 : 1762 : function setSupplyCap(
- 364 : : address asset,
- 365 : : uint256 newSupplyCap
- 366 : : ) external override onlyRiskOrPoolAdmins {
- 367 : 5280 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
- 368 : 5280 : uint256 oldSupplyCap = currentConfig.getSupplyCap();
- 369 : 3520 : currentConfig.setSupplyCap(newSupplyCap);
- 370 : 3518 : _pool.setConfiguration(asset, currentConfig);
- 371 : 3518 : emit SupplyCapChanged(asset, oldSupplyCap, newSupplyCap);
- 372 : : }
- 373 : :
- 374 : : /// @inheritdoc IPoolConfigurator
- 375 : 1754 : function setLiquidationProtocolFee(
- 376 : : address asset,
- 377 : : uint256 newFee
+ 331 : 1948 : emit SiloedBorrowingChanged(asset, oldSiloed, newSiloed);
+ 332 : : }
+ 333 : :
+ 334 : : /// @inheritdoc IPoolConfigurator
+ 335 : : function setBorrowCap(
+ 336 : : address asset,
+ 337 : : uint256 newBorrowCap
+ 338 : : ) external override onlyRiskOrPoolAdmins {
+ 339 : 1956 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
+ 340 : 1956 : uint256 oldBorrowCap = currentConfig.getBorrowCap();
+ 341 : 1956 : currentConfig.setBorrowCap(newBorrowCap);
+ 342 : 1955 : _pool.setConfiguration(asset, currentConfig);
+ 343 : 1955 : emit BorrowCapChanged(asset, oldBorrowCap, newBorrowCap);
+ 344 : : }
+ 345 : :
+ 346 : : /// @inheritdoc IPoolConfigurator
+ 347 : : function setSupplyCap(
+ 348 : : address asset,
+ 349 : : uint256 newSupplyCap
+ 350 : : ) external override onlyRiskOrPoolAdmins {
+ 351 : 2962 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
+ 352 : 2962 : uint256 oldSupplyCap = currentConfig.getSupplyCap();
+ 353 : 2962 : currentConfig.setSupplyCap(newSupplyCap);
+ 354 : 2961 : _pool.setConfiguration(asset, currentConfig);
+ 355 : 2961 : emit SupplyCapChanged(asset, oldSupplyCap, newSupplyCap);
+ 356 : : }
+ 357 : :
+ 358 : : /// @inheritdoc IPoolConfigurator
+ 359 : : function setLiquidationProtocolFee(
+ 360 : : address asset,
+ 361 : : uint256 newFee
+ 362 : : ) external override onlyRiskOrPoolAdmins {
+ 363 : 1953 : require(newFee <= PercentageMath.PERCENTAGE_FACTOR, Errors.INVALID_LIQUIDATION_PROTOCOL_FEE);
+ 364 : 1951 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
+ 365 : 1951 : uint256 oldFee = currentConfig.getLiquidationProtocolFee();
+ 366 : 1951 : currentConfig.setLiquidationProtocolFee(newFee);
+ 367 : 1951 : _pool.setConfiguration(asset, currentConfig);
+ 368 : 1951 : emit LiquidationProtocolFeeChanged(asset, oldFee, newFee);
+ 369 : : }
+ 370 : :
+ 371 : : /// @inheritdoc IPoolConfigurator
+ 372 : : function setEModeCategory(
+ 373 : : uint8 categoryId,
+ 374 : : uint16 ltv,
+ 375 : : uint16 liquidationThreshold,
+ 376 : : uint16 liquidationBonus,
+ 377 : : string calldata label
378 : : ) external override onlyRiskOrPoolAdmins {
- 379 : 3506 : require(newFee <= PercentageMath.PERCENTAGE_FACTOR, Errors.INVALID_LIQUIDATION_PROTOCOL_FEE);
- 380 : 5253 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
- 381 : 5253 : uint256 oldFee = currentConfig.getLiquidationProtocolFee();
- 382 : 3502 : currentConfig.setLiquidationProtocolFee(newFee);
- 383 : 3502 : _pool.setConfiguration(asset, currentConfig);
- 384 : 3502 : emit LiquidationProtocolFeeChanged(asset, oldFee, newFee);
- 385 : : }
- 386 : :
- 387 : : /// @inheritdoc IPoolConfigurator
- 388 : 38 : function setEModeCategory(
- 389 : : uint8 categoryId,
- 390 : : uint16 ltv,
- 391 : : uint16 liquidationThreshold,
- 392 : : uint16 liquidationBonus,
- 393 : : address oracle,
- 394 : : string calldata label
- 395 : : ) external override onlyRiskOrPoolAdmins {
- 396 : 74 : require(ltv != 0, Errors.INVALID_EMODE_CATEGORY_PARAMS);
- 397 : 72 : require(liquidationThreshold != 0, Errors.INVALID_EMODE_CATEGORY_PARAMS);
+ 379 : 10035 : require(ltv != 0, Errors.INVALID_EMODE_CATEGORY_PARAMS);
+ 380 : 10034 : require(liquidationThreshold != 0, Errors.INVALID_EMODE_CATEGORY_PARAMS);
+ 381 : :
+ 382 : : // validation of the parameters: the LTV can
+ 383 : : // only be lower or equal than the liquidation threshold
+ 384 : : // (otherwise a loan against the asset would cause instantaneous liquidation)
+ 385 : 10033 : require(ltv <= liquidationThreshold, Errors.INVALID_EMODE_CATEGORY_PARAMS);
+ 386 : 10032 : require(
+ 387 : : liquidationBonus > PercentageMath.PERCENTAGE_FACTOR,
+ 388 : : Errors.INVALID_EMODE_CATEGORY_PARAMS
+ 389 : : );
+ 390 : :
+ 391 : : // if threshold * bonus is less than PERCENTAGE_FACTOR, it's guaranteed that at the moment
+ 392 : : // a loan is taken there is enough collateral available to cover the liquidation bonus
+ 393 : 10030 : require(
+ 394 : : uint256(liquidationThreshold).percentMul(liquidationBonus) <=
+ 395 : : PercentageMath.PERCENTAGE_FACTOR,
+ 396 : : Errors.INVALID_EMODE_CATEGORY_PARAMS
+ 397 : : );
398 : :
- 399 : : // validation of the parameters: the LTV can
- 400 : : // only be lower or equal than the liquidation threshold
- 401 : : // (otherwise a loan against the asset would cause instantaneous liquidation)
- 402 : 70 : require(ltv <= liquidationThreshold, Errors.INVALID_EMODE_CATEGORY_PARAMS);
- 403 : 66 : require(
- 404 : : liquidationBonus > PercentageMath.PERCENTAGE_FACTOR,
- 405 : : Errors.INVALID_EMODE_CATEGORY_PARAMS
- 406 : : );
- 407 : :
- 408 : : // if threshold * bonus is less than PERCENTAGE_FACTOR, it's guaranteed that at the moment
- 409 : : // a loan is taken there is enough collateral available to cover the liquidation bonus
- 410 : 62 : require(
- 411 : : uint256(liquidationThreshold).percentMul(liquidationBonus) <=
- 412 : : PercentageMath.PERCENTAGE_FACTOR,
- 413 : : Errors.INVALID_EMODE_CATEGORY_PARAMS
- 414 : : );
+ 399 : 10029 : DataTypes.EModeCategoryBaseConfiguration memory categoryData;
+ 400 : 10029 : categoryData.ltv = ltv;
+ 401 : 10029 : categoryData.liquidationThreshold = liquidationThreshold;
+ 402 : 10029 : categoryData.liquidationBonus = liquidationBonus;
+ 403 : 10029 : categoryData.label = label;
+ 404 : :
+ 405 : 10029 : _pool.configureEModeCategory(categoryId, categoryData);
+ 406 : 10029 : emit EModeCategoryAdded(
+ 407 : : categoryId,
+ 408 : : ltv,
+ 409 : : liquidationThreshold,
+ 410 : : liquidationBonus,
+ 411 : : address(0),
+ 412 : : label
+ 413 : : );
+ 414 : : }
415 : :
- 416 : 90 : address[] memory reserves = _pool.getReservesList();
- 417 : 256 : for (uint256 i = 0; i < reserves.length; i++) {
- 418 : 258 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(reserves[i]);
- 419 : 258 : if (categoryId == currentConfig.getEModeCategory()) {
- 420 : 6 : require(ltv > currentConfig.getLtv(), Errors.INVALID_EMODE_CATEGORY_PARAMS);
- 421 : 2 : require(
- 422 : : liquidationThreshold > currentConfig.getLiquidationThreshold(),
- 423 : : Errors.INVALID_EMODE_CATEGORY_PARAMS
- 424 : : );
- 425 : : }
- 426 : : }
- 427 : :
- 428 : 54 : _pool.configureEModeCategory(
- 429 : : categoryId,
- 430 : : DataTypes.EModeCategory({
- 431 : : ltv: ltv,
- 432 : : liquidationThreshold: liquidationThreshold,
- 433 : : liquidationBonus: liquidationBonus,
- 434 : : priceSource: oracle,
- 435 : : label: label
- 436 : : })
- 437 : : );
- 438 : 54 : emit EModeCategoryAdded(categoryId, ltv, liquidationThreshold, liquidationBonus, oracle, label);
- 439 : : }
- 440 : :
- 441 : : /// @inheritdoc IPoolConfigurator
- 442 : 1786 : function setAssetEModeCategory(
- 443 : : address asset,
- 444 : : uint8 newCategoryId
- 445 : : ) external override onlyRiskOrPoolAdmins {
- 446 : 5355 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
- 447 : :
- 448 : 3570 : if (newCategoryId != 0) {
- 449 : 114 : DataTypes.EModeCategory memory categoryData = _pool.getEModeCategoryData(newCategoryId);
- 450 : 76 : require(
- 451 : : categoryData.liquidationThreshold > currentConfig.getLiquidationThreshold(),
- 452 : : Errors.INVALID_EMODE_CATEGORY_ASSIGNMENT
- 453 : : );
- 454 : : }
- 455 : 5352 : uint256 oldCategoryId = currentConfig.getEModeCategory();
- 456 : 3568 : currentConfig.setEModeCategory(newCategoryId);
- 457 : 3568 : _pool.setConfiguration(asset, currentConfig);
- 458 : 3568 : emit EModeAssetCategoryChanged(asset, uint8(oldCategoryId), newCategoryId);
- 459 : : }
- 460 : :
- 461 : : /// @inheritdoc IPoolConfigurator
- 462 : 7 : function setUnbackedMintCap(
- 463 : : address asset,
- 464 : : uint256 newUnbackedMintCap
- 465 : : ) external override onlyRiskOrPoolAdmins {
- 466 : 21 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
- 467 : 21 : uint256 oldUnbackedMintCap = currentConfig.getUnbackedMintCap();
- 468 : 14 : currentConfig.setUnbackedMintCap(newUnbackedMintCap);
- 469 : 14 : _pool.setConfiguration(asset, currentConfig);
- 470 : 14 : emit UnbackedMintCapChanged(asset, oldUnbackedMintCap, newUnbackedMintCap);
+ 416 : : /// @inheritdoc IPoolConfigurator
+ 417 : : function setAssetCollateralInEMode(
+ 418 : : address asset,
+ 419 : : uint8 categoryId,
+ 420 : : bool allowed
+ 421 : : ) external override onlyRiskOrPoolAdmins {
+ 422 : 10039 : uint128 collateralBitmap = _pool.getEModeCategoryCollateralBitmap(categoryId);
+ 423 : 10039 : DataTypes.ReserveDataLegacy memory reserveData = _pool.getReserveData(asset);
+ 424 : 10039 : require(reserveData.id != 0 || _pool.getReservesList()[0] == asset, Errors.ASSET_NOT_LISTED);
+ 425 : 10039 : collateralBitmap = EModeConfiguration.setReserveBitmapBit(
+ 426 : : collateralBitmap,
+ 427 : : reserveData.id,
+ 428 : : allowed
+ 429 : : );
+ 430 : 10039 : _pool.configureEModeCategoryCollateralBitmap(categoryId, collateralBitmap);
+ 431 : 10039 : emit AssetCollateralInEModeChanged(asset, categoryId, allowed);
+ 432 : : }
+ 433 : :
+ 434 : : /// @inheritdoc IPoolConfigurator
+ 435 : : function setAssetBorrowableInEMode(
+ 436 : : address asset,
+ 437 : : uint8 categoryId,
+ 438 : : bool borrowable
+ 439 : : ) external override onlyRiskOrPoolAdmins {
+ 440 : 7010 : uint128 borrowableBitmap = _pool.getEModeCategoryBorrowableBitmap(categoryId);
+ 441 : 7010 : DataTypes.ReserveDataLegacy memory reserveData = _pool.getReserveData(asset);
+ 442 : 7010 : require(reserveData.id != 0 || _pool.getReservesList()[0] == asset, Errors.ASSET_NOT_LISTED);
+ 443 : 7010 : borrowableBitmap = EModeConfiguration.setReserveBitmapBit(
+ 444 : : borrowableBitmap,
+ 445 : : reserveData.id,
+ 446 : : borrowable
+ 447 : : );
+ 448 : 7010 : _pool.configureEModeCategoryBorrowableBitmap(categoryId, borrowableBitmap);
+ 449 : 7010 : emit AssetBorrowableInEModeChanged(asset, categoryId, borrowable);
+ 450 : : }
+ 451 : :
+ 452 : : /// @inheritdoc IPoolConfigurator
+ 453 : : function setUnbackedMintCap(
+ 454 : : address asset,
+ 455 : : uint256 newUnbackedMintCap
+ 456 : : ) external override onlyRiskOrPoolAdmins {
+ 457 : 7 : DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
+ 458 : 7 : uint256 oldUnbackedMintCap = currentConfig.getUnbackedMintCap();
+ 459 : 7 : currentConfig.setUnbackedMintCap(newUnbackedMintCap);
+ 460 : 7 : _pool.setConfiguration(asset, currentConfig);
+ 461 : 7 : emit UnbackedMintCapChanged(asset, oldUnbackedMintCap, newUnbackedMintCap);
+ 462 : : }
+ 463 : :
+ 464 : : /// @inheritdoc IPoolConfigurator
+ 465 : : function setReserveInterestRateData(
+ 466 : : address asset,
+ 467 : : bytes calldata rateData
+ 468 : : ) external onlyRiskOrPoolAdmins {
+ 469 : 2 : DataTypes.ReserveDataLegacy memory reserve = _pool.getReserveData(asset);
+ 470 : 2 : _updateInterestRateStrategy(asset, reserve, reserve.interestRateStrategyAddress, rateData);
471 : : }
472 : :
473 : : /// @inheritdoc IPoolConfigurator
- 474 : 0 : function setReserveInterestRateData(
+ 474 : : function setReserveInterestRateStrategyAddress(
475 : : address asset,
- 476 : : bytes calldata rateData
- 477 : : ) external onlyRiskOrPoolAdmins {
- 478 : 0 : DataTypes.ReserveDataLegacy memory reserve = _pool.getReserveData(asset);
- 479 : 0 : _updateInterestRateStrategy(asset, reserve, reserve.interestRateStrategyAddress, rateData);
- 480 : : }
- 481 : :
- 482 : : /// @inheritdoc IPoolConfigurator
- 483 : 5 : function setReserveInterestRateStrategyAddress(
- 484 : : address asset,
- 485 : : address rateStrategyAddress,
- 486 : : bytes calldata rateData
- 487 : : ) external override onlyRiskOrPoolAdmins {
- 488 : 12 : DataTypes.ReserveDataLegacy memory reserve = _pool.getReserveData(asset);
- 489 : 8 : _updateInterestRateStrategy(asset, reserve, rateStrategyAddress, rateData);
- 490 : : }
- 491 : :
- 492 : : /// @inheritdoc IPoolConfigurator
- 493 : 3003 : function setPoolPause(bool paused, uint40 gracePeriod) public override onlyEmergencyOrPoolAdmin {
- 494 : 3009 : address[] memory reserves = _pool.getReservesList();
- 495 : :
- 496 : 9027 : for (uint256 i = 0; i < reserves.length; i++) {
- 497 : 9027 : if (reserves[i] != address(0)) {
- 498 : 6018 : setReservePause(reserves[i], paused, gracePeriod);
- 499 : : }
- 500 : : }
- 501 : : }
- 502 : :
- 503 : : /// @inheritdoc IPoolConfigurator
- 504 : : function setPoolPause(bool paused) external override onlyEmergencyOrPoolAdmin {
- 505 : 0 : setPoolPause(paused, 0);
- 506 : : }
- 507 : :
- 508 : : /// @inheritdoc IPoolConfigurator
- 509 : 14 : function updateBridgeProtocolFee(uint256 newBridgeProtocolFee) external override onlyPoolAdmin {
- 510 : 28 : require(
- 511 : : newBridgeProtocolFee <= PercentageMath.PERCENTAGE_FACTOR,
- 512 : : Errors.BRIDGE_PROTOCOL_FEE_INVALID
- 513 : : );
- 514 : 39 : uint256 oldBridgeProtocolFee = _pool.BRIDGE_PROTOCOL_FEE();
- 515 : 26 : _pool.updateBridgeProtocolFee(newBridgeProtocolFee);
- 516 : 26 : emit BridgeProtocolFeeUpdated(oldBridgeProtocolFee, newBridgeProtocolFee);
- 517 : : }
- 518 : :
- 519 : : /// @inheritdoc IPoolConfigurator
- 520 : 608 : function updateFlashloanPremiumTotal(
- 521 : : uint128 newFlashloanPremiumTotal
- 522 : : ) external override onlyPoolAdmin {
- 523 : 1214 : require(
- 524 : : newFlashloanPremiumTotal <= PercentageMath.PERCENTAGE_FACTOR,
- 525 : : Errors.FLASHLOAN_PREMIUM_INVALID
- 526 : : );
- 527 : 1818 : uint128 oldFlashloanPremiumTotal = _pool.FLASHLOAN_PREMIUM_TOTAL();
- 528 : 1212 : _pool.updateFlashloanPremiums(newFlashloanPremiumTotal, _pool.FLASHLOAN_PREMIUM_TO_PROTOCOL());
- 529 : 1212 : emit FlashloanPremiumTotalUpdated(oldFlashloanPremiumTotal, newFlashloanPremiumTotal);
- 530 : : }
- 531 : :
- 532 : : /// @inheritdoc IPoolConfigurator
- 533 : 608 : function updateFlashloanPremiumToProtocol(
- 534 : : uint128 newFlashloanPremiumToProtocol
- 535 : : ) external override onlyPoolAdmin {
- 536 : 1214 : require(
- 537 : : newFlashloanPremiumToProtocol <= PercentageMath.PERCENTAGE_FACTOR,
- 538 : : Errors.FLASHLOAN_PREMIUM_INVALID
- 539 : : );
- 540 : 1818 : uint128 oldFlashloanPremiumToProtocol = _pool.FLASHLOAN_PREMIUM_TO_PROTOCOL();
- 541 : 1212 : _pool.updateFlashloanPremiums(_pool.FLASHLOAN_PREMIUM_TOTAL(), newFlashloanPremiumToProtocol);
- 542 : 1212 : emit FlashloanPremiumToProtocolUpdated(
- 543 : : oldFlashloanPremiumToProtocol,
- 544 : : newFlashloanPremiumToProtocol
- 545 : : );
- 546 : : }
- 547 : :
- 548 : : /// @inheritdoc IPoolConfigurator
- 549 : 2003 : function getPendingLtv(address asset) external view override returns (uint256, bool) {
- 550 : 4006 : return (_pendingLtv[asset], _isPendingLtvSet[asset]);
- 551 : : }
- 552 : :
- 553 : : /// @inheritdoc IPoolConfigurator
- 554 : 1 : function getConfiguratorLogic() external pure returns (address) {
- 555 : 3 : return address(ConfiguratorLogic);
- 556 : : }
- 557 : :
- 558 : 4 : function _updateInterestRateStrategy(
- 559 : : address asset,
- 560 : : DataTypes.ReserveDataLegacy memory reserve,
- 561 : : address newRateStrategyAddress,
- 562 : : bytes calldata rateData
- 563 : : ) internal {
- 564 : 8 : address oldRateStrategyAddress = reserve.interestRateStrategyAddress;
- 565 : :
- 566 : 8 : _pool.syncIndexesState(asset);
- 567 : :
- 568 : 8 : IDefaultInterestRateStrategyV2(newRateStrategyAddress).setInterestRateParams(asset, rateData);
- 569 : 8 : emit ReserveInterestRateDataChanged(asset, newRateStrategyAddress, rateData);
+ 476 : : address rateStrategyAddress,
+ 477 : : bytes calldata rateData
+ 478 : : ) external override onlyRiskOrPoolAdmins {
+ 479 : 44 : DataTypes.ReserveDataLegacy memory reserve = _pool.getReserveData(asset);
+ 480 : 44 : _updateInterestRateStrategy(asset, reserve, rateStrategyAddress, rateData);
+ 481 : : }
+ 482 : :
+ 483 : : /// @inheritdoc IPoolConfigurator
+ 484 : : function setPoolPause(bool paused, uint40 gracePeriod) public override onlyEmergencyOrPoolAdmin {
+ 485 : 1003 : address[] memory reserves = _pool.getReservesList();
+ 486 : :
+ 487 : 1003 : for (uint256 i = 0; i < reserves.length; i++) {
+ 488 : 3009 : if (reserves[i] != address(0)) {
+ 489 : 3009 : setReservePause(reserves[i], paused, gracePeriod);
+ 490 : : }
+ 491 : : }
+ 492 : : }
+ 493 : :
+ 494 : : /// @inheritdoc IPoolConfigurator
+ 495 : : function setPoolPause(bool paused) external override onlyEmergencyOrPoolAdmin {
+ 496 : 3 : setPoolPause(paused, 0);
+ 497 : : }
+ 498 : :
+ 499 : : /// @inheritdoc IPoolConfigurator
+ 500 : : function updateBridgeProtocolFee(uint256 newBridgeProtocolFee) external override onlyPoolAdmin {
+ 501 : 14 : require(
+ 502 : : newBridgeProtocolFee <= PercentageMath.PERCENTAGE_FACTOR,
+ 503 : : Errors.BRIDGE_PROTOCOL_FEE_INVALID
+ 504 : : );
+ 505 : 13 : uint256 oldBridgeProtocolFee = _pool.BRIDGE_PROTOCOL_FEE();
+ 506 : 13 : _pool.updateBridgeProtocolFee(newBridgeProtocolFee);
+ 507 : 13 : emit BridgeProtocolFeeUpdated(oldBridgeProtocolFee, newBridgeProtocolFee);
+ 508 : : }
+ 509 : :
+ 510 : : /// @inheritdoc IPoolConfigurator
+ 511 : : function updateFlashloanPremiumTotal(
+ 512 : : uint128 newFlashloanPremiumTotal
+ 513 : : ) external override onlyPoolAdmin {
+ 514 : 682 : require(
+ 515 : : newFlashloanPremiumTotal <= PercentageMath.PERCENTAGE_FACTOR,
+ 516 : : Errors.FLASHLOAN_PREMIUM_INVALID
+ 517 : : );
+ 518 : 681 : uint128 oldFlashloanPremiumTotal = _pool.FLASHLOAN_PREMIUM_TOTAL();
+ 519 : 681 : _pool.updateFlashloanPremiums(newFlashloanPremiumTotal, _pool.FLASHLOAN_PREMIUM_TO_PROTOCOL());
+ 520 : 681 : emit FlashloanPremiumTotalUpdated(oldFlashloanPremiumTotal, newFlashloanPremiumTotal);
+ 521 : : }
+ 522 : :
+ 523 : : /// @inheritdoc IPoolConfigurator
+ 524 : : function updateFlashloanPremiumToProtocol(
+ 525 : : uint128 newFlashloanPremiumToProtocol
+ 526 : : ) external override onlyPoolAdmin {
+ 527 : 682 : require(
+ 528 : : newFlashloanPremiumToProtocol <= PercentageMath.PERCENTAGE_FACTOR,
+ 529 : : Errors.FLASHLOAN_PREMIUM_INVALID
+ 530 : : );
+ 531 : 681 : uint128 oldFlashloanPremiumToProtocol = _pool.FLASHLOAN_PREMIUM_TO_PROTOCOL();
+ 532 : 681 : _pool.updateFlashloanPremiums(_pool.FLASHLOAN_PREMIUM_TOTAL(), newFlashloanPremiumToProtocol);
+ 533 : 681 : emit FlashloanPremiumToProtocolUpdated(
+ 534 : : oldFlashloanPremiumToProtocol,
+ 535 : : newFlashloanPremiumToProtocol
+ 536 : : );
+ 537 : : }
+ 538 : :
+ 539 : : /// @inheritdoc IPoolConfigurator
+ 540 : : function getPendingLtv(address asset) external view override returns (uint256) {
+ 541 : 3003 : return _pendingLtv[asset];
+ 542 : : }
+ 543 : :
+ 544 : : /// @inheritdoc IPoolConfigurator
+ 545 : : function getConfiguratorLogic() external pure returns (address) {
+ 546 : 1 : return address(ConfiguratorLogic);
+ 547 : : }
+ 548 : :
+ 549 : : function _updateInterestRateStrategy(
+ 550 : : address asset,
+ 551 : : DataTypes.ReserveDataLegacy memory reserve,
+ 552 : : address newRateStrategyAddress,
+ 553 : : bytes calldata rateData
+ 554 : : ) internal {
+ 555 : 46 : address oldRateStrategyAddress = reserve.interestRateStrategyAddress;
+ 556 : :
+ 557 : 46 : _pool.syncIndexesState(asset);
+ 558 : :
+ 559 : 46 : IDefaultInterestRateStrategyV2(newRateStrategyAddress).setInterestRateParams(asset, rateData);
+ 560 : 46 : emit ReserveInterestRateDataChanged(asset, newRateStrategyAddress, rateData);
+ 561 : :
+ 562 : 46 : if (oldRateStrategyAddress != newRateStrategyAddress) {
+ 563 : 44 : _pool.setReserveInterestRateStrategyAddress(asset, newRateStrategyAddress);
+ 564 : 44 : emit ReserveInterestRateStrategyChanged(
+ 565 : : asset,
+ 566 : : oldRateStrategyAddress,
+ 567 : : newRateStrategyAddress
+ 568 : : );
+ 569 : : }
570 : :
- 571 : 8 : if (oldRateStrategyAddress != newRateStrategyAddress) {
- 572 : 8 : _pool.setReserveInterestRateStrategyAddress(asset, newRateStrategyAddress);
- 573 : 8 : emit ReserveInterestRateStrategyChanged(
- 574 : : asset,
- 575 : : oldRateStrategyAddress,
- 576 : : newRateStrategyAddress
- 577 : : );
- 578 : : }
- 579 : :
- 580 : 8 : _pool.syncRatesState(asset);
- 581 : : }
- 582 : :
- 583 : 1774 : function _checkNoSuppliers(address asset) internal view {
- 584 : 5322 : DataTypes.ReserveDataLegacy memory reserveData = _pool.getReserveData(asset);
- 585 : 5322 : uint256 totalSupplied = IPoolDataProvider(_addressesProvider.getPoolDataProvider())
- 586 : : .getATokenTotalSupply(asset);
- 587 : :
- 588 : 3548 : require(
- 589 : : totalSupplied == 0 && reserveData.accruedToTreasury == 0,
- 590 : : Errors.RESERVE_LIQUIDITY_NOT_ZERO
- 591 : : );
- 592 : : }
- 593 : :
- 594 : 3 : function _checkNoBorrowers(address asset) internal view {
- 595 : 9 : uint256 totalDebt = IPoolDataProvider(_addressesProvider.getPoolDataProvider()).getTotalDebt(
- 596 : : asset
- 597 : : );
- 598 : 6 : require(totalDebt == 0, Errors.RESERVE_DEBT_NOT_ZERO);
- 599 : : }
- 600 : :
- 601 : 1256 : function _onlyPoolAdmin() internal view {
- 602 : 3768 : IACLManager aclManager = IACLManager(_addressesProvider.getACLManager());
- 603 : 2512 : require(aclManager.isPoolAdmin(msg.sender), Errors.CALLER_NOT_POOL_ADMIN);
- 604 : : }
- 605 : :
- 606 : 0 : function _onlyEmergencyAdmin() internal view {
- 607 : 0 : IACLManager aclManager = IACLManager(_addressesProvider.getACLManager());
- 608 : 0 : require(aclManager.isEmergencyAdmin(msg.sender), Errors.CALLER_NOT_EMERGENCY_ADMIN);
- 609 : : }
- 610 : :
- 611 : 14903 : function _onlyPoolOrEmergencyAdmin() internal view {
- 612 : 44709 : IACLManager aclManager = IACLManager(_addressesProvider.getACLManager());
- 613 : 29806 : require(
- 614 : : aclManager.isPoolAdmin(msg.sender) || aclManager.isEmergencyAdmin(msg.sender),
- 615 : : Errors.CALLER_NOT_POOL_OR_EMERGENCY_ADMIN
- 616 : : );
- 617 : : }
- 618 : :
- 619 : 2592 : function _onlyAssetListingOrPoolAdmins() internal view {
- 620 : 7776 : IACLManager aclManager = IACLManager(_addressesProvider.getACLManager());
- 621 : 5184 : require(
- 622 : : aclManager.isAssetListingAdmin(msg.sender) || aclManager.isPoolAdmin(msg.sender),
- 623 : : Errors.CALLER_NOT_ASSET_LISTING_OR_POOL_ADMIN
- 624 : : );
- 625 : : }
- 626 : :
- 627 : 24323 : function _onlyRiskOrPoolAdmins() internal view {
- 628 : 72969 : IACLManager aclManager = IACLManager(_addressesProvider.getACLManager());
- 629 : 48646 : require(
- 630 : : aclManager.isRiskAdmin(msg.sender) || aclManager.isPoolAdmin(msg.sender),
- 631 : : Errors.CALLER_NOT_RISK_OR_POOL_ADMIN
- 632 : : );
- 633 : : }
- 634 : :
- 635 : 1011 : function _onlyRiskOrPoolOrEmergencyAdmins() internal view {
- 636 : 3033 : IACLManager aclManager = IACLManager(_addressesProvider.getACLManager());
- 637 : 2022 : require(
- 638 : : aclManager.isRiskAdmin(msg.sender) ||
- 639 : : aclManager.isPoolAdmin(msg.sender) ||
- 640 : : aclManager.isEmergencyAdmin(msg.sender),
- 641 : : Errors.CALLER_NOT_RISK_OR_POOL_OR_EMERGENCY_ADMIN
- 642 : : );
- 643 : : }
- 644 : : }
+ 571 : 46 : _pool.syncRatesState(asset);
+ 572 : : }
+ 573 : :
+ 574 : : function _checkNoSuppliers(address asset) internal view {
+ 575 : 2971 : DataTypes.ReserveDataLegacy memory reserveData = _pool.getReserveData(asset);
+ 576 : 2971 : uint256 totalSupplied = IPoolDataProvider(_addressesProvider.getPoolDataProvider())
+ 577 : : .getATokenTotalSupply(asset);
+ 578 : :
+ 579 : 2971 : require(
+ 580 : : totalSupplied == 0 && reserveData.accruedToTreasury == 0,
+ 581 : : Errors.RESERVE_LIQUIDITY_NOT_ZERO
+ 582 : : );
+ 583 : : }
+ 584 : :
+ 585 : : function _checkNoBorrowers(address asset) internal view {
+ 586 : 3 : uint256 totalDebt = IPoolDataProvider(_addressesProvider.getPoolDataProvider()).getTotalDebt(
+ 587 : : asset
+ 588 : : );
+ 589 : 3 : require(totalDebt == 0, Errors.RESERVE_DEBT_NOT_ZERO);
+ 590 : : }
+ 591 : :
+ 592 : : function _onlyPoolAdmin() internal view {
+ 593 : 7396 : IACLManager aclManager = IACLManager(_addressesProvider.getACLManager());
+ 594 : 7396 : require(aclManager.isPoolAdmin(msg.sender), Errors.CALLER_NOT_POOL_ADMIN);
+ 595 : : }
+ 596 : :
+ 597 : : function _onlyPoolOrEmergencyAdmin() internal view {
+ 598 : 24030 : IACLManager aclManager = IACLManager(_addressesProvider.getACLManager());
+ 599 : 24030 : require(
+ 600 : : aclManager.isPoolAdmin(msg.sender) || aclManager.isEmergencyAdmin(msg.sender),
+ 601 : : Errors.CALLER_NOT_POOL_OR_EMERGENCY_ADMIN
+ 602 : : );
+ 603 : : }
+ 604 : :
+ 605 : : function _onlyAssetListingOrPoolAdmins() internal view {
+ 606 : 8651 : IACLManager aclManager = IACLManager(_addressesProvider.getACLManager());
+ 607 : 8651 : require(
+ 608 : : aclManager.isAssetListingAdmin(msg.sender) || aclManager.isPoolAdmin(msg.sender),
+ 609 : : Errors.CALLER_NOT_ASSET_LISTING_OR_POOL_ADMIN
+ 610 : : );
+ 611 : : }
+ 612 : :
+ 613 : : function _onlyRiskOrPoolAdmins() internal view {
+ 614 : 70679 : IACLManager aclManager = IACLManager(_addressesProvider.getACLManager());
+ 615 : 70679 : require(
+ 616 : : aclManager.isRiskAdmin(msg.sender) || aclManager.isPoolAdmin(msg.sender),
+ 617 : : Errors.CALLER_NOT_RISK_OR_POOL_ADMIN
+ 618 : : );
+ 619 : : }
+ 620 : :
+ 621 : : function _onlyRiskOrPoolOrEmergencyAdmins() internal view {
+ 622 : 3014 : IACLManager aclManager = IACLManager(_addressesProvider.getACLManager());
+ 623 : 3014 : require(
+ 624 : : aclManager.isRiskAdmin(msg.sender) ||
+ 625 : : aclManager.isPoolAdmin(msg.sender) ||
+ 626 : : aclManager.isEmergencyAdmin(msg.sender),
+ 627 : : Errors.CALLER_NOT_RISK_OR_POOL_OR_EMERGENCY_ADMIN
+ 628 : : );
+ 629 : : }
+ 630 : : }
@@ -720,8 +706,8 @@
diff --git a/report/protocol/pool/index-sort-b.html b/report/protocol/pool/index-sort-b.html
new file mode 100644
index 00000000..4a505ab3
--- /dev/null
+++ b/report/protocol/pool/index-sort-b.html
@@ -0,0 +1,154 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - protocol/pool
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../glass.png) |
+
+ |
+
+
+ ![](../../glass.png) |
+
+
+
+
+
+
+
|
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+ File ![Click to sort table by file name Sort by file name](../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../glass.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../updown.png) |
+
+
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+
+
+ L2Pool.sol |
+
+
+ |
+ 100.0 % |
+ 20 |
+ 20 |
+ - |
+ |
+ |
+ 100.0 % |
+ 9 |
+ 9 |
+
+
+ Pool.sol |
+
+
+ |
+ 98.3 % |
+ 121 |
+ 119 |
+ - |
+ |
+ |
+ 100.0 % |
+ 67 |
+ 67 |
+
+
+ PoolConfigurator.sol |
+
+
+ |
+ 100.0 % |
+ 190 |
+ 190 |
+ - |
+ |
+ |
+ 100.0 % |
+ 43 |
+ 43 |
+
+
+
+
+
+
+
+
+
+
diff --git a/report/protocol/pool/index-sort-f.html b/report/protocol/pool/index-sort-f.html
new file mode 100644
index 00000000..3acdb117
--- /dev/null
+++ b/report/protocol/pool/index-sort-f.html
@@ -0,0 +1,154 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - protocol/pool
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../glass.png) |
+
+ |
+
+
+ ![](../../glass.png) |
+
+
+
+
+
+
+
|
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+ File ![Click to sort table by file name Sort by file name](../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../glass.png) |
+
+
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+
+
+ L2Pool.sol |
+
+
+ |
+ 100.0 % |
+ 20 |
+ 20 |
+ - |
+ |
+ |
+ 100.0 % |
+ 9 |
+ 9 |
+
+
+ PoolConfigurator.sol |
+
+
+ |
+ 100.0 % |
+ 190 |
+ 190 |
+ - |
+ |
+ |
+ 100.0 % |
+ 43 |
+ 43 |
+
+
+ Pool.sol |
+
+
+ |
+ 98.3 % |
+ 121 |
+ 119 |
+ - |
+ |
+ |
+ 100.0 % |
+ 67 |
+ 67 |
+
+
+
+
+
+
+
+
+
+
diff --git a/report/protocol/pool/index-sort-l.html b/report/protocol/pool/index-sort-l.html
new file mode 100644
index 00000000..67060566
--- /dev/null
+++ b/report/protocol/pool/index-sort-l.html
@@ -0,0 +1,154 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - protocol/pool
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../glass.png) |
+
+ |
+
+
+ ![](../../glass.png) |
+
+
+
+
+
+
+
|
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+ File ![Click to sort table by file name Sort by file name](../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../glass.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../updown.png) |
+
+
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+
+
+ Pool.sol |
+
+
+ |
+ 98.3 % |
+ 121 |
+ 119 |
+ - |
+ |
+ |
+ 100.0 % |
+ 67 |
+ 67 |
+
+
+ L2Pool.sol |
+
+
+ |
+ 100.0 % |
+ 20 |
+ 20 |
+ - |
+ |
+ |
+ 100.0 % |
+ 9 |
+ 9 |
+
+
+ PoolConfigurator.sol |
+
+
+ |
+ 100.0 % |
+ 190 |
+ 190 |
+ - |
+ |
+ |
+ 100.0 % |
+ 43 |
+ 43 |
+
+
+
+
+
+
+
+
+
+
diff --git a/report/protocol/pool/index.html b/report/protocol/pool/index.html
new file mode 100644
index 00000000..2a47059c
--- /dev/null
+++ b/report/protocol/pool/index.html
@@ -0,0 +1,154 @@
+
+
+
+
+
+
+ LCOV - lcov.info.p - protocol/pool
+
+
+
+
+
+
+ LCOV - code coverage report |
+ ![](../../glass.png) |
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+ ![](../../glass.png) |
+
+ |
+
+
+ ![](../../glass.png) |
+
+
+
+
+
+
+
|
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+ File ![Click to sort table by file name Sort by file name](../../glass.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../updown.png) |
+
+
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+ Rate |
+ Total |
+ Hit |
+
+
+ L2Pool.sol |
+
+
+ |
+ 100.0 % |
+ 20 |
+ 20 |
+ - |
+ |
+ |
+ 100.0 % |
+ 9 |
+ 9 |
+
+
+ Pool.sol |
+
+
+ |
+ 98.3 % |
+ 121 |
+ 119 |
+ - |
+ |
+ |
+ 100.0 % |
+ 67 |
+ 67 |
+
+
+ PoolConfigurator.sol |
+
+
+ |
+ 100.0 % |
+ 190 |
+ 190 |
+ - |
+ |
+ |
+ 100.0 % |
+ 43 |
+ 43 |
+
+
+
+
+
+
+
+
+
+
diff --git a/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/AToken.sol.func-c.html b/report/protocol/tokenization/AToken.sol.func-c.html
similarity index 70%
rename from report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/AToken.sol.func-c.html
rename to report/protocol/tokenization/AToken.sol.func-c.html
index 9d8e9ac6..c352b47a 100644
--- a/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/AToken.sol.func-c.html
+++ b/report/protocol/tokenization/AToken.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/AToken.sol - functions
-
+ LCOV - lcov.info.p - protocol/tokenization/AToken.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -37,12 +37,12 @@
-
+
|
-
-
+
+
|
@@ -53,21 +53,21 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../glass.png) |
@@ -79,107 +79,114 @@
- AToken.DOMAIN_SEPARATOR |
+ AToken.mintToTreasury |
- 4 |
+ 6 |
- AToken.mintToTreasury |
+ AToken. |
- 6 |
+ 20 |
+
+
+
+
+ AToken.DOMAIN_SEPARATOR |
+
+ 1004 |
AToken.nonces |
- 8 |
+ 1008 |
AToken.permit |
- 15 |
+ 3015 |
- AToken.UNDERLYING_ASSET_ADDRESS |
+ AToken.transferOnLiquidation |
- 1005 |
+ 8014 |
- AToken._EIP712BaseId |
+ AToken.handleRepayment |
- 3471 |
+ 11038 |
- AToken.transferOnLiquidation |
+ AToken.burn |
- 6015 |
+ 11054 |
- AToken.RESERVE_TREASURY_ADDRESS |
+ AToken.transferUnderlyingTo |
- 7018 |
+ 15108 |
- AToken.burn |
+ AToken.totalSupply |
- 7055 |
+ 18137 |
- AToken._transfer |
+ AToken.balanceOf |
- 8086 |
+ 31189 |
- AToken.handleRepayment |
+ AToken.UNDERLYING_ASSET_ADDRESS |
- 9039 |
+ 34168 |
- AToken.transferUnderlyingTo |
+ AToken._transfer |
- 9110 |
+ 42097 |
- AToken.totalSupply |
+ AToken.RESERVE_TREASURY_ADDRESS |
- 10945 |
+ 43085 |
AToken.mint |
- 12594 |
+ 43527 |
- AToken.balanceOf |
+ AToken._EIP712BaseId |
- 15189 |
+ 166698 |
@@ -187,8 +194,8 @@
diff --git a/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/AToken.sol.func.html b/report/protocol/tokenization/AToken.sol.func.html
similarity index 70%
rename from report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/AToken.sol.func.html
rename to report/protocol/tokenization/AToken.sol.func.html
index d4c280e6..6a99c7dd 100644
--- a/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/AToken.sol.func.html
+++ b/report/protocol/tokenization/AToken.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/AToken.sol - functions
-
+ LCOV - lcov.info.p - protocol/tokenization/AToken.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -37,12 +37,12 @@
-
+
|
-
-
+
+
|
@@ -53,84 +53,91 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../updown.png) |
+
+
+
+
+ AToken. |
+
+ 20 |
AToken.DOMAIN_SEPARATOR |
- 4 |
+ 1004 |
AToken.RESERVE_TREASURY_ADDRESS |
- 7018 |
+ 43085 |
AToken.UNDERLYING_ASSET_ADDRESS |
- 1005 |
+ 34168 |
AToken._EIP712BaseId |
- 3471 |
+ 166698 |
AToken._transfer |
- 8086 |
+ 42097 |
AToken.balanceOf |
- 15189 |
+ 31189 |
AToken.burn |
- 7055 |
+ 11054 |
AToken.handleRepayment |
- 9039 |
+ 11038 |
AToken.mint |
- 12594 |
+ 43527 |
@@ -144,14 +151,14 @@
AToken.nonces |
- 8 |
+ 1008 |
AToken.permit |
- 15 |
+ 3015 |
@@ -165,21 +172,21 @@
AToken.totalSupply |
- 10945 |
+ 18137 |
AToken.transferOnLiquidation |
- 6015 |
+ 8014 |
AToken.transferUnderlyingTo |
- 9110 |
+ 15108 |
@@ -187,8 +194,8 @@
diff --git a/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/AToken.sol.gcov.html b/report/protocol/tokenization/AToken.sol.gcov.html
similarity index 83%
rename from report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/AToken.sol.gcov.html
rename to report/protocol/tokenization/AToken.sol.gcov.html
index a1871e3d..f59846f3 100644
--- a/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/AToken.sol.gcov.html
+++ b/report/protocol/tokenization/AToken.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/AToken.sol
-
+ LCOV - lcov.info.p - protocol/tokenization/AToken.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -37,12 +37,12 @@
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -75,7 +75,7 @@
4 : : import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
5 : : import {GPv2SafeERC20} from '../../dependencies/gnosis/contracts/GPv2SafeERC20.sol';
6 : : import {SafeCast} from '../../dependencies/openzeppelin/contracts/SafeCast.sol';
- 7 : : import {VersionedInitializable} from '../libraries/aave-upgradeability/VersionedInitializable.sol';
+ 7 : : import {VersionedInitializable} from '../../misc/aave-upgradeability/VersionedInitializable.sol';
8 : : import {Errors} from '../libraries/helpers/Errors.sol';
9 : : import {WadRayMath} from '../libraries/math/WadRayMath.sol';
10 : : import {IPool} from '../../interfaces/IPool.sol';
@@ -125,82 +125,82 @@
54 : : ) public virtual;
55 : :
56 : : /// @inheritdoc IAToken
- 57 : 12594 : function mint(
+ 57 : : function mint(
58 : : address caller,
59 : : address onBehalfOf,
60 : : uint256 amount,
61 : : uint256 index
62 : : ) external virtual override onlyPool returns (bool) {
- 63 : 37779 : return _mintScaled(caller, onBehalfOf, amount, index);
+ 63 : 43526 : return _mintScaled(caller, onBehalfOf, amount, index);
64 : : }
65 : :
66 : : /// @inheritdoc IAToken
- 67 : 7055 : function burn(
+ 67 : : function burn(
68 : : address from,
69 : : address receiverOfUnderlying,
70 : : uint256 amount,
71 : : uint256 index
72 : : ) external virtual override onlyPool {
- 73 : 14108 : _burnScaled(from, receiverOfUnderlying, amount, index);
- 74 : 21156 : if (receiverOfUnderlying != address(this)) {
- 75 : 12094 : IERC20(_underlyingAsset).safeTransfer(receiverOfUnderlying, amount);
+ 73 : 11053 : _burnScaled(from, receiverOfUnderlying, amount, index);
+ 74 : 11051 : if (receiverOfUnderlying != address(this)) {
+ 75 : 10046 : IERC20(_underlyingAsset).safeTransfer(receiverOfUnderlying, amount);
76 : : }
77 : : }
78 : :
79 : : /// @inheritdoc IAToken
- 80 : 6 : function mintToTreasury(uint256 amount, uint256 index) external virtual override onlyPool {
- 81 : 12 : if (amount == 0) {
- 82 : 12 : return;
+ 80 : : function mintToTreasury(uint256 amount, uint256 index) external virtual override onlyPool {
+ 81 : 6 : if (amount == 0) {
+ 82 : 6 : return;
83 : : }
- 84 : 10 : _mintScaled(address(POOL), _treasury, amount, index);
+ 84 : 5 : _mintScaled(address(POOL), _treasury, amount, index);
85 : : }
86 : :
87 : : /// @inheritdoc IAToken
- 88 : 6015 : function transferOnLiquidation(
+ 88 : : function transferOnLiquidation(
89 : : address from,
90 : : address to,
91 : : uint256 value
92 : : ) external virtual override onlyPool {
93 : : // Being a normal transfer, the Transfer() and BalanceTransfer() are emitted
94 : : // so no need to emit a specific event here
- 95 : 12028 : _transfer(from, to, value, false);
+ 95 : 8013 : _transfer(from, to, value, false);
96 : : }
97 : :
98 : : /// @inheritdoc IERC20
- 99 : 15189 : function balanceOf(
+ 99 : : function balanceOf(
100 : : address user
101 : : ) public view virtual override(IncentivizedERC20, IERC20) returns (uint256) {
- 102 : 45567 : return super.balanceOf(user).rayMul(POOL.getReserveNormalizedIncome(_underlyingAsset));
+ 102 : 31189 : return super.balanceOf(user).rayMul(POOL.getReserveNormalizedIncome(_underlyingAsset));
103 : : }
104 : :
105 : : /// @inheritdoc IERC20
- 106 : 10945 : function totalSupply() public view virtual override(IncentivizedERC20, IERC20) returns (uint256) {
- 107 : 32835 : uint256 currentSupplyScaled = super.totalSupply();
+ 106 : : function totalSupply() public view virtual override(IncentivizedERC20, IERC20) returns (uint256) {
+ 107 : 18137 : uint256 currentSupplyScaled = super.totalSupply();
108 : :
- 109 : 21890 : if (currentSupplyScaled == 0) {
- 110 : 3568 : return 0;
+ 109 : 18137 : if (currentSupplyScaled == 0) {
+ 110 : 1982 : return 0;
111 : : }
112 : :
- 113 : 27483 : return currentSupplyScaled.rayMul(POOL.getReserveNormalizedIncome(_underlyingAsset));
+ 113 : 16155 : return currentSupplyScaled.rayMul(POOL.getReserveNormalizedIncome(_underlyingAsset));
114 : : }
115 : :
116 : : /// @inheritdoc IAToken
- 117 : 7018 : function RESERVE_TREASURY_ADDRESS() external view override returns (address) {
- 118 : 14036 : return _treasury;
+ 117 : : function RESERVE_TREASURY_ADDRESS() external view override returns (address) {
+ 118 : 43085 : return _treasury;
119 : : }
120 : :
121 : : /// @inheritdoc IAToken
- 122 : 1005 : function UNDERLYING_ASSET_ADDRESS() external view override returns (address) {
- 123 : 2010 : return _underlyingAsset;
+ 122 : : function UNDERLYING_ASSET_ADDRESS() external view override returns (address) {
+ 123 : 34168 : return _underlyingAsset;
124 : : }
125 : :
126 : : /// @inheritdoc IAToken
- 127 : 9110 : function transferUnderlyingTo(address target, uint256 amount) external virtual override onlyPool {
- 128 : 18218 : IERC20(_underlyingAsset).safeTransfer(target, amount);
+ 127 : : function transferUnderlyingTo(address target, uint256 amount) external virtual override onlyPool {
+ 128 : 15107 : IERC20(_underlyingAsset).safeTransfer(target, amount);
129 : : }
130 : :
131 : : /// @inheritdoc IAToken
- 132 : 9039 : function handleRepayment(
+ 132 : : function handleRepayment(
133 : : address user,
134 : : address onBehalfOf,
135 : : uint256 amount
@@ -209,7 +209,7 @@
138 : : }
139 : :
140 : : /// @inheritdoc IAToken
- 141 : 15 : function permit(
+ 141 : : function permit(
142 : : address owner,
143 : : address spender,
144 : : uint256 value,
@@ -218,20 +218,20 @@
147 : : bytes32 r,
148 : : bytes32 s
149 : : ) external override {
- 150 : 30 : require(owner != address(0), Errors.ZERO_ADDRESS_NOT_VALID);
+ 150 : 3015 : require(owner != address(0), Errors.ZERO_ADDRESS_NOT_VALID);
151 : : //solium-disable-next-line
- 152 : 28 : require(block.timestamp <= deadline, Errors.INVALID_EXPIRATION);
- 153 : 24 : uint256 currentValidNonce = _nonces[owner];
- 154 : 36 : bytes32 digest = keccak256(
+ 152 : 3014 : require(block.timestamp <= deadline, Errors.INVALID_EXPIRATION);
+ 153 : 3012 : uint256 currentValidNonce = _nonces[owner];
+ 154 : 3012 : bytes32 digest = keccak256(
155 : : abi.encodePacked(
156 : : '\x19\x01',
157 : : DOMAIN_SEPARATOR(),
158 : : keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, currentValidNonce, deadline))
159 : : )
160 : : );
- 161 : 24 : require(owner == ecrecover(digest, v, r, s), Errors.INVALID_SIGNATURE);
- 162 : 20 : _nonces[owner] = currentValidNonce + 1;
- 163 : 20 : _approve(owner, spender, value);
+ 161 : 3012 : require(owner == ecrecover(digest, v, r, s), Errors.INVALID_SIGNATURE);
+ 162 : 1010 : _nonces[owner] = currentValidNonce + 1;
+ 163 : 1010 : _approve(owner, spender, value);
164 : : }
165 : :
166 : : /**
@@ -242,21 +242,21 @@
171 : : * @param amount The amount getting transferred
172 : : * @param validate True if the transfer needs to be validated, false otherwise
173 : : */
- 174 : 8086 : function _transfer(address from, address to, uint256 amount, bool validate) internal virtual {
- 175 : 14100 : address underlyingAsset = _underlyingAsset;
+ 174 : : function _transfer(address from, address to, uint256 amount, bool validate) internal virtual {
+ 175 : 25055 : address underlyingAsset = _underlyingAsset;
176 : :
- 177 : 21150 : uint256 index = POOL.getReserveNormalizedIncome(underlyingAsset);
+ 177 : 25055 : uint256 index = POOL.getReserveNormalizedIncome(underlyingAsset);
178 : :
- 179 : 21150 : uint256 fromBalanceBefore = super.balanceOf(from).rayMul(index);
- 180 : 21150 : uint256 toBalanceBefore = super.balanceOf(to).rayMul(index);
+ 179 : 25055 : uint256 fromBalanceBefore = super.balanceOf(from).rayMul(index);
+ 180 : 25055 : uint256 toBalanceBefore = super.balanceOf(to).rayMul(index);
181 : :
- 182 : 14100 : super._transfer(from, to, amount, index);
+ 182 : 25055 : super._transfer(from, to, amount, index);
183 : :
- 184 : 7050 : if (validate) {
- 185 : 2072 : POOL.finalizeTransfer(underlyingAsset, from, to, amount, fromBalanceBefore, toBalanceBefore);
+ 184 : 25055 : if (validate) {
+ 185 : 17042 : POOL.finalizeTransfer(underlyingAsset, from, to, amount, fromBalanceBefore, toBalanceBefore);
186 : : }
187 : :
- 188 : 14098 : emit BalanceTransfer(from, to, amount.rayDiv(index), index);
+ 188 : 25054 : emit BalanceTransfer(from, to, amount.rayDiv(index), index);
189 : : }
190 : :
191 : : /**
@@ -266,34 +266,34 @@
195 : : * @param amount The amount getting transferred
196 : : */
197 : : function _transfer(address from, address to, uint128 amount) internal virtual override {
- 198 : 2072 : _transfer(from, to, amount, true);
+ 198 : 17042 : _transfer(from, to, amount, true);
199 : : }
200 : :
201 : : /**
202 : : * @dev Overrides the base function to fully implement IAToken
203 : : * @dev see `EIP712Base.DOMAIN_SEPARATOR()` for more detailed documentation
204 : : */
- 205 : 4 : function DOMAIN_SEPARATOR() public view override(IAToken, EIP712Base) returns (bytes32) {
- 206 : 48 : return super.DOMAIN_SEPARATOR();
+ 205 : : function DOMAIN_SEPARATOR() public view override(IAToken, EIP712Base) returns (bytes32) {
+ 206 : 4016 : return super.DOMAIN_SEPARATOR();
207 : : }
208 : :
209 : : /**
210 : : * @dev Overrides the base function to fully implement IAToken
211 : : * @dev see `EIP712Base.nonces()` for more detailed documentation
212 : : */
- 213 : 8 : function nonces(address owner) public view override(IAToken, EIP712Base) returns (uint256) {
- 214 : 24 : return super.nonces(owner);
+ 213 : : function nonces(address owner) public view override(IAToken, EIP712Base) returns (uint256) {
+ 214 : 1008 : return super.nonces(owner);
215 : : }
216 : :
217 : : /// @inheritdoc EIP712Base
- 218 : 3471 : function _EIP712BaseId() internal view override returns (string memory) {
- 219 : 10413 : return name();
+ 218 : : function _EIP712BaseId() internal view override returns (string memory) {
+ 219 : 166698 : return name();
220 : : }
221 : :
222 : : /// @inheritdoc IAToken
- 223 : 3 : function rescueTokens(address token, address to, uint256 amount) external override onlyPoolAdmin {
- 224 : 4 : require(token != _underlyingAsset, Errors.UNDERLYING_CANNOT_BE_RESCUED);
- 225 : 2 : IERC20(token).safeTransfer(to, amount);
+ 223 : : function rescueTokens(address token, address to, uint256 amount) external override onlyPoolAdmin {
+ 224 : 2 : require(token != _underlyingAsset, Errors.UNDERLYING_CANNOT_BE_RESCUED);
+ 225 : 1 : IERC20(token).safeTransfer(to, amount);
226 : : }
227 : : }
@@ -303,8 +303,8 @@
diff --git a/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/VariableDebtToken.sol.func-c.html b/report/protocol/tokenization/VariableDebtToken.sol.func-c.html
similarity index 72%
rename from report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/VariableDebtToken.sol.func-c.html
rename to report/protocol/tokenization/VariableDebtToken.sol.func-c.html
index 967aa03f..455b50f7 100644
--- a/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/VariableDebtToken.sol.func-c.html
+++ b/report/protocol/tokenization/VariableDebtToken.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/VariableDebtToken.sol - functions
-
+ LCOV - lcov.info.p - protocol/tokenization/VariableDebtToken.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -37,12 +37,12 @@
-
+
|
-
-
+
+
|
@@ -53,21 +53,21 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../glass.png) |
@@ -116,42 +116,49 @@
VariableDebtToken.totalSupply |
- 18 |
+ 15 |
- VariableDebtToken.UNDERLYING_ASSET_ADDRESS |
+ VariableDebtToken.burn |
- 1023 |
+ 15035 |
- VariableDebtToken._EIP712BaseId |
+ VariableDebtToken. |
- 3476 |
+ 15193 |
VariableDebtToken.mint |
- 9099 |
+ 19091 |
- VariableDebtToken.burn |
+ VariableDebtToken.balanceOf |
- 11041 |
+ 30602 |
- VariableDebtToken.balanceOf |
+ VariableDebtToken.UNDERLYING_ASSET_ADDRESS |
+
+ 51072 |
+
+
+
+
+ VariableDebtToken._EIP712BaseId |
- 26403 |
+ 172697 |
@@ -159,8 +166,8 @@
diff --git a/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/VariableDebtToken.sol.func.html b/report/protocol/tokenization/VariableDebtToken.sol.func.html
similarity index 72%
rename from report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/VariableDebtToken.sol.func.html
rename to report/protocol/tokenization/VariableDebtToken.sol.func.html
index b9aff45d..479b2768 100644
--- a/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/VariableDebtToken.sol.func.html
+++ b/report/protocol/tokenization/VariableDebtToken.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/VariableDebtToken.sol - functions
-
+ LCOV - lcov.info.p - protocol/tokenization/VariableDebtToken.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -37,12 +37,12 @@
-
+
|
-
-
+
+
|
@@ -53,35 +53,42 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../updown.png) |
+
+
+
+
+ VariableDebtToken. |
+
+ 15193 |
VariableDebtToken.UNDERLYING_ASSET_ADDRESS |
- 1023 |
+ 51072 |
VariableDebtToken._EIP712BaseId |
- 3476 |
+ 172697 |
@@ -102,14 +109,14 @@
VariableDebtToken.balanceOf |
- 26403 |
+ 30602 |
VariableDebtToken.burn |
- 11041 |
+ 15035 |
@@ -130,14 +137,14 @@
VariableDebtToken.mint |
- 9099 |
+ 19091 |
VariableDebtToken.totalSupply |
- 18 |
+ 15 |
@@ -159,8 +166,8 @@
diff --git a/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/VariableDebtToken.sol.gcov.html b/report/protocol/tokenization/VariableDebtToken.sol.gcov.html
similarity index 80%
rename from report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/VariableDebtToken.sol.gcov.html
rename to report/protocol/tokenization/VariableDebtToken.sol.gcov.html
index ffb1fe95..58832fd6 100644
--- a/report/core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/VariableDebtToken.sol.gcov.html
+++ b/report/protocol/tokenization/VariableDebtToken.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/src/core/contracts/protocol/tokenization/VariableDebtToken.sol
-
+ LCOV - lcov.info.p - protocol/tokenization/VariableDebtToken.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -37,12 +37,12 @@
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -74,7 +74,7 @@
3 : :
4 : : import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
5 : : import {SafeCast} from '../../dependencies/openzeppelin/contracts/SafeCast.sol';
- 6 : : import {VersionedInitializable} from '../libraries/aave-upgradeability/VersionedInitializable.sol';
+ 6 : : import {VersionedInitializable} from '../../misc/aave-upgradeability/VersionedInitializable.sol';
7 : : import {WadRayMath} from '../libraries/math/WadRayMath.sol';
8 : : import {Errors} from '../libraries/helpers/Errors.sol';
9 : : import {IPool} from '../../interfaces/IPool.sol';
@@ -121,80 +121,80 @@
50 : : ) external virtual;
51 : :
52 : : /// @inheritdoc IERC20
- 53 : 26403 : function balanceOf(address user) public view virtual override returns (uint256) {
- 54 : 79209 : uint256 scaledBalance = super.balanceOf(user);
+ 53 : : function balanceOf(address user) public view virtual override returns (uint256) {
+ 54 : 30602 : uint256 scaledBalance = super.balanceOf(user);
55 : :
- 56 : 52806 : if (scaledBalance == 0) {
- 57 : 2418 : return 0;
+ 56 : 30602 : if (scaledBalance == 0) {
+ 57 : 1040 : return 0;
58 : : }
59 : :
- 60 : 75582 : return scaledBalance.rayMul(POOL.getReserveNormalizedVariableDebt(_underlyingAsset));
+ 60 : 29562 : return scaledBalance.rayMul(POOL.getReserveNormalizedVariableDebt(_underlyingAsset));
61 : : }
62 : :
63 : : /// @inheritdoc IVariableDebtToken
- 64 : 9099 : function mint(
+ 64 : : function mint(
65 : : address user,
66 : : address onBehalfOf,
67 : : uint256 amount,
68 : : uint256 index
69 : : ) external virtual override onlyPool returns (bool, uint256) {
- 70 : 18198 : if (user != onBehalfOf) {
- 71 : 4 : _decreaseBorrowAllowance(onBehalfOf, user, amount);
+ 70 : 19091 : if (user != onBehalfOf) {
+ 71 : 1001 : _decreaseBorrowAllowance(onBehalfOf, user, amount);
72 : : }
- 73 : 18198 : return (_mintScaled(user, onBehalfOf, amount, index), scaledTotalSupply());
+ 73 : 19091 : return (_mintScaled(user, onBehalfOf, amount, index), scaledTotalSupply());
74 : : }
75 : :
76 : : /// @inheritdoc IVariableDebtToken
- 77 : 11041 : function burn(
+ 77 : : function burn(
78 : : address from,
79 : : uint256 amount,
80 : : uint256 index
81 : : ) external virtual override onlyPool returns (uint256) {
- 82 : 22082 : _burnScaled(from, address(0), amount, index);
- 83 : 33123 : return scaledTotalSupply();
+ 82 : 15035 : _burnScaled(from, address(0), amount, index);
+ 83 : 15035 : return scaledTotalSupply();
84 : : }
85 : :
86 : : /// @inheritdoc IERC20
- 87 : 18 : function totalSupply() public view virtual override returns (uint256) {
- 88 : 54 : return super.totalSupply().rayMul(POOL.getReserveNormalizedVariableDebt(_underlyingAsset));
+ 87 : : function totalSupply() public view virtual override returns (uint256) {
+ 88 : 15 : return super.totalSupply().rayMul(POOL.getReserveNormalizedVariableDebt(_underlyingAsset));
89 : : }
90 : :
91 : : /// @inheritdoc EIP712Base
- 92 : 3476 : function _EIP712BaseId() internal view override returns (string memory) {
- 93 : 10428 : return name();
+ 92 : : function _EIP712BaseId() internal view override returns (string memory) {
+ 93 : 172697 : return name();
94 : : }
95 : :
96 : : /**
97 : : * @dev Being non transferrable, the debt token does not implement any of the
98 : : * standard ERC20 functions for transfer and allowance.
99 : : */
- 100 : 1 : function transfer(address, uint256) external virtual override returns (bool) {
- 101 : 2 : revert(Errors.OPERATION_NOT_SUPPORTED);
+ 100 : : function transfer(address, uint256) external virtual override returns (bool) {
+ 101 : 1 : revert(Errors.OPERATION_NOT_SUPPORTED);
102 : : }
103 : :
- 104 : 1 : function allowance(address, address) external view virtual override returns (uint256) {
- 105 : 2 : revert(Errors.OPERATION_NOT_SUPPORTED);
+ 104 : : function allowance(address, address) external view virtual override returns (uint256) {
+ 105 : 1 : revert(Errors.OPERATION_NOT_SUPPORTED);
106 : : }
107 : :
- 108 : 1 : function approve(address, uint256) external virtual override returns (bool) {
- 109 : 2 : revert(Errors.OPERATION_NOT_SUPPORTED);
+ 108 : : function approve(address, uint256) external virtual override returns (bool) {
+ 109 : 1 : revert(Errors.OPERATION_NOT_SUPPORTED);
110 : : }
111 : :
- 112 : 1 : function transferFrom(address, address, uint256) external virtual override returns (bool) {
- 113 : 2 : revert(Errors.OPERATION_NOT_SUPPORTED);
+ 112 : : function transferFrom(address, address, uint256) external virtual override returns (bool) {
+ 113 : 1 : revert(Errors.OPERATION_NOT_SUPPORTED);
114 : : }
115 : :
- 116 : 1 : function increaseAllowance(address, uint256) external virtual override returns (bool) {
- 117 : 2 : revert(Errors.OPERATION_NOT_SUPPORTED);
+ 116 : : function increaseAllowance(address, uint256) external virtual override returns (bool) {
+ 117 : 1 : revert(Errors.OPERATION_NOT_SUPPORTED);
118 : : }
119 : :
- 120 : 1 : function decreaseAllowance(address, uint256) external virtual override returns (bool) {
- 121 : 2 : revert(Errors.OPERATION_NOT_SUPPORTED);
+ 120 : : function decreaseAllowance(address, uint256) external virtual override returns (bool) {
+ 121 : 1 : revert(Errors.OPERATION_NOT_SUPPORTED);
122 : : }
123 : :
124 : : /// @inheritdoc IVariableDebtToken
- 125 : 1023 : function UNDERLYING_ASSET_ADDRESS() external view override returns (address) {
- 126 : 2046 : return _underlyingAsset;
+ 125 : : function UNDERLYING_ASSET_ADDRESS() external view override returns (address) {
+ 126 : 51072 : return _underlyingAsset;
127 : : }
128 : : }
@@ -204,8 +204,8 @@
diff --git a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/DebtTokenBase.sol.func-c.html b/report/protocol/tokenization/base/DebtTokenBase.sol.func-c.html
similarity index 66%
rename from report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/DebtTokenBase.sol.func-c.html
rename to report/protocol/tokenization/base/DebtTokenBase.sol.func-c.html
index 06a135db..f70d0811 100644
--- a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/DebtTokenBase.sol.func-c.html
+++ b/report/protocol/tokenization/base/DebtTokenBase.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/DebtTokenBase.sol - functions
-
+ LCOV - lcov.info.p - protocol/tokenization/base/DebtTokenBase.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -37,11 +37,11 @@
-
+
|
-
-
+
+
@@ -53,56 +53,63 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../glass.png) |
- DebtTokenBase._decreaseBorrowAllowance |
+ DebtTokenBase. |
- 2 |
+ 0 |
- DebtTokenBase.approveDelegation |
+ DebtTokenBase.borrowAllowance |
- 3 |
+ 5 |
- DebtTokenBase.borrowAllowance |
+ DebtTokenBase.delegationWithSig |
- 10 |
+ 7 |
- DebtTokenBase._approveDelegation |
+ DebtTokenBase._decreaseBorrowAllowance |
- 11 |
+ 1001 |
- DebtTokenBase.delegationWithSig |
+ DebtTokenBase.approveDelegation |
+
+ 1001 |
+
+
+
+
+ DebtTokenBase._approveDelegation |
- 14 |
+ 1005 |
@@ -110,8 +117,8 @@
diff --git a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/DebtTokenBase.sol.func.html b/report/protocol/tokenization/base/DebtTokenBase.sol.func.html
similarity index 66%
rename from report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/DebtTokenBase.sol.func.html
rename to report/protocol/tokenization/base/DebtTokenBase.sol.func.html
index d0a60a25..60ac4de5 100644
--- a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/DebtTokenBase.sol.func.html
+++ b/report/protocol/tokenization/base/DebtTokenBase.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/DebtTokenBase.sol - functions
-
+ LCOV - lcov.info.p - protocol/tokenization/base/DebtTokenBase.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -37,11 +37,11 @@
-
+
|
-
-
+
+
@@ -53,56 +53,63 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../glass.png) |
+
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../updown.png) |
+
+
+
+
+ DebtTokenBase. |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../updown.png) |
+ 0 |
DebtTokenBase._approveDelegation |
- 11 |
+ 1005 |
DebtTokenBase._decreaseBorrowAllowance |
- 2 |
+ 1001 |
DebtTokenBase.approveDelegation |
- 3 |
+ 1001 |
DebtTokenBase.borrowAllowance |
- 10 |
+ 5 |
DebtTokenBase.delegationWithSig |
- 14 |
+ 7 |
@@ -110,8 +117,8 @@
diff --git a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/DebtTokenBase.sol.gcov.html b/report/protocol/tokenization/base/DebtTokenBase.sol.gcov.html
similarity index 83%
rename from report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/DebtTokenBase.sol.gcov.html
rename to report/protocol/tokenization/base/DebtTokenBase.sol.gcov.html
index 55318c67..8f3fc231 100644
--- a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/DebtTokenBase.sol.gcov.html
+++ b/report/protocol/tokenization/base/DebtTokenBase.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/DebtTokenBase.sol
-
+ LCOV - lcov.info.p - protocol/tokenization/base/DebtTokenBase.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -37,11 +37,11 @@
-
+
|
-
-
+
+
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -74,14 +74,14 @@
3 : :
4 : : import {Context} from '../../../dependencies/openzeppelin/contracts/Context.sol';
5 : : import {Errors} from '../../libraries/helpers/Errors.sol';
- 6 : : import {VersionedInitializable} from '../../libraries/aave-upgradeability/VersionedInitializable.sol';
+ 6 : : import {VersionedInitializable} from '../../../misc/aave-upgradeability/VersionedInitializable.sol';
7 : : import {ICreditDelegationToken} from '../../../interfaces/ICreditDelegationToken.sol';
8 : : import {EIP712Base} from './EIP712Base.sol';
9 : :
10 : : /**
11 : : * @title DebtTokenBase
12 : : * @author Aave
- 13 : : * @notice Base contract for different types of debt tokens, like StableDebtToken or VariableDebtToken
+ 13 : : * @notice Base contract for different types of debt tokens, like VariableDebtToken
14 : : */
15 : : abstract contract DebtTokenBase is
16 : : VersionedInitializable,
@@ -106,12 +106,12 @@
35 : : }
36 : :
37 : : /// @inheritdoc ICreditDelegationToken
- 38 : 3 : function approveDelegation(address delegatee, uint256 amount) external override {
- 39 : 6 : _approveDelegation(_msgSender(), delegatee, amount);
+ 38 : : function approveDelegation(address delegatee, uint256 amount) external override {
+ 39 : 1001 : _approveDelegation(_msgSender(), delegatee, amount);
40 : : }
41 : :
42 : : /// @inheritdoc ICreditDelegationToken
- 43 : 14 : function delegationWithSig(
+ 43 : : function delegationWithSig(
44 : : address delegator,
45 : : address delegatee,
46 : : uint256 value,
@@ -120,11 +120,11 @@
49 : : bytes32 r,
50 : : bytes32 s
51 : : ) external {
- 52 : 28 : require(delegator != address(0), Errors.ZERO_ADDRESS_NOT_VALID);
+ 52 : 7 : require(delegator != address(0), Errors.ZERO_ADDRESS_NOT_VALID);
53 : : //solium-disable-next-line
- 54 : 24 : require(block.timestamp <= deadline, Errors.INVALID_EXPIRATION);
- 55 : 20 : uint256 currentValidNonce = _nonces[delegator];
- 56 : 30 : bytes32 digest = keccak256(
+ 54 : 6 : require(block.timestamp <= deadline, Errors.INVALID_EXPIRATION);
+ 55 : 5 : uint256 currentValidNonce = _nonces[delegator];
+ 56 : 5 : bytes32 digest = keccak256(
57 : : abi.encodePacked(
58 : : '\x19\x01',
59 : : DOMAIN_SEPARATOR(),
@@ -133,17 +133,17 @@
62 : : )
63 : : )
64 : : );
- 65 : 20 : require(delegator == ecrecover(digest, v, r, s), Errors.INVALID_SIGNATURE);
- 66 : 16 : _nonces[delegator] = currentValidNonce + 1;
- 67 : 16 : _approveDelegation(delegator, delegatee, value);
+ 65 : 5 : require(delegator == ecrecover(digest, v, r, s), Errors.INVALID_SIGNATURE);
+ 66 : 4 : _nonces[delegator] = currentValidNonce + 1;
+ 67 : 4 : _approveDelegation(delegator, delegatee, value);
68 : : }
69 : :
70 : : /// @inheritdoc ICreditDelegationToken
- 71 : 10 : function borrowAllowance(
+ 71 : : function borrowAllowance(
72 : : address fromUser,
73 : : address toUser
74 : : ) external view override returns (uint256) {
- 75 : 20 : return _borrowAllowances[fromUser][toUser];
+ 75 : 5 : return _borrowAllowances[fromUser][toUser];
76 : : }
77 : :
78 : : /**
@@ -152,9 +152,9 @@
81 : : * @param delegatee The address receiving the delegated borrowing power
82 : : * @param amount The allowance amount being delegated.
83 : : */
- 84 : 11 : function _approveDelegation(address delegator, address delegatee, uint256 amount) internal {
- 85 : 22 : _borrowAllowances[delegator][delegatee] = amount;
- 86 : 22 : emit BorrowAllowanceDelegated(delegator, delegatee, _underlyingAsset, amount);
+ 84 : : function _approveDelegation(address delegator, address delegatee, uint256 amount) internal {
+ 85 : 1005 : _borrowAllowances[delegator][delegatee] = amount;
+ 86 : 1005 : emit BorrowAllowanceDelegated(delegator, delegatee, _underlyingAsset, amount);
87 : : }
88 : :
89 : : /**
@@ -163,12 +163,12 @@
92 : : * @param delegatee The address receiving the delegated borrowing power
93 : : * @param amount The amount to subtract from the current allowance
94 : : */
- 95 : 2 : function _decreaseBorrowAllowance(address delegator, address delegatee, uint256 amount) internal {
- 96 : 6 : uint256 newAllowance = _borrowAllowances[delegator][delegatee] - amount;
+ 95 : : function _decreaseBorrowAllowance(address delegator, address delegatee, uint256 amount) internal {
+ 96 : 1001 : uint256 newAllowance = _borrowAllowances[delegator][delegatee] - amount;
97 : :
- 98 : 4 : _borrowAllowances[delegator][delegatee] = newAllowance;
+ 98 : 1001 : _borrowAllowances[delegator][delegatee] = newAllowance;
99 : :
- 100 : 4 : emit BorrowAllowanceDelegated(delegator, delegatee, _underlyingAsset, newAllowance);
+ 100 : 1001 : emit BorrowAllowanceDelegated(delegator, delegatee, _underlyingAsset, newAllowance);
101 : : }
102 : : }
@@ -178,8 +178,8 @@
diff --git a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/EIP712Base.sol.func-c.html b/report/protocol/tokenization/base/EIP712Base.sol.func-c.html
similarity index 62%
rename from report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/EIP712Base.sol.func-c.html
rename to report/protocol/tokenization/base/EIP712Base.sol.func-c.html
index 92a5be95..c8730717 100644
--- a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/EIP712Base.sol.func-c.html
+++ b/report/protocol/tokenization/base/EIP712Base.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/EIP712Base.sol - functions
-
+ LCOV - lcov.info.p - protocol/tokenization/base/EIP712Base.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,42 +53,49 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../glass.png) |
EIP712Base.nonces |
- 10 |
+ 1009 |
EIP712Base.DOMAIN_SEPARATOR |
- 16 |
+ 4016 |
+
+
+
+
+ EIP712Base. |
+
+ 15145 |
EIP712Base._calculateDomainSeparator |
- 10421 |
+ 339395 |
@@ -96,8 +103,8 @@
diff --git a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/EIP712Base.sol.func.html b/report/protocol/tokenization/base/EIP712Base.sol.func.html
similarity index 62%
rename from report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/EIP712Base.sol.func.html
rename to report/protocol/tokenization/base/EIP712Base.sol.func.html
index 6eb42498..83e00732 100644
--- a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/EIP712Base.sol.func.html
+++ b/report/protocol/tokenization/base/EIP712Base.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/EIP712Base.sol - functions
-
+ LCOV - lcov.info.p - protocol/tokenization/base/EIP712Base.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,42 +53,49 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../updown.png) |
+
+
+
+
+ EIP712Base. |
+
+ 15145 |
EIP712Base.DOMAIN_SEPARATOR |
- 16 |
+ 4016 |
EIP712Base._calculateDomainSeparator |
- 10421 |
+ 339395 |
EIP712Base.nonces |
- 10 |
+ 1009 |
@@ -96,8 +103,8 @@
diff --git a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/EIP712Base.sol.gcov.html b/report/protocol/tokenization/base/EIP712Base.sol.gcov.html
similarity index 82%
rename from report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/EIP712Base.sol.gcov.html
rename to report/protocol/tokenization/base/EIP712Base.sol.gcov.html
index bbdf603a..6efe7901 100644
--- a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/EIP712Base.sol.gcov.html
+++ b/report/protocol/tokenization/base/EIP712Base.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/EIP712Base.sol
-
+ LCOV - lcov.info.p - protocol/tokenization/base/EIP712Base.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -92,7 +92,7 @@
21 : : * @dev Constructor.
22 : : */
23 : : constructor() {
- 24 : : _chainId = block.chainid;
+ 24 : 15145 : _chainId = block.chainid;
25 : : }
26 : :
27 : : /**
@@ -100,11 +100,11 @@
29 : : * @dev Return cached value if chainId matches cache, otherwise recomputes separator
30 : : * @return The domain separator of the token at current chain
31 : : */
- 32 : 16 : function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
- 33 : 52 : if (block.chainid == _chainId) {
- 34 : 50 : return _domainSeparator;
+ 32 : : function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
+ 33 : 4021 : if (block.chainid == _chainId) {
+ 34 : 4020 : return _domainSeparator;
35 : : }
- 36 : 3 : return _calculateDomainSeparator();
+ 36 : 1 : return _calculateDomainSeparator();
37 : : }
38 : :
39 : : /**
@@ -112,17 +112,17 @@
41 : : * @param owner The address for which the nonce is being returned
42 : : * @return The nonce value for the input address`
43 : : */
- 44 : 10 : function nonces(address owner) public view virtual returns (uint256) {
- 45 : 20 : return _nonces[owner];
+ 44 : : function nonces(address owner) public view virtual returns (uint256) {
+ 45 : 1009 : return _nonces[owner];
46 : : }
47 : :
48 : : /**
49 : : * @notice Compute the current domain separator
50 : : * @return The domain separator for the token
51 : : */
- 52 : 10421 : function _calculateDomainSeparator() internal view returns (bytes32) {
- 53 : 20842 : return
- 54 : 20842 : keccak256(
+ 52 : : function _calculateDomainSeparator() internal view returns (bytes32) {
+ 53 : 339395 : return
+ 54 : 339395 : keccak256(
55 : : abi.encode(
56 : : EIP712_DOMAIN,
57 : : keccak256(bytes(_EIP712BaseId())),
@@ -146,8 +146,8 @@
diff --git a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol.func-c.html b/report/protocol/tokenization/base/IncentivizedERC20.sol.func-c.html
similarity index 57%
rename from report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol.func-c.html
rename to report/protocol/tokenization/base/IncentivizedERC20.sol.func-c.html
index b94eb953..8780bbb3 100644
--- a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol.func-c.html
+++ b/report/protocol/tokenization/base/IncentivizedERC20.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol - functions
-
+ LCOV - lcov.info.p - protocol/tokenization/base/IncentivizedERC20.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,147 +53,168 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../glass.png) |
- IncentivizedERC20.decreaseAllowance |
+ IncentivizedERC20.decreaseAllowance |
1 |
- IncentivizedERC20.setIncentivesController |
+ IncentivizedERC20.setIncentivesController |
2 |
- IncentivizedERC20.increaseAllowance |
+ IncentivizedERC20.onlyPoolAdmin |
+
+ 3 |
+
+
+
+
+ IncentivizedERC20.increaseAllowance |
4 |
- IncentivizedERC20.approve |
+ IncentivizedERC20.allowance |
- 16 |
+ 26 |
- IncentivizedERC20.transferFrom |
+ IncentivizedERC20.transfer |
- 20 |
+ 4018 |
- IncentivizedERC20.allowance |
+ IncentivizedERC20. |
- 26 |
+ 7197 |
+
+
+
+
+ IncentivizedERC20.approve |
+
+ 12021 |
+
+
+
+
+ IncentivizedERC20.transferFrom |
+
+ 15025 |
- IncentivizedERC20._approve |
+ IncentivizedERC20._transfer |
- 51 |
+ 25056 |
- IncentivizedERC20.transfer |
+ IncentivizedERC20._approve |
- 1017 |
+ 26061 |
- IncentivizedERC20.symbol |
+ IncentivizedERC20.onlyPool |
- 3041 |
+ 34199 |
- IncentivizedERC20.getIncentivesController |
+ IncentivizedERC20.getIncentivesController |
- 3044 |
+ 81148 |
- IncentivizedERC20.decimals |
+ IncentivizedERC20.decimals |
- 3059 |
+ 81163 |
- IncentivizedERC20.name |
+ IncentivizedERC20.symbol |
- 3073 |
+ 81379 |
- IncentivizedERC20._transfer |
+ IncentivizedERC20.name |
- 7051 |
+ 81404 |
- IncentivizedERC20._setDecimals |
+ IncentivizedERC20.totalSupply |
- 10420 |
+ 151623 |
- IncentivizedERC20._setName |
+ IncentivizedERC20.balanceOf |
- 10420 |
+ 339045 |
- IncentivizedERC20._setSymbol |
+ IncentivizedERC20._setDecimals |
- 10420 |
+ 339394 |
- IncentivizedERC20.totalSupply |
+ IncentivizedERC20._setName |
- 82841 |
+ 339394 |
- IncentivizedERC20.balanceOf |
+ IncentivizedERC20._setSymbol |
- 162500 |
+ 339394 |
@@ -201,8 +222,8 @@
diff --git a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol.func.html b/report/protocol/tokenization/base/IncentivizedERC20.sol.func.html
similarity index 57%
rename from report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol.func.html
rename to report/protocol/tokenization/base/IncentivizedERC20.sol.func.html
index 9474a62e..784ef13b 100644
--- a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol.func.html
+++ b/report/protocol/tokenization/base/IncentivizedERC20.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol - functions
-
+ LCOV - lcov.info.p - protocol/tokenization/base/IncentivizedERC20.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,147 +53,168 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../updown.png) |
- IncentivizedERC20._approve |
+ IncentivizedERC20. |
- 51 |
+ 7197 |
- IncentivizedERC20._setDecimals |
+ IncentivizedERC20._approve |
- 10420 |
+ 26061 |
- IncentivizedERC20._setName |
+ IncentivizedERC20._setDecimals |
- 10420 |
+ 339394 |
- IncentivizedERC20._setSymbol |
+ IncentivizedERC20._setName |
- 10420 |
+ 339394 |
- IncentivizedERC20._transfer |
+ IncentivizedERC20._setSymbol |
- 7051 |
+ 339394 |
- IncentivizedERC20.allowance |
+ IncentivizedERC20._transfer |
+
+ 25056 |
+
+
+
+
+ IncentivizedERC20.allowance |
26 |
- IncentivizedERC20.approve |
+ IncentivizedERC20.approve |
- 16 |
+ 12021 |
- IncentivizedERC20.balanceOf |
+ IncentivizedERC20.balanceOf |
- 162500 |
+ 339045 |
- IncentivizedERC20.decimals |
+ IncentivizedERC20.decimals |
- 3059 |
+ 81163 |
- IncentivizedERC20.decreaseAllowance |
+ IncentivizedERC20.decreaseAllowance |
1 |
- IncentivizedERC20.getIncentivesController |
+ IncentivizedERC20.getIncentivesController |
- 3044 |
+ 81148 |
- IncentivizedERC20.increaseAllowance |
+ IncentivizedERC20.increaseAllowance |
4 |
- IncentivizedERC20.name |
+ IncentivizedERC20.name |
+
+ 81404 |
+
+
+
+
+ IncentivizedERC20.onlyPool |
+
+ 34199 |
+
+
+
+
+ IncentivizedERC20.onlyPoolAdmin |
- 3073 |
+ 3 |
- IncentivizedERC20.setIncentivesController |
+ IncentivizedERC20.setIncentivesController |
2 |
- IncentivizedERC20.symbol |
+ IncentivizedERC20.symbol |
- 3041 |
+ 81379 |
- IncentivizedERC20.totalSupply |
+ IncentivizedERC20.totalSupply |
- 82841 |
+ 151623 |
- IncentivizedERC20.transfer |
+ IncentivizedERC20.transfer |
- 1017 |
+ 4018 |
- IncentivizedERC20.transferFrom |
+ IncentivizedERC20.transferFrom |
- 20 |
+ 15025 |
@@ -201,8 +222,8 @@
diff --git a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol.gcov.html b/report/protocol/tokenization/base/IncentivizedERC20.sol.gcov.html
similarity index 80%
rename from report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol.gcov.html
rename to report/protocol/tokenization/base/IncentivizedERC20.sol.gcov.html
index 83390ab6..19da5541 100644
--- a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol.gcov.html
+++ b/report/protocol/tokenization/base/IncentivizedERC20.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol
-
+ LCOV - lcov.info.p - protocol/tokenization/base/IncentivizedERC20.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -96,8 +96,8 @@
25 : : * @dev Only pool admin can call functions marked by this modifier.
26 : : */
27 : : modifier onlyPoolAdmin() {
- 28 : : IACLManager aclManager = IACLManager(_addressesProvider.getACLManager());
- 29 : : require(aclManager.isPoolAdmin(msg.sender), Errors.CALLER_NOT_POOL_ADMIN);
+ 28 : 3 : IACLManager aclManager = IACLManager(_addressesProvider.getACLManager());
+ 29 : 3 : require(aclManager.isPoolAdmin(msg.sender), Errors.CALLER_NOT_POOL_ADMIN);
30 : : _;
31 : : }
32 : :
@@ -105,205 +105,204 @@
34 : : * @dev Only pool can call functions marked by this modifier.
35 : : */
36 : : modifier onlyPool() {
- 37 : : require(_msgSender() == address(POOL), Errors.CALLER_MUST_BE_POOL);
+ 37 : 34199 : require(_msgSender() == address(POOL), Errors.CALLER_MUST_BE_POOL);
38 : : _;
39 : : }
40 : :
41 : : /**
42 : : * @dev UserState - additionalData is a flexible field.
43 : : * ATokens and VariableDebtTokens use this field store the index of the
- 44 : : * user's last supply/withdrawal/borrow/repayment. StableDebtTokens use
- 45 : : * this field to store the user's stable rate.
- 46 : : */
- 47 : : struct UserState {
- 48 : : uint128 balance;
- 49 : : uint128 additionalData;
- 50 : : }
- 51 : : // Map of users address and their state data (userAddress => userStateData)
- 52 : : mapping(address => UserState) internal _userState;
- 53 : :
- 54 : : // Map of allowances (delegator => delegatee => allowanceAmount)
- 55 : : mapping(address => mapping(address => uint256)) private _allowances;
- 56 : :
- 57 : : uint256 internal _totalSupply;
- 58 : : string private _name;
- 59 : : string private _symbol;
- 60 : : uint8 private _decimals;
- 61 : : IAaveIncentivesController internal _incentivesController;
- 62 : : IPoolAddressesProvider internal immutable _addressesProvider;
- 63 : : IPool public immutable POOL;
- 64 : :
- 65 : : /**
- 66 : : * @dev Constructor.
- 67 : : * @param pool The reference to the main Pool contract
- 68 : : * @param name_ The name of the token
- 69 : : * @param symbol_ The symbol of the token
- 70 : : * @param decimals_ The number of decimals of the token
- 71 : : */
- 72 : : constructor(IPool pool, string memory name_, string memory symbol_, uint8 decimals_) {
- 73 : : _addressesProvider = pool.ADDRESSES_PROVIDER();
- 74 : : _name = name_;
- 75 : : _symbol = symbol_;
- 76 : : _decimals = decimals_;
- 77 : : POOL = pool;
- 78 : : }
- 79 : :
- 80 : : /// @inheritdoc IERC20Detailed
- 81 : 3073 : function name() public view override returns (string memory) {
- 82 : 26988 : return _name;
- 83 : : }
- 84 : :
- 85 : : /// @inheritdoc IERC20Detailed
- 86 : 3041 : function symbol() external view override returns (string memory) {
- 87 : 6082 : return _symbol;
- 88 : : }
- 89 : :
- 90 : : /// @inheritdoc IERC20Detailed
- 91 : 3059 : function decimals() external view override returns (uint8) {
- 92 : 6118 : return _decimals;
- 93 : : }
- 94 : :
- 95 : : /// @inheritdoc IERC20
- 96 : 82841 : function totalSupply() public view virtual override returns (uint256) {
- 97 : 165682 : return _totalSupply;
- 98 : : }
- 99 : :
- 100 : : /// @inheritdoc IERC20
- 101 : 162500 : function balanceOf(address account) public view virtual override returns (uint256) {
- 102 : 325004 : return _userState[account].balance;
- 103 : : }
- 104 : :
- 105 : : /**
- 106 : : * @notice Returns the address of the Incentives Controller contract
- 107 : : * @return The address of the Incentives Controller
- 108 : : */
- 109 : 3044 : function getIncentivesController() external view virtual returns (IAaveIncentivesController) {
- 110 : 6088 : return _incentivesController;
- 111 : : }
- 112 : :
- 113 : : /**
- 114 : : * @notice Sets a new Incentives Controller
- 115 : : * @param controller the new Incentives controller
- 116 : : */
- 117 : 2 : function setIncentivesController(IAaveIncentivesController controller) external onlyPoolAdmin {
- 118 : 2 : _incentivesController = controller;
- 119 : : }
- 120 : :
- 121 : : /// @inheritdoc IERC20
- 122 : 1017 : function transfer(address recipient, uint256 amount) external virtual override returns (bool) {
- 123 : 3051 : uint128 castAmount = amount.toUint128();
- 124 : 2032 : _transfer(_msgSender(), recipient, castAmount);
- 125 : 2030 : return true;
- 126 : : }
- 127 : :
- 128 : : /// @inheritdoc IERC20
- 129 : 26 : function allowance(
- 130 : : address owner,
- 131 : : address spender
- 132 : : ) external view virtual override returns (uint256) {
- 133 : 52 : return _allowances[owner][spender];
- 134 : : }
- 135 : :
- 136 : : /// @inheritdoc IERC20
- 137 : 16 : function approve(address spender, uint256 amount) external virtual override returns (bool) {
- 138 : 32 : _approve(_msgSender(), spender, amount);
- 139 : 32 : return true;
- 140 : : }
- 141 : :
- 142 : : /// @inheritdoc IERC20
- 143 : 20 : function transferFrom(
- 144 : : address sender,
- 145 : : address recipient,
- 146 : : uint256 amount
- 147 : : ) external virtual override returns (bool) {
- 148 : 60 : uint128 castAmount = amount.toUint128();
- 149 : 40 : _approve(sender, _msgSender(), _allowances[sender][_msgSender()] - castAmount);
- 150 : 40 : _transfer(sender, recipient, castAmount);
- 151 : 40 : return true;
- 152 : : }
- 153 : :
- 154 : : /**
- 155 : : * @notice Increases the allowance of spender to spend _msgSender() tokens
- 156 : : * @param spender The user allowed to spend on behalf of _msgSender()
- 157 : : * @param addedValue The amount being added to the allowance
- 158 : : * @return `true`
- 159 : : */
- 160 : 4 : function increaseAllowance(address spender, uint256 addedValue) external virtual returns (bool) {
- 161 : 8 : _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
- 162 : 8 : return true;
- 163 : : }
- 164 : :
- 165 : : /**
- 166 : : * @notice Decreases the allowance of spender to spend _msgSender() tokens
- 167 : : * @param spender The user allowed to spend on behalf of _msgSender()
- 168 : : * @param subtractedValue The amount being subtracted to the allowance
- 169 : : * @return `true`
- 170 : : */
- 171 : 1 : function decreaseAllowance(
- 172 : : address spender,
- 173 : : uint256 subtractedValue
- 174 : : ) external virtual returns (bool) {
- 175 : 2 : _approve(_msgSender(), spender, _allowances[_msgSender()][spender] - subtractedValue);
- 176 : 2 : return true;
- 177 : : }
- 178 : :
- 179 : : /**
- 180 : : * @notice Transfers tokens between two users and apply incentives if defined.
- 181 : : * @param sender The source address
- 182 : : * @param recipient The destination address
- 183 : : * @param amount The amount getting transferred
- 184 : : */
- 185 : 7051 : function _transfer(address sender, address recipient, uint128 amount) internal virtual {
- 186 : 14102 : uint128 oldSenderBalance = _userState[sender].balance;
- 187 : 14102 : _userState[sender].balance = oldSenderBalance - amount;
- 188 : 14102 : uint128 oldRecipientBalance = _userState[recipient].balance;
- 189 : 14102 : _userState[recipient].balance = oldRecipientBalance + amount;
- 190 : :
- 191 : 14102 : IAaveIncentivesController incentivesControllerLocal = _incentivesController;
- 192 : 28204 : if (address(incentivesControllerLocal) != address(0)) {
- 193 : 14100 : uint256 currentTotalSupply = _totalSupply;
- 194 : 14100 : incentivesControllerLocal.handleAction(sender, currentTotalSupply, oldSenderBalance);
- 195 : 14100 : if (sender != recipient) {
- 196 : 14096 : incentivesControllerLocal.handleAction(recipient, currentTotalSupply, oldRecipientBalance);
- 197 : : }
- 198 : : }
- 199 : : }
- 200 : :
- 201 : : /**
- 202 : : * @notice Approve `spender` to use `amount` of `owner`s balance
- 203 : : * @param owner The address owning the tokens
- 204 : : * @param spender The address approved for spending
- 205 : : * @param amount The amount of tokens to approve spending of
- 206 : : */
- 207 : 51 : function _approve(address owner, address spender, uint256 amount) internal virtual {
- 208 : 102 : _allowances[owner][spender] = amount;
- 209 : 102 : emit Approval(owner, spender, amount);
- 210 : : }
- 211 : :
- 212 : : /**
- 213 : : * @notice Update the name of the token
- 214 : : * @param newName The new name for the token
- 215 : : */
- 216 : 10420 : function _setName(string memory newName) internal {
- 217 : 20840 : _name = newName;
- 218 : : }
- 219 : :
- 220 : : /**
- 221 : : * @notice Update the symbol for the token
- 222 : : * @param newSymbol The new symbol for the token
- 223 : : */
- 224 : 10420 : function _setSymbol(string memory newSymbol) internal {
- 225 : 20840 : _symbol = newSymbol;
- 226 : : }
- 227 : :
- 228 : : /**
- 229 : : * @notice Update the number of decimals for the token
- 230 : : * @param newDecimals The new number of decimals for the token
- 231 : : */
- 232 : 10420 : function _setDecimals(uint8 newDecimals) internal {
- 233 : 20840 : _decimals = newDecimals;
- 234 : : }
- 235 : : }
+ 44 : : * user's last supply/withdrawal/borrow/repayment.
+ 45 : : */
+ 46 : : struct UserState {
+ 47 : : uint128 balance;
+ 48 : : uint128 additionalData;
+ 49 : : }
+ 50 : : // Map of users address and their state data (userAddress => userStateData)
+ 51 : : mapping(address => UserState) internal _userState;
+ 52 : :
+ 53 : : // Map of allowances (delegator => delegatee => allowanceAmount)
+ 54 : : mapping(address => mapping(address => uint256)) private _allowances;
+ 55 : :
+ 56 : : uint256 internal _totalSupply;
+ 57 : : string private _name;
+ 58 : : string private _symbol;
+ 59 : : uint8 private _decimals;
+ 60 : : IAaveIncentivesController internal _incentivesController;
+ 61 : : IPoolAddressesProvider internal immutable _addressesProvider;
+ 62 : : IPool public immutable POOL;
+ 63 : :
+ 64 : : /**
+ 65 : : * @dev Constructor.
+ 66 : : * @param pool The reference to the main Pool contract
+ 67 : : * @param name_ The name of the token
+ 68 : : * @param symbol_ The symbol of the token
+ 69 : : * @param decimals_ The number of decimals of the token
+ 70 : : */
+ 71 : : constructor(IPool pool, string memory name_, string memory symbol_, uint8 decimals_) {
+ 72 : 7197 : _addressesProvider = pool.ADDRESSES_PROVIDER();
+ 73 : 15179 : _name = name_;
+ 74 : 7139 : _symbol = symbol_;
+ 75 : 7154 : _decimals = decimals_;
+ 76 : 15111 : POOL = pool;
+ 77 : : }
+ 78 : :
+ 79 : : /// @inheritdoc IERC20Detailed
+ 80 : : function name() public view override returns (string memory) {
+ 81 : 420799 : return _name;
+ 82 : : }
+ 83 : :
+ 84 : : /// @inheritdoc IERC20Detailed
+ 85 : : function symbol() external view override returns (string memory) {
+ 86 : 81379 : return _symbol;
+ 87 : : }
+ 88 : :
+ 89 : : /// @inheritdoc IERC20Detailed
+ 90 : : function decimals() external view override returns (uint8) {
+ 91 : 81163 : return _decimals;
+ 92 : : }
+ 93 : :
+ 94 : : /// @inheritdoc IERC20
+ 95 : : function totalSupply() public view virtual override returns (uint256) {
+ 96 : 151623 : return _totalSupply;
+ 97 : : }
+ 98 : :
+ 99 : : /// @inheritdoc IERC20
+ 100 : : function balanceOf(address account) public view virtual override returns (uint256) {
+ 101 : 339047 : return _userState[account].balance;
+ 102 : : }
+ 103 : :
+ 104 : : /**
+ 105 : : * @notice Returns the address of the Incentives Controller contract
+ 106 : : * @return The address of the Incentives Controller
+ 107 : : */
+ 108 : : function getIncentivesController() external view virtual returns (IAaveIncentivesController) {
+ 109 : 81148 : return _incentivesController;
+ 110 : : }
+ 111 : :
+ 112 : : /**
+ 113 : : * @notice Sets a new Incentives Controller
+ 114 : : * @param controller the new Incentives controller
+ 115 : : */
+ 116 : : function setIncentivesController(IAaveIncentivesController controller) external onlyPoolAdmin {
+ 117 : 1 : _incentivesController = controller;
+ 118 : : }
+ 119 : :
+ 120 : : /// @inheritdoc IERC20
+ 121 : : function transfer(address recipient, uint256 amount) external virtual override returns (bool) {
+ 122 : 4018 : uint128 castAmount = amount.toUint128();
+ 123 : 4017 : _transfer(_msgSender(), recipient, castAmount);
+ 124 : 4016 : return true;
+ 125 : : }
+ 126 : :
+ 127 : : /// @inheritdoc IERC20
+ 128 : : function allowance(
+ 129 : : address owner,
+ 130 : : address spender
+ 131 : : ) external view virtual override returns (uint256) {
+ 132 : 26 : return _allowances[owner][spender];
+ 133 : : }
+ 134 : :
+ 135 : : /// @inheritdoc IERC20
+ 136 : : function approve(address spender, uint256 amount) external virtual override returns (bool) {
+ 137 : 12021 : _approve(_msgSender(), spender, amount);
+ 138 : 12021 : return true;
+ 139 : : }
+ 140 : :
+ 141 : : /// @inheritdoc IERC20
+ 142 : : function transferFrom(
+ 143 : : address sender,
+ 144 : : address recipient,
+ 145 : : uint256 amount
+ 146 : : ) external virtual override returns (bool) {
+ 147 : 15025 : uint128 castAmount = amount.toUint128();
+ 148 : 15025 : _approve(sender, _msgSender(), _allowances[sender][_msgSender()] - castAmount);
+ 149 : 13025 : _transfer(sender, recipient, castAmount);
+ 150 : 13025 : return true;
+ 151 : : }
+ 152 : :
+ 153 : : /**
+ 154 : : * @notice Increases the allowance of spender to spend _msgSender() tokens
+ 155 : : * @param spender The user allowed to spend on behalf of _msgSender()
+ 156 : : * @param addedValue The amount being added to the allowance
+ 157 : : * @return `true`
+ 158 : : */
+ 159 : : function increaseAllowance(address spender, uint256 addedValue) external virtual returns (bool) {
+ 160 : 4 : _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
+ 161 : 4 : return true;
+ 162 : : }
+ 163 : :
+ 164 : : /**
+ 165 : : * @notice Decreases the allowance of spender to spend _msgSender() tokens
+ 166 : : * @param spender The user allowed to spend on behalf of _msgSender()
+ 167 : : * @param subtractedValue The amount being subtracted to the allowance
+ 168 : : * @return `true`
+ 169 : : */
+ 170 : : function decreaseAllowance(
+ 171 : : address spender,
+ 172 : : uint256 subtractedValue
+ 173 : : ) external virtual returns (bool) {
+ 174 : 1 : _approve(_msgSender(), spender, _allowances[_msgSender()][spender] - subtractedValue);
+ 175 : 1 : return true;
+ 176 : : }
+ 177 : :
+ 178 : : /**
+ 179 : : * @notice Transfers tokens between two users and apply incentives if defined.
+ 180 : : * @param sender The source address
+ 181 : : * @param recipient The destination address
+ 182 : : * @param amount The amount getting transferred
+ 183 : : */
+ 184 : : function _transfer(address sender, address recipient, uint128 amount) internal virtual {
+ 185 : 25056 : uint128 oldSenderBalance = _userState[sender].balance;
+ 186 : 25056 : _userState[sender].balance = oldSenderBalance - amount;
+ 187 : 25056 : uint128 oldRecipientBalance = _userState[recipient].balance;
+ 188 : 25056 : _userState[recipient].balance = oldRecipientBalance + amount;
+ 189 : :
+ 190 : 25056 : IAaveIncentivesController incentivesControllerLocal = _incentivesController;
+ 191 : 25056 : if (address(incentivesControllerLocal) != address(0)) {
+ 192 : 25055 : uint256 currentTotalSupply = _totalSupply;
+ 193 : 25055 : incentivesControllerLocal.handleAction(sender, currentTotalSupply, oldSenderBalance);
+ 194 : 25055 : if (sender != recipient) {
+ 195 : 25053 : incentivesControllerLocal.handleAction(recipient, currentTotalSupply, oldRecipientBalance);
+ 196 : : }
+ 197 : : }
+ 198 : : }
+ 199 : :
+ 200 : : /**
+ 201 : : * @notice Approve `spender` to use `amount` of `owner`s balance
+ 202 : : * @param owner The address owning the tokens
+ 203 : : * @param spender The address approved for spending
+ 204 : : * @param amount The amount of tokens to approve spending of
+ 205 : : */
+ 206 : : function _approve(address owner, address spender, uint256 amount) internal virtual {
+ 207 : 26061 : _allowances[owner][spender] = amount;
+ 208 : 26061 : emit Approval(owner, spender, amount);
+ 209 : : }
+ 210 : :
+ 211 : : /**
+ 212 : : * @notice Update the name of the token
+ 213 : : * @param newName The new name for the token
+ 214 : : */
+ 215 : : function _setName(string memory newName) internal {
+ 216 : 339394 : _name = newName;
+ 217 : : }
+ 218 : :
+ 219 : : /**
+ 220 : : * @notice Update the symbol for the token
+ 221 : : * @param newSymbol The new symbol for the token
+ 222 : : */
+ 223 : : function _setSymbol(string memory newSymbol) internal {
+ 224 : 339394 : _symbol = newSymbol;
+ 225 : : }
+ 226 : :
+ 227 : : /**
+ 228 : : * @notice Update the number of decimals for the token
+ 229 : : * @param newDecimals The new number of decimals for the token
+ 230 : : */
+ 231 : : function _setDecimals(uint8 newDecimals) internal {
+ 232 : 339394 : _decimals = newDecimals;
+ 233 : : }
+ 234 : : }
@@ -311,8 +310,8 @@
diff --git a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/MintableIncentivizedERC20.sol.func-c.html b/report/protocol/tokenization/base/MintableIncentivizedERC20.sol.func-c.html
similarity index 64%
rename from report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/MintableIncentivizedERC20.sol.func-c.html
rename to report/protocol/tokenization/base/MintableIncentivizedERC20.sol.func-c.html
index ad293ab2..3dcb41c6 100644
--- a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/MintableIncentivizedERC20.sol.func-c.html
+++ b/report/protocol/tokenization/base/MintableIncentivizedERC20.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/MintableIncentivizedERC20.sol - functions
-
+ LCOV - lcov.info.p - protocol/tokenization/base/MintableIncentivizedERC20.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -37,12 +37,12 @@
-
+
|
-
-
+
+
|
@@ -53,35 +53,42 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../glass.png) |
+
+
+
+
+ MintableIncentivizedERC20. |
+
+ 15169 |
MintableIncentivizedERC20._burn |
- 18094 |
+ 26087 |
MintableIncentivizedERC20._mint |
- 21696 |
+ 62621 |
@@ -89,8 +96,8 @@
diff --git a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/MintableIncentivizedERC20.sol.func.html b/report/protocol/tokenization/base/MintableIncentivizedERC20.sol.func.html
similarity index 64%
rename from report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/MintableIncentivizedERC20.sol.func.html
rename to report/protocol/tokenization/base/MintableIncentivizedERC20.sol.func.html
index 593e7ecc..d43afe23 100644
--- a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/MintableIncentivizedERC20.sol.func.html
+++ b/report/protocol/tokenization/base/MintableIncentivizedERC20.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/MintableIncentivizedERC20.sol - functions
-
+ LCOV - lcov.info.p - protocol/tokenization/base/MintableIncentivizedERC20.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -37,12 +37,12 @@
-
+
|
-
-
+
+
|
@@ -53,35 +53,42 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../updown.png) |
+
+
+
+
+ MintableIncentivizedERC20. |
+
+ 15169 |
MintableIncentivizedERC20._burn |
- 18094 |
+ 26087 |
MintableIncentivizedERC20._mint |
- 21696 |
+ 62621 |
@@ -89,8 +96,8 @@
diff --git a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/MintableIncentivizedERC20.sol.gcov.html b/report/protocol/tokenization/base/MintableIncentivizedERC20.sol.gcov.html
similarity index 80%
rename from report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/MintableIncentivizedERC20.sol.gcov.html
rename to report/protocol/tokenization/base/MintableIncentivizedERC20.sol.gcov.html
index 965f6679..842e74c0 100644
--- a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/MintableIncentivizedERC20.sol.gcov.html
+++ b/report/protocol/tokenization/base/MintableIncentivizedERC20.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/MintableIncentivizedERC20.sol
-
+ LCOV - lcov.info.p - protocol/tokenization/base/MintableIncentivizedERC20.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -37,12 +37,12 @@
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -103,16 +103,16 @@
32 : : * @param account The address receiving tokens
33 : : * @param amount The amount of tokens to mint
34 : : */
- 35 : 21696 : function _mint(address account, uint128 amount) internal virtual {
- 36 : 43392 : uint256 oldTotalSupply = _totalSupply;
- 37 : 43392 : _totalSupply = oldTotalSupply + amount;
+ 35 : : function _mint(address account, uint128 amount) internal virtual {
+ 36 : 62621 : uint256 oldTotalSupply = _totalSupply;
+ 37 : 62621 : _totalSupply = oldTotalSupply + amount;
38 : :
- 39 : 43392 : uint128 oldAccountBalance = _userState[account].balance;
- 40 : 43392 : _userState[account].balance = oldAccountBalance + amount;
+ 39 : 62621 : uint128 oldAccountBalance = _userState[account].balance;
+ 40 : 62621 : _userState[account].balance = oldAccountBalance + amount;
41 : :
- 42 : 43392 : IAaveIncentivesController incentivesControllerLocal = _incentivesController;
- 43 : 86784 : if (address(incentivesControllerLocal) != address(0)) {
- 44 : 43392 : incentivesControllerLocal.handleAction(account, oldTotalSupply, oldAccountBalance);
+ 42 : 62621 : IAaveIncentivesController incentivesControllerLocal = _incentivesController;
+ 43 : 62621 : if (address(incentivesControllerLocal) != address(0)) {
+ 44 : 62621 : incentivesControllerLocal.handleAction(account, oldTotalSupply, oldAccountBalance);
45 : : }
46 : : }
47 : :
@@ -121,17 +121,17 @@
50 : : * @param account The account whose tokens are burnt
51 : : * @param amount The amount of tokens to burn
52 : : */
- 53 : 18094 : function _burn(address account, uint128 amount) internal virtual {
- 54 : 36188 : uint256 oldTotalSupply = _totalSupply;
- 55 : 36188 : _totalSupply = oldTotalSupply - amount;
+ 53 : : function _burn(address account, uint128 amount) internal virtual {
+ 54 : 26087 : uint256 oldTotalSupply = _totalSupply;
+ 55 : 26087 : _totalSupply = oldTotalSupply - amount;
56 : :
- 57 : 36188 : uint128 oldAccountBalance = _userState[account].balance;
- 58 : 36188 : _userState[account].balance = oldAccountBalance - amount;
+ 57 : 26087 : uint128 oldAccountBalance = _userState[account].balance;
+ 58 : 26087 : _userState[account].balance = oldAccountBalance - amount;
59 : :
- 60 : 36186 : IAaveIncentivesController incentivesControllerLocal = _incentivesController;
+ 60 : 26086 : IAaveIncentivesController incentivesControllerLocal = _incentivesController;
61 : :
- 62 : 72372 : if (address(incentivesControllerLocal) != address(0)) {
- 63 : 36186 : incentivesControllerLocal.handleAction(account, oldTotalSupply, oldAccountBalance);
+ 62 : 26086 : if (address(incentivesControllerLocal) != address(0)) {
+ 63 : 26086 : incentivesControllerLocal.handleAction(account, oldTotalSupply, oldAccountBalance);
64 : : }
65 : : }
66 : : }
@@ -142,8 +142,8 @@
diff --git a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol.func-c.html b/report/protocol/tokenization/base/ScaledBalanceTokenBase.sol.func-c.html
similarity index 68%
rename from report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol.func-c.html
rename to report/protocol/tokenization/base/ScaledBalanceTokenBase.sol.func-c.html
index ec6d699a..81fbdfc5 100644
--- a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol.func-c.html
+++ b/report/protocol/tokenization/base/ScaledBalanceTokenBase.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol - functions
-
+ LCOV - lcov.info.p - protocol/tokenization/base/ScaledBalanceTokenBase.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -37,12 +37,12 @@
-
+
|
-
-
+
+
|
@@ -53,21 +53,21 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../glass.png) |
@@ -84,39 +84,46 @@
39 |
+
+
+ ScaledBalanceTokenBase. |
+
+ 15136 |
+
+
ScaledBalanceTokenBase._transfer |
- 7051 |
+ 25056 |
ScaledBalanceTokenBase._burnScaled |
- 18095 |
+ 26088 |
ScaledBalanceTokenBase._mintScaled |
- 21697 |
+ 62622 |
- ScaledBalanceTokenBase.scaledTotalSupply |
+ ScaledBalanceTokenBase.scaledBalanceOf |
- 51717 |
+ 88301 |
- ScaledBalanceTokenBase.scaledBalanceOf |
+ ScaledBalanceTokenBase.scaledTotalSupply |
- 52893 |
+ 99324 |
@@ -124,8 +131,8 @@
diff --git a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol.func.html b/report/protocol/tokenization/base/ScaledBalanceTokenBase.sol.func.html
similarity index 69%
rename from report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol.func.html
rename to report/protocol/tokenization/base/ScaledBalanceTokenBase.sol.func.html
index b9f719d3..97d165d5 100644
--- a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol.func.html
+++ b/report/protocol/tokenization/base/ScaledBalanceTokenBase.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol - functions
-
+ LCOV - lcov.info.p - protocol/tokenization/base/ScaledBalanceTokenBase.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -37,12 +37,12 @@
-
+
|
-
-
+
+
|
@@ -53,42 +53,49 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../../updown.png) |
+
+
+
+
+ ScaledBalanceTokenBase. |
+
+ 15136 |
ScaledBalanceTokenBase._burnScaled |
- 18095 |
+ 26088 |
ScaledBalanceTokenBase._mintScaled |
- 21697 |
+ 62622 |
ScaledBalanceTokenBase._transfer |
- 7051 |
+ 25056 |
@@ -109,14 +116,14 @@
ScaledBalanceTokenBase.scaledBalanceOf |
- 52893 |
+ 88301 |
ScaledBalanceTokenBase.scaledTotalSupply |
- 51717 |
+ 99324 |
@@ -124,8 +131,8 @@
diff --git a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol.gcov.html b/report/protocol/tokenization/base/ScaledBalanceTokenBase.sol.gcov.html
similarity index 80%
rename from report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol.gcov.html
rename to report/protocol/tokenization/base/ScaledBalanceTokenBase.sol.gcov.html
index 6cfe5084..bc1b261d 100644
--- a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol.gcov.html
+++ b/report/protocol/tokenization/base/ScaledBalanceTokenBase.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol
-
+ LCOV - lcov.info.p - protocol/tokenization/base/ScaledBalanceTokenBase.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -37,12 +37,12 @@
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -105,25 +105,25 @@
34 : : }
35 : :
36 : : /// @inheritdoc IScaledBalanceToken
- 37 : 52893 : function scaledBalanceOf(address user) external view override returns (uint256) {
- 38 : 158679 : return super.balanceOf(user);
+ 37 : : function scaledBalanceOf(address user) external view override returns (uint256) {
+ 38 : 88301 : return super.balanceOf(user);
39 : : }
40 : :
41 : : /// @inheritdoc IScaledBalanceToken
- 42 : 21 : function getScaledUserBalanceAndSupply(
+ 42 : : function getScaledUserBalanceAndSupply(
43 : : address user
44 : : ) external view override returns (uint256, uint256) {
- 45 : 42 : return (super.balanceOf(user), super.totalSupply());
+ 45 : 21 : return (super.balanceOf(user), super.totalSupply());
46 : : }
47 : :
48 : : /// @inheritdoc IScaledBalanceToken
- 49 : 51717 : function scaledTotalSupply() public view virtual override returns (uint256) {
- 50 : 215571 : return super.totalSupply();
+ 49 : : function scaledTotalSupply() public view virtual override returns (uint256) {
+ 50 : 133450 : return super.totalSupply();
51 : : }
52 : :
53 : : /// @inheritdoc IScaledBalanceToken
- 54 : 39 : function getPreviousIndex(address user) external view virtual override returns (uint256) {
- 55 : 78 : return _userState[user].additionalData;
+ 54 : : function getPreviousIndex(address user) external view virtual override returns (uint256) {
+ 55 : 39 : return _userState[user].additionalData;
56 : : }
57 : :
58 : : /**
@@ -134,28 +134,28 @@
63 : : * @param index The next liquidity index of the reserve
64 : : * @return `true` if the the previous balance of the user was 0
65 : : */
- 66 : 21697 : function _mintScaled(
+ 66 : : function _mintScaled(
67 : : address caller,
68 : : address onBehalfOf,
69 : : uint256 amount,
70 : : uint256 index
71 : : ) internal returns (bool) {
- 72 : 65091 : uint256 amountScaled = amount.rayDiv(index);
- 73 : 43394 : require(amountScaled != 0, Errors.INVALID_MINT_AMOUNT);
+ 72 : 62622 : uint256 amountScaled = amount.rayDiv(index);
+ 73 : 62622 : require(amountScaled != 0, Errors.INVALID_MINT_AMOUNT);
74 : :
- 75 : 65088 : uint256 scaledBalance = super.balanceOf(onBehalfOf);
- 76 : 86784 : uint256 balanceIncrease = scaledBalance.rayMul(index) -
- 77 : 43392 : scaledBalance.rayMul(_userState[onBehalfOf].additionalData);
+ 75 : 62621 : uint256 scaledBalance = super.balanceOf(onBehalfOf);
+ 76 : 62621 : uint256 balanceIncrease = scaledBalance.rayMul(index) -
+ 77 : 62621 : scaledBalance.rayMul(_userState[onBehalfOf].additionalData);
78 : :
- 79 : 43392 : _userState[onBehalfOf].additionalData = index.toUint128();
+ 79 : 62621 : _userState[onBehalfOf].additionalData = index.toUint128();
80 : :
- 81 : 43392 : _mint(onBehalfOf, amountScaled.toUint128());
+ 81 : 62621 : _mint(onBehalfOf, amountScaled.toUint128());
82 : :
- 83 : 65088 : uint256 amountToMint = amount + balanceIncrease;
- 84 : 43392 : emit Transfer(address(0), onBehalfOf, amountToMint);
- 85 : 43392 : emit Mint(caller, onBehalfOf, amountToMint, balanceIncrease, index);
+ 83 : 62621 : uint256 amountToMint = amount + balanceIncrease;
+ 84 : 62621 : emit Transfer(address(0), onBehalfOf, amountToMint);
+ 85 : 62621 : emit Mint(caller, onBehalfOf, amountToMint, balanceIncrease, index);
86 : :
- 87 : 43392 : return (scaledBalance == 0);
+ 87 : 62621 : return (scaledBalance == 0);
88 : : }
89 : :
90 : : /**
@@ -167,26 +167,26 @@
96 : : * @param amount The amount getting burned
97 : : * @param index The variable debt index of the reserve
98 : : */
- 99 : 18095 : function _burnScaled(address user, address target, uint256 amount, uint256 index) internal {
- 100 : 54285 : uint256 amountScaled = amount.rayDiv(index);
- 101 : 36190 : require(amountScaled != 0, Errors.INVALID_BURN_AMOUNT);
+ 99 : : function _burnScaled(address user, address target, uint256 amount, uint256 index) internal {
+ 100 : 26088 : uint256 amountScaled = amount.rayDiv(index);
+ 101 : 26088 : require(amountScaled != 0, Errors.INVALID_BURN_AMOUNT);
102 : :
- 103 : 54282 : uint256 scaledBalance = super.balanceOf(user);
- 104 : 72376 : uint256 balanceIncrease = scaledBalance.rayMul(index) -
- 105 : 36188 : scaledBalance.rayMul(_userState[user].additionalData);
+ 103 : 26087 : uint256 scaledBalance = super.balanceOf(user);
+ 104 : 26087 : uint256 balanceIncrease = scaledBalance.rayMul(index) -
+ 105 : 26087 : scaledBalance.rayMul(_userState[user].additionalData);
106 : :
- 107 : 36188 : _userState[user].additionalData = index.toUint128();
+ 107 : 26087 : _userState[user].additionalData = index.toUint128();
108 : :
- 109 : 36188 : _burn(user, amountScaled.toUint128());
+ 109 : 26087 : _burn(user, amountScaled.toUint128());
110 : :
- 111 : 36186 : if (balanceIncrease > amount) {
- 112 : 4416 : uint256 amountToMint = balanceIncrease - amount;
- 113 : 2944 : emit Transfer(address(0), user, amountToMint);
- 114 : 2944 : emit Mint(user, user, amountToMint, balanceIncrease, index);
+ 111 : 26086 : if (balanceIncrease > amount) {
+ 112 : 1560 : uint256 amountToMint = balanceIncrease - amount;
+ 113 : 1560 : emit Transfer(address(0), user, amountToMint);
+ 114 : 1560 : emit Mint(user, user, amountToMint, balanceIncrease, index);
115 : : } else {
- 116 : 49863 : uint256 amountToBurn = amount - balanceIncrease;
- 117 : 33242 : emit Transfer(user, address(0), amountToBurn);
- 118 : 33242 : emit Burn(user, target, amountToBurn, balanceIncrease, index);
+ 116 : 24526 : uint256 amountToBurn = amount - balanceIncrease;
+ 117 : 24526 : emit Transfer(user, address(0), amountToBurn);
+ 118 : 24526 : emit Burn(user, target, amountToBurn, balanceIncrease, index);
119 : : }
120 : : }
121 : :
@@ -198,31 +198,31 @@
127 : : * @param amount The amount getting transferred
128 : : * @param index The next liquidity index of the reserve
129 : : */
- 130 : 7051 : function _transfer(address sender, address recipient, uint256 amount, uint256 index) internal {
- 131 : 21153 : uint256 senderScaledBalance = super.balanceOf(sender);
- 132 : 28204 : uint256 senderBalanceIncrease = senderScaledBalance.rayMul(index) -
- 133 : 14102 : senderScaledBalance.rayMul(_userState[sender].additionalData);
+ 130 : : function _transfer(address sender, address recipient, uint256 amount, uint256 index) internal {
+ 131 : 25056 : uint256 senderScaledBalance = super.balanceOf(sender);
+ 132 : 25056 : uint256 senderBalanceIncrease = senderScaledBalance.rayMul(index) -
+ 133 : 25056 : senderScaledBalance.rayMul(_userState[sender].additionalData);
134 : :
- 135 : 21153 : uint256 recipientScaledBalance = super.balanceOf(recipient);
- 136 : 28204 : uint256 recipientBalanceIncrease = recipientScaledBalance.rayMul(index) -
- 137 : 14102 : recipientScaledBalance.rayMul(_userState[recipient].additionalData);
+ 135 : 25056 : uint256 recipientScaledBalance = super.balanceOf(recipient);
+ 136 : 25056 : uint256 recipientBalanceIncrease = recipientScaledBalance.rayMul(index) -
+ 137 : 25056 : recipientScaledBalance.rayMul(_userState[recipient].additionalData);
138 : :
- 139 : 14102 : _userState[sender].additionalData = index.toUint128();
- 140 : 14102 : _userState[recipient].additionalData = index.toUint128();
+ 139 : 25056 : _userState[sender].additionalData = index.toUint128();
+ 140 : 25056 : _userState[recipient].additionalData = index.toUint128();
141 : :
- 142 : 14102 : super._transfer(sender, recipient, amount.rayDiv(index).toUint128());
+ 142 : 25056 : super._transfer(sender, recipient, amount.rayDiv(index).toUint128());
143 : :
- 144 : 14102 : if (senderBalanceIncrease > 0) {
- 145 : 2006 : emit Transfer(address(0), sender, senderBalanceIncrease);
- 146 : 2006 : emit Mint(_msgSender(), sender, senderBalanceIncrease, senderBalanceIncrease, index);
+ 144 : 25056 : if (senderBalanceIncrease > 0) {
+ 145 : 1003 : emit Transfer(address(0), sender, senderBalanceIncrease);
+ 146 : 1003 : emit Mint(_msgSender(), sender, senderBalanceIncrease, senderBalanceIncrease, index);
147 : : }
148 : :
- 149 : 28202 : if (sender != recipient && recipientBalanceIncrease > 0) {
- 150 : 2 : emit Transfer(address(0), recipient, recipientBalanceIncrease);
- 151 : 2 : emit Mint(_msgSender(), recipient, recipientBalanceIncrease, recipientBalanceIncrease, index);
+ 149 : 25056 : if (sender != recipient && recipientBalanceIncrease > 0) {
+ 150 : 1 : emit Transfer(address(0), recipient, recipientBalanceIncrease);
+ 151 : 1 : emit Mint(_msgSender(), recipient, recipientBalanceIncrease, recipientBalanceIncrease, index);
152 : : }
153 : :
- 154 : 14102 : emit Transfer(sender, recipient, amount);
+ 154 : 25056 : emit Transfer(sender, recipient, amount);
155 : : }
156 : : }
@@ -232,8 +232,8 @@
diff --git a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/index-sort-b.html b/report/protocol/tokenization/base/index-sort-b.html
similarity index 62%
rename from report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/index-sort-b.html
rename to report/protocol/tokenization/base/index-sort-b.html
index 29cd7fa4..7e154b07 100644
--- a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/index-sort-b.html
+++ b/report/protocol/tokenization/base/index-sort-b.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base
-
+ LCOV - lcov.info.p - protocol/tokenization/base
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../../../glass.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../glass.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../updown.png) |
Rate |
@@ -96,9 +96,9 @@
Hit |
- DebtTokenBase.sol |
+ DebtTokenBase.sol |
-
+
|
100.0 % |
14 |
@@ -106,44 +106,44 @@
- |
|
|
- 100.0 % |
- 5 |
+ 83.3 % |
+ 6 |
5 |
- EIP712Base.sol |
+ EIP712Base.sol |
-
+
|
100.0 % |
- 6 |
- 6 |
+ 7 |
+ 7 |
- |
|
|
100.0 % |
- 3 |
- 3 |
+ 4 |
+ 4 |
- IncentivizedERC20.sol |
+ IncentivizedERC20.sol |
-
+
|
100.0 % |
- 36 |
- 36 |
+ 44 |
+ 44 |
- |
|
|
100.0 % |
- 18 |
- 18 |
+ 21 |
+ 21 |
- MintableIncentivizedERC20.sol |
+ MintableIncentivizedERC20.sol |
-
+
|
100.0 % |
14 |
@@ -152,13 +152,13 @@
|
|
100.0 % |
- 2 |
- 2 |
+ 3 |
+ 3 |
- ScaledBalanceTokenBase.sol |
+ ScaledBalanceTokenBase.sol |
-
+
|
100.0 % |
45 |
@@ -167,16 +167,16 @@
|
|
100.0 % |
- 7 |
- 7 |
+ 8 |
+ 8 |
diff --git a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/index-sort-f.html b/report/protocol/tokenization/base/index-sort-f.html
similarity index 62%
rename from report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/index-sort-f.html
rename to report/protocol/tokenization/base/index-sort-f.html
index 2e83cf55..33cceeb2 100644
--- a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/index-sort-f.html
+++ b/report/protocol/tokenization/base/index-sort-f.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base
-
+ LCOV - lcov.info.p - protocol/tokenization/base
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../../../glass.png) |
+ File ![Click to sort table by file name Sort by file name](../../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../glass.png) |
Rate |
@@ -96,9 +96,9 @@
Hit |
- MintableIncentivizedERC20.sol |
+ DebtTokenBase.sol |
-
+
|
100.0 % |
14 |
@@ -106,18 +106,18 @@
- |
|
|
- 100.0 % |
- 2 |
- 2 |
+ 83.3 % |
+ 6 |
+ 5 |
- EIP712Base.sol |
+ MintableIncentivizedERC20.sol |
-
+
|
100.0 % |
- 6 |
- 6 |
+ 14 |
+ 14 |
- |
|
|
@@ -126,24 +126,24 @@
3 |
- DebtTokenBase.sol |
+ EIP712Base.sol |
-
+
|
100.0 % |
- 14 |
- 14 |
+ 7 |
+ 7 |
- |
|
|
100.0 % |
- 5 |
- 5 |
+ 4 |
+ 4 |
- ScaledBalanceTokenBase.sol |
+ ScaledBalanceTokenBase.sol |
-
+
|
100.0 % |
45 |
@@ -152,31 +152,31 @@
|
|
100.0 % |
- 7 |
- 7 |
+ 8 |
+ 8 |
- IncentivizedERC20.sol |
+ IncentivizedERC20.sol |
-
+
|
100.0 % |
- 36 |
- 36 |
+ 44 |
+ 44 |
- |
|
|
100.0 % |
- 18 |
- 18 |
+ 21 |
+ 21 |
diff --git a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/index-sort-l.html b/report/protocol/tokenization/base/index-sort-l.html
similarity index 62%
rename from report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/index-sort-l.html
rename to report/protocol/tokenization/base/index-sort-l.html
index 0eea4c33..73d52925 100644
--- a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/index-sort-l.html
+++ b/report/protocol/tokenization/base/index-sort-l.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base
-
+ LCOV - lcov.info.p - protocol/tokenization/base
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../../../glass.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../glass.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../updown.png) |
Rate |
@@ -96,24 +96,24 @@
Hit |
- EIP712Base.sol |
+ EIP712Base.sol |
-
+
|
100.0 % |
- 6 |
- 6 |
+ 7 |
+ 7 |
- |
|
|
100.0 % |
- 3 |
- 3 |
+ 4 |
+ 4 |
- DebtTokenBase.sol |
+ DebtTokenBase.sol |
-
+
|
100.0 % |
14 |
@@ -121,14 +121,14 @@
- |
|
|
- 100.0 % |
- 5 |
+ 83.3 % |
+ 6 |
5 |
- MintableIncentivizedERC20.sol |
+ MintableIncentivizedERC20.sol |
-
+
|
100.0 % |
14 |
@@ -137,28 +137,28 @@
|
|
100.0 % |
- 2 |
- 2 |
+ 3 |
+ 3 |
- IncentivizedERC20.sol |
+ IncentivizedERC20.sol |
-
+
|
100.0 % |
- 36 |
- 36 |
+ 44 |
+ 44 |
- |
|
|
100.0 % |
- 18 |
- 18 |
+ 21 |
+ 21 |
- ScaledBalanceTokenBase.sol |
+ ScaledBalanceTokenBase.sol |
-
+
|
100.0 % |
45 |
@@ -167,16 +167,16 @@
|
|
100.0 % |
- 7 |
- 7 |
+ 8 |
+ 8 |
diff --git a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/index.html b/report/protocol/tokenization/base/index.html
similarity index 62%
rename from report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/index.html
rename to report/protocol/tokenization/base/index.html
index 4296bf54..96058176 100644
--- a/report/core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base/index.html
+++ b/report/protocol/tokenization/base/index.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/protocol/tokenization/base/src/core/contracts/protocol/tokenization/base
-
+ LCOV - lcov.info.p - protocol/tokenization/base
+
LCOV - code coverage report |
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
|
- ![](../../../../../../../../../../../glass.png) |
+ ![](../../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../../../glass.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../../../glass.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../updown.png) |
Rate |
@@ -96,9 +96,9 @@
Hit |
- DebtTokenBase.sol |
+ DebtTokenBase.sol |
-
+
|
100.0 % |
14 |
@@ -106,44 +106,44 @@
- |
|
|
- 100.0 % |
- 5 |
+ 83.3 % |
+ 6 |
5 |
- EIP712Base.sol |
+ EIP712Base.sol |
-
+
|
100.0 % |
- 6 |
- 6 |
+ 7 |
+ 7 |
- |
|
|
100.0 % |
- 3 |
- 3 |
+ 4 |
+ 4 |
- IncentivizedERC20.sol |
+ IncentivizedERC20.sol |
-
+
|
100.0 % |
- 36 |
- 36 |
+ 44 |
+ 44 |
- |
|
|
100.0 % |
- 18 |
- 18 |
+ 21 |
+ 21 |
- MintableIncentivizedERC20.sol |
+ MintableIncentivizedERC20.sol |
-
+
|
100.0 % |
14 |
@@ -152,13 +152,13 @@
|
|
100.0 % |
- 2 |
- 2 |
+ 3 |
+ 3 |
- ScaledBalanceTokenBase.sol |
+ ScaledBalanceTokenBase.sol |
-
+
|
100.0 % |
45 |
@@ -167,16 +167,16 @@
|
|
100.0 % |
- 7 |
- 7 |
+ 8 |
+ 8 |
diff --git a/report/core/contracts/misc/src/core/contracts/misc/index-sort-b.html b/report/protocol/tokenization/index-sort-b.html
similarity index 59%
rename from report/core/contracts/misc/src/core/contracts/misc/index-sort-b.html
rename to report/protocol/tokenization/index-sort-b.html
index 7d93d509..5b0ce9c8 100644
--- a/report/core/contracts/misc/src/core/contracts/misc/index-sort-b.html
+++ b/report/protocol/tokenization/index-sort-b.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/misc/src/core/contracts/misc
-
+ LCOV - lcov.info.p - protocol/tokenization
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../glass.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../glass.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../updown.png) |
Rate |
@@ -96,42 +96,42 @@
Hit |
- AaveOracle.sol |
+ AToken.sol |
-
+
|
100.0 % |
- 25 |
- 25 |
+ 37 |
+ 37 |
- |
|
|
100.0 % |
- 9 |
- 9 |
+ 17 |
+ 17 |
- L2Encoder.sol |
+ VariableDebtToken.sol |
-
+
|
100.0 % |
- 68 |
- 68 |
+ 18 |
+ 18 |
- |
|
|
100.0 % |
- 11 |
- 11 |
+ 13 |
+ 13 |
diff --git a/report/core/contracts/misc/src/core/contracts/misc/index-sort-f.html b/report/protocol/tokenization/index-sort-f.html
similarity index 59%
rename from report/core/contracts/misc/src/core/contracts/misc/index-sort-f.html
rename to report/protocol/tokenization/index-sort-f.html
index a99df311..11806bda 100644
--- a/report/core/contracts/misc/src/core/contracts/misc/index-sort-f.html
+++ b/report/protocol/tokenization/index-sort-f.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/misc/src/core/contracts/misc
-
+ LCOV - lcov.info.p - protocol/tokenization
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../glass.png) |
+ File ![Click to sort table by file name Sort by file name](../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../glass.png) |
Rate |
@@ -96,42 +96,42 @@
Hit |
- AaveOracle.sol |
+ VariableDebtToken.sol |
-
+
|
100.0 % |
- 25 |
- 25 |
+ 18 |
+ 18 |
- |
|
|
100.0 % |
- 9 |
- 9 |
+ 13 |
+ 13 |
- L2Encoder.sol |
+ AToken.sol |
-
+
|
100.0 % |
- 68 |
- 68 |
+ 37 |
+ 37 |
- |
|
|
100.0 % |
- 11 |
- 11 |
+ 17 |
+ 17 |
diff --git a/report/core/contracts/misc/src/core/contracts/misc/index-sort-l.html b/report/protocol/tokenization/index-sort-l.html
similarity index 59%
rename from report/core/contracts/misc/src/core/contracts/misc/index-sort-l.html
rename to report/protocol/tokenization/index-sort-l.html
index 3464dc07..59ef346b 100644
--- a/report/core/contracts/misc/src/core/contracts/misc/index-sort-l.html
+++ b/report/protocol/tokenization/index-sort-l.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/misc/src/core/contracts/misc
-
+ LCOV - lcov.info.p - protocol/tokenization
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../glass.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../glass.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../updown.png) |
Rate |
@@ -96,42 +96,42 @@
Hit |
- AaveOracle.sol |
+ VariableDebtToken.sol |
-
+
|
100.0 % |
- 25 |
- 25 |
+ 18 |
+ 18 |
- |
|
|
100.0 % |
- 9 |
- 9 |
+ 13 |
+ 13 |
- L2Encoder.sol |
+ AToken.sol |
-
+
|
100.0 % |
- 68 |
- 68 |
+ 37 |
+ 37 |
- |
|
|
100.0 % |
- 11 |
- 11 |
+ 17 |
+ 17 |
diff --git a/report/core/contracts/misc/src/core/contracts/misc/index.html b/report/protocol/tokenization/index.html
similarity index 59%
rename from report/core/contracts/misc/src/core/contracts/misc/index.html
rename to report/protocol/tokenization/index.html
index 1fd42a0a..6f6015ee 100644
--- a/report/core/contracts/misc/src/core/contracts/misc/index.html
+++ b/report/protocol/tokenization/index.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - core/contracts/misc/src/core/contracts/misc
-
+ LCOV - lcov.info.p - protocol/tokenization
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../glass.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../../glass.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../updown.png) |
Rate |
@@ -96,42 +96,42 @@
Hit |
- AaveOracle.sol |
+ AToken.sol |
-
+
|
100.0 % |
- 25 |
- 25 |
+ 37 |
+ 37 |
- |
|
|
100.0 % |
- 9 |
- 9 |
+ 17 |
+ 17 |
- L2Encoder.sol |
+ VariableDebtToken.sol |
-
+
|
100.0 % |
- 68 |
- 68 |
+ 18 |
+ 18 |
- |
|
|
100.0 % |
- 11 |
- 11 |
+ 13 |
+ 13 |
diff --git a/report/periphery/contracts/rewards/src/periphery/contracts/rewards/EmissionManager.sol.func-c.html b/report/rewards/EmissionManager.sol.func-c.html
similarity index 68%
rename from report/periphery/contracts/rewards/src/periphery/contracts/rewards/EmissionManager.sol.func-c.html
rename to report/rewards/EmissionManager.sol.func-c.html
index da53ffae..7861551c 100644
--- a/report/periphery/contracts/rewards/src/periphery/contracts/rewards/EmissionManager.sol.func-c.html
+++ b/report/rewards/EmissionManager.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/rewards/src/periphery/contracts/rewards/EmissionManager.sol - functions
-
+ LCOV - lcov.info.p - rewards/EmissionManager.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,21 +53,21 @@
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../glass.png) |
@@ -77,6 +77,13 @@
2 |
+
+
+ EmissionManager.onlyEmissionAdmin |
+
+ 2 |
+
+
EmissionManager.setDistributionEnd |
@@ -107,37 +114,44 @@
- EmissionManager.setClaimer |
+ EmissionManager.getEmissionAdmin |
- 4 |
+ 6 |
- EmissionManager.getEmissionAdmin |
+ EmissionManager.setEmissionAdmin |
- 6 |
+ 41 |
- EmissionManager.configureAssets |
+ EmissionManager. |
- 20 |
+ 238 |
- EmissionManager.setEmissionAdmin |
+ EmissionManager.setRewardsController |
- 25 |
+ 680 |
- EmissionManager.setRewardsController |
+ EmissionManager.setClaimer |
+
+ 1004 |
+
+
+
+
+ EmissionManager.configureAssets |
- 606 |
+ 9023 |
@@ -145,8 +159,8 @@
diff --git a/report/periphery/contracts/rewards/src/periphery/contracts/rewards/EmissionManager.sol.func.html b/report/rewards/EmissionManager.sol.func.html
similarity index 68%
rename from report/periphery/contracts/rewards/src/periphery/contracts/rewards/EmissionManager.sol.func.html
rename to report/rewards/EmissionManager.sol.func.html
index 3493873d..fefade3f 100644
--- a/report/periphery/contracts/rewards/src/periphery/contracts/rewards/EmissionManager.sol.func.html
+++ b/report/rewards/EmissionManager.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/rewards/src/periphery/contracts/rewards/EmissionManager.sol - functions
-
+ LCOV - lcov.info.p - rewards/EmissionManager.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,28 +53,35 @@
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../updown.png) |
+
+
+
+
+ EmissionManager. |
+
+ 238 |
EmissionManager.configureAssets |
- 20 |
+ 9023 |
@@ -91,11 +98,18 @@
2 |
+
+
+ EmissionManager.onlyEmissionAdmin |
+
+ 2 |
+
+
EmissionManager.setClaimer |
- 4 |
+ 1004 |
@@ -109,7 +123,7 @@
EmissionManager.setEmissionAdmin |
- 25 |
+ 41 |
@@ -130,7 +144,7 @@
EmissionManager.setRewardsController |
- 606 |
+ 680 |
@@ -145,8 +159,8 @@
diff --git a/report/periphery/contracts/rewards/src/periphery/contracts/rewards/EmissionManager.sol.gcov.html b/report/rewards/EmissionManager.sol.gcov.html
similarity index 78%
rename from report/periphery/contracts/rewards/src/periphery/contracts/rewards/EmissionManager.sol.gcov.html
rename to report/rewards/EmissionManager.sol.gcov.html
index 3acc4377..e1acb304 100644
--- a/report/periphery/contracts/rewards/src/periphery/contracts/rewards/EmissionManager.sol.gcov.html
+++ b/report/rewards/EmissionManager.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/rewards/src/periphery/contracts/rewards/EmissionManager.sol
-
+ LCOV - lcov.info.p - rewards/EmissionManager.sol
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
@@ -72,8 +72,8 @@
1 : : // SPDX-License-Identifier: BUSL-1.1
2 : : pragma solidity ^0.8.10;
3 : :
- 4 : : import {Ownable} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/Ownable.sol';
- 5 : : import {IEACAggregatorProxy} from '../misc/interfaces/IEACAggregatorProxy.sol';
+ 4 : : import {Ownable} from '../dependencies/openzeppelin/contracts/Ownable.sol';
+ 5 : : import {IEACAggregatorProxy} from '../helpers/interfaces/IEACAggregatorProxy.sol';
6 : : import {IEmissionManager} from './interfaces/IEmissionManager.sol';
7 : : import {ITransferStrategyBase} from './interfaces/ITransferStrategyBase.sol';
8 : : import {IRewardsController} from './interfaces/IRewardsController.sol';
@@ -94,7 +94,7 @@
23 : : * @dev Only emission admin of the given reward can call functions marked by this modifier.
24 : : **/
25 : : modifier onlyEmissionAdmin(address reward) {
- 26 : : require(msg.sender == _emissionAdmins[reward], 'ONLY_EMISSION_ADMIN');
+ 26 : 2 : require(msg.sender == _emissionAdmins[reward], 'ONLY_EMISSION_ADMIN');
27 : : _;
28 : : }
29 : :
@@ -103,79 +103,79 @@
32 : : * @param owner The address of the owner
33 : : */
34 : : constructor(address owner) {
- 35 : : transferOwnership(owner);
+ 35 : 91 : transferOwnership(owner);
36 : : }
37 : :
38 : : /// @inheritdoc IEmissionManager
- 39 : 20 : function configureAssets(RewardsDataTypes.RewardsConfigInput[] memory config) external override {
- 40 : 100 : for (uint256 i = 0; i < config.length; i++) {
- 41 : 40 : require(_emissionAdmins[config[i].reward] == msg.sender, 'ONLY_EMISSION_ADMIN');
+ 39 : : function configureAssets(RewardsDataTypes.RewardsConfigInput[] memory config) external override {
+ 40 : 9023 : for (uint256 i = 0; i < config.length; i++) {
+ 41 : 9023 : require(_emissionAdmins[config[i].reward] == msg.sender, 'ONLY_EMISSION_ADMIN');
42 : : }
- 43 : 40 : _rewardsController.configureAssets(config);
+ 43 : 9023 : _rewardsController.configureAssets(config);
44 : : }
45 : :
46 : : /// @inheritdoc IEmissionManager
- 47 : 2 : function setTransferStrategy(
+ 47 : : function setTransferStrategy(
48 : : address reward,
49 : : ITransferStrategyBase transferStrategy
50 : : ) external override onlyEmissionAdmin(reward) {
- 51 : 4 : _rewardsController.setTransferStrategy(reward, transferStrategy);
+ 51 : 2 : _rewardsController.setTransferStrategy(reward, transferStrategy);
52 : : }
53 : :
54 : : /// @inheritdoc IEmissionManager
- 55 : 2 : function setRewardOracle(
+ 55 : : function setRewardOracle(
56 : : address reward,
57 : : IEACAggregatorProxy rewardOracle
58 : : ) external override onlyEmissionAdmin(reward) {
- 59 : 4 : _rewardsController.setRewardOracle(reward, rewardOracle);
+ 59 : 2 : _rewardsController.setRewardOracle(reward, rewardOracle);
60 : : }
61 : :
62 : : /// @inheritdoc IEmissionManager
- 63 : 2 : function setDistributionEnd(
+ 63 : : function setDistributionEnd(
64 : : address asset,
65 : : address reward,
66 : : uint32 newDistributionEnd
67 : : ) external override onlyEmissionAdmin(reward) {
- 68 : 4 : _rewardsController.setDistributionEnd(asset, reward, newDistributionEnd);
+ 68 : 2 : _rewardsController.setDistributionEnd(asset, reward, newDistributionEnd);
69 : : }
70 : :
71 : : /// @inheritdoc IEmissionManager
- 72 : 2 : function setEmissionPerSecond(
+ 72 : : function setEmissionPerSecond(
73 : : address asset,
74 : : address[] calldata rewards,
75 : : uint88[] calldata newEmissionsPerSecond
76 : : ) external override {
- 77 : 10 : for (uint256 i = 0; i < rewards.length; i++) {
- 78 : 4 : require(_emissionAdmins[rewards[i]] == msg.sender, 'ONLY_EMISSION_ADMIN');
+ 77 : 2 : for (uint256 i = 0; i < rewards.length; i++) {
+ 78 : 2 : require(_emissionAdmins[rewards[i]] == msg.sender, 'ONLY_EMISSION_ADMIN');
79 : : }
- 80 : 4 : _rewardsController.setEmissionPerSecond(asset, rewards, newEmissionsPerSecond);
+ 80 : 2 : _rewardsController.setEmissionPerSecond(asset, rewards, newEmissionsPerSecond);
81 : : }
82 : :
83 : : /// @inheritdoc IEmissionManager
- 84 : 4 : function setClaimer(address user, address claimer) external override onlyOwner {
- 85 : 8 : _rewardsController.setClaimer(user, claimer);
+ 84 : : function setClaimer(address user, address claimer) external override onlyOwner {
+ 85 : 1004 : _rewardsController.setClaimer(user, claimer);
86 : : }
87 : :
88 : : /// @inheritdoc IEmissionManager
- 89 : 25 : function setEmissionAdmin(address reward, address admin) external override onlyOwner {
- 90 : 50 : address oldAdmin = _emissionAdmins[reward];
- 91 : 50 : _emissionAdmins[reward] = admin;
- 92 : 50 : emit EmissionAdminUpdated(reward, oldAdmin, admin);
+ 89 : : function setEmissionAdmin(address reward, address admin) external override onlyOwner {
+ 90 : 41 : address oldAdmin = _emissionAdmins[reward];
+ 91 : 41 : _emissionAdmins[reward] = admin;
+ 92 : 41 : emit EmissionAdminUpdated(reward, oldAdmin, admin);
93 : : }
94 : :
95 : : /// @inheritdoc IEmissionManager
- 96 : 606 : function setRewardsController(address controller) external override onlyOwner {
- 97 : 1212 : _rewardsController = IRewardsController(controller);
+ 96 : : function setRewardsController(address controller) external override onlyOwner {
+ 97 : 680 : _rewardsController = IRewardsController(controller);
98 : : }
99 : :
100 : : /// @inheritdoc IEmissionManager
- 101 : 2 : function getRewardsController() external view override returns (IRewardsController) {
- 102 : 4 : return _rewardsController;
+ 101 : : function getRewardsController() external view override returns (IRewardsController) {
+ 102 : 2 : return _rewardsController;
103 : : }
104 : :
105 : : /// @inheritdoc IEmissionManager
- 106 : 6 : function getEmissionAdmin(address reward) external view override returns (address) {
- 107 : 12 : return _emissionAdmins[reward];
+ 106 : : function getEmissionAdmin(address reward) external view override returns (address) {
+ 107 : 6 : return _emissionAdmins[reward];
108 : : }
109 : : }
@@ -185,8 +185,8 @@
diff --git a/report/periphery/contracts/rewards/src/periphery/contracts/rewards/RewardsController.sol.func-c.html b/report/rewards/RewardsController.sol.func-c.html
similarity index 74%
rename from report/periphery/contracts/rewards/src/periphery/contracts/rewards/RewardsController.sol.func-c.html
rename to report/rewards/RewardsController.sol.func-c.html
index 352a1250..162f744e 100644
--- a/report/periphery/contracts/rewards/src/periphery/contracts/rewards/RewardsController.sol.func-c.html
+++ b/report/rewards/RewardsController.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/rewards/src/periphery/contracts/rewards/RewardsController.sol - functions
-
+ LCOV - lcov.info.p - rewards/RewardsController.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
+
+
-
-
+
|
-
-
-
+
+
+
|
@@ -53,21 +53,28 @@
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../glass.png) |
+
+
+
+
+ RewardsController. |
+
+ 0 |
@@ -121,9 +128,9 @@
- RewardsController.getClaimer |
+ RewardsController.onlyAuthorizedClaimers |
- 2 |
+ 1 |
@@ -149,86 +156,93 @@
- RewardsController.claimRewards |
+ RewardsController.setClaimer |
- 4 |
+ 1004 |
- RewardsController.setClaimer |
+ RewardsController.getRevision |
- 4 |
+ 1387 |
- RewardsController._claimRewards |
+ RewardsController.initialize |
- 6 |
+ 1387 |
RewardsController._transferRewards |
- 7 |
+ 1902 |
- RewardsController._getUserAssetBalances |
+ RewardsController.getClaimer |
- 19 |
+ 2002 |
- RewardsController.configureAssets |
+ RewardsController.claimRewards |
- 20 |
+ 2521 |
- RewardsController._installTransferStrategy |
+ RewardsController._claimRewards |
- 22 |
+ 2523 |
- RewardsController._isContract |
+ RewardsController._getUserAssetBalances |
- 22 |
+ 3537 |
- RewardsController._setRewardOracle |
+ RewardsController.configureAssets |
- 22 |
+ 9023 |
- RewardsController.getRevision |
+ RewardsController._installTransferStrategy |
- 1231 |
+ 9025 |
- RewardsController.initialize |
+ RewardsController._isContract |
+
+ 9025 |
+
+
+
+
+ RewardsController._setRewardOracle |
- 1231 |
+ 9025 |
RewardsController.handleAction |
- 53887 |
+ 138815 |
@@ -236,8 +250,8 @@
diff --git a/report/periphery/contracts/rewards/src/periphery/contracts/rewards/RewardsController.sol.func.html b/report/rewards/RewardsController.sol.func.html
similarity index 74%
rename from report/periphery/contracts/rewards/src/periphery/contracts/rewards/RewardsController.sol.func.html
rename to report/rewards/RewardsController.sol.func.html
index 81283855..88712b4e 100644
--- a/report/periphery/contracts/rewards/src/periphery/contracts/rewards/RewardsController.sol.func.html
+++ b/report/rewards/RewardsController.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/rewards/src/periphery/contracts/rewards/RewardsController.sol - functions
-
+ LCOV - lcov.info.p - rewards/RewardsController.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
+
+
-
-
+
|
-
-
-
+
+
+
|
@@ -53,21 +53,28 @@
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../updown.png) |
+
+
+
+
+ RewardsController. |
+
+ 0 |
@@ -81,42 +88,42 @@
RewardsController._claimRewards |
- 6 |
+ 2523 |
RewardsController._getUserAssetBalances |
- 19 |
+ 3537 |
RewardsController._installTransferStrategy |
- 22 |
+ 9025 |
RewardsController._isContract |
- 22 |
+ 9025 |
RewardsController._setRewardOracle |
- 22 |
+ 9025 |
RewardsController._transferRewards |
- 7 |
+ 1902 |
@@ -144,7 +151,7 @@
RewardsController.claimRewards |
- 4 |
+ 2521 |
@@ -165,21 +172,21 @@
RewardsController.configureAssets |
- 20 |
+ 9023 |
RewardsController.getClaimer |
- 2 |
+ 2002 |
RewardsController.getRevision |
- 1231 |
+ 1387 |
@@ -200,21 +207,28 @@
RewardsController.handleAction |
- 53887 |
+ 138815 |
RewardsController.initialize |
- 1231 |
+ 1387 |
+
+
+
+
+ RewardsController.onlyAuthorizedClaimers |
+
+ 1 |
RewardsController.setClaimer |
- 4 |
+ 1004 |
@@ -236,8 +250,8 @@
diff --git a/report/periphery/contracts/rewards/src/periphery/contracts/rewards/RewardsController.sol.gcov.html b/report/rewards/RewardsController.sol.gcov.html
similarity index 82%
rename from report/periphery/contracts/rewards/src/periphery/contracts/rewards/RewardsController.sol.gcov.html
rename to report/rewards/RewardsController.sol.gcov.html
index 67e5d544..2d62f326 100644
--- a/report/periphery/contracts/rewards/src/periphery/contracts/rewards/RewardsController.sol.gcov.html
+++ b/report/rewards/RewardsController.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/rewards/src/periphery/contracts/rewards/RewardsController.sol
-
+ LCOV - lcov.info.p - rewards/RewardsController.sol
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
+
+
-
-
+
|
-
-
-
+
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
@@ -72,14 +72,14 @@
1 : : // SPDX-License-Identifier: BUSL-1.1
2 : : pragma solidity ^0.8.10;
3 : :
- 4 : : import {VersionedInitializable} from 'aave-v3-core/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol';
- 5 : : import {SafeCast} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol';
- 6 : : import {IScaledBalanceToken} from 'aave-v3-core/contracts/interfaces/IScaledBalanceToken.sol';
+ 4 : : import {VersionedInitializable} from '../misc/aave-upgradeability/VersionedInitializable.sol';
+ 5 : : import {SafeCast} from '../dependencies/openzeppelin/contracts/SafeCast.sol';
+ 6 : : import {IScaledBalanceToken} from '../interfaces/IScaledBalanceToken.sol';
7 : : import {RewardsDistributor} from './RewardsDistributor.sol';
8 : : import {IRewardsController} from './interfaces/IRewardsController.sol';
9 : : import {ITransferStrategyBase} from './interfaces/ITransferStrategyBase.sol';
10 : : import {RewardsDataTypes} from './libraries/RewardsDataTypes.sol';
- 11 : : import {IEACAggregatorProxy} from '../misc/interfaces/IEACAggregatorProxy.sol';
+ 11 : : import {IEACAggregatorProxy} from '../helpers/interfaces/IEACAggregatorProxy.sol';
12 : :
13 : : /**
14 : : * @title RewardsController
@@ -108,7 +108,7 @@
37 : : mapping(address => IEACAggregatorProxy) internal _rewardOracle;
38 : :
39 : : modifier onlyAuthorizedClaimers(address claimer, address user) {
- 40 : : require(_authorizedClaimers[user] == claimer, 'CLAIMER_UNAUTHORIZED');
+ 40 : 1 : require(_authorizedClaimers[user] == claimer, 'CLAIMER_UNAUTHORIZED');
41 : : _;
42 : : }
43 : :
@@ -118,113 +118,113 @@
47 : : * @dev Initialize for RewardsController
48 : : * @dev It expects an address as argument since its initialized via PoolAddressesProvider._updateImpl()
49 : : **/
- 50 : 1231 : function initialize(address) external initializer {}
+ 50 : : function initialize(address) external initializer {}
51 : :
52 : : /// @inheritdoc IRewardsController
- 53 : 2 : function getClaimer(address user) external view override returns (address) {
- 54 : 4 : return _authorizedClaimers[user];
+ 53 : : function getClaimer(address user) external view override returns (address) {
+ 54 : 2002 : return _authorizedClaimers[user];
55 : : }
56 : :
57 : : /**
58 : : * @dev Returns the revision of the implementation contract
59 : : * @return uint256, current revision version
60 : : */
- 61 : 1231 : function getRevision() internal pure override returns (uint256) {
- 62 : 2462 : return REVISION;
+ 61 : : function getRevision() internal pure override returns (uint256) {
+ 62 : 1387 : return REVISION;
63 : : }
64 : :
65 : : /// @inheritdoc IRewardsController
- 66 : 1 : function getRewardOracle(address reward) external view override returns (address) {
- 67 : 3 : return address(_rewardOracle[reward]);
+ 66 : : function getRewardOracle(address reward) external view override returns (address) {
+ 67 : 1 : return address(_rewardOracle[reward]);
68 : : }
69 : :
70 : : /// @inheritdoc IRewardsController
- 71 : 1 : function getTransferStrategy(address reward) external view override returns (address) {
- 72 : 3 : return address(_transferStrategy[reward]);
+ 71 : : function getTransferStrategy(address reward) external view override returns (address) {
+ 72 : 1 : return address(_transferStrategy[reward]);
73 : : }
74 : :
75 : : /// @inheritdoc IRewardsController
- 76 : 20 : function configureAssets(
+ 76 : : function configureAssets(
77 : : RewardsDataTypes.RewardsConfigInput[] memory config
78 : : ) external override onlyEmissionManager {
- 79 : 100 : for (uint256 i = 0; i < config.length; i++) {
+ 79 : 9023 : for (uint256 i = 0; i < config.length; i++) {
80 : : // Get the current Scaled Total Supply of AToken or Debt token
- 81 : 40 : config[i].totalSupply = IScaledBalanceToken(config[i].asset).scaledTotalSupply();
+ 81 : 9023 : config[i].totalSupply = IScaledBalanceToken(config[i].asset).scaledTotalSupply();
82 : :
83 : : // Install TransferStrategy logic at IncentivesController
- 84 : 40 : _installTransferStrategy(config[i].reward, config[i].transferStrategy);
+ 84 : 9023 : _installTransferStrategy(config[i].reward, config[i].transferStrategy);
85 : :
86 : : // Set reward oracle, enforces input oracle to have latestPrice function
- 87 : 40 : _setRewardOracle(config[i].reward, config[i].rewardOracle);
+ 87 : 9023 : _setRewardOracle(config[i].reward, config[i].rewardOracle);
88 : : }
- 89 : 40 : _configureAssets(config);
+ 89 : 9023 : _configureAssets(config);
90 : : }
91 : :
92 : : /// @inheritdoc IRewardsController
- 93 : 2 : function setTransferStrategy(
+ 93 : : function setTransferStrategy(
94 : : address reward,
95 : : ITransferStrategyBase transferStrategy
96 : : ) external onlyEmissionManager {
- 97 : 4 : _installTransferStrategy(reward, transferStrategy);
+ 97 : 2 : _installTransferStrategy(reward, transferStrategy);
98 : : }
99 : :
100 : : /// @inheritdoc IRewardsController
- 101 : 2 : function setRewardOracle(
+ 101 : : function setRewardOracle(
102 : : address reward,
103 : : IEACAggregatorProxy rewardOracle
104 : : ) external onlyEmissionManager {
- 105 : 4 : _setRewardOracle(reward, rewardOracle);
+ 105 : 2 : _setRewardOracle(reward, rewardOracle);
106 : : }
107 : :
108 : : /// @inheritdoc IRewardsController
- 109 : 53887 : function handleAction(address user, uint256 totalSupply, uint256 userBalance) external override {
- 110 : 107774 : _updateData(msg.sender, user, userBalance, totalSupply);
+ 109 : : function handleAction(address user, uint256 totalSupply, uint256 userBalance) external override {
+ 110 : 138815 : _updateData(msg.sender, user, userBalance, totalSupply);
111 : : }
112 : :
113 : : /// @inheritdoc IRewardsController
- 114 : 4 : function claimRewards(
+ 114 : : function claimRewards(
115 : : address[] calldata assets,
116 : : uint256 amount,
117 : : address to,
118 : : address reward
119 : : ) external override returns (uint256) {
- 120 : 8 : require(to != address(0), 'INVALID_TO_ADDRESS');
- 121 : 12 : return _claimRewards(assets, amount, msg.sender, msg.sender, to, reward);
+ 120 : 2521 : require(to != address(0), 'INVALID_TO_ADDRESS');
+ 121 : 2521 : return _claimRewards(assets, amount, msg.sender, msg.sender, to, reward);
122 : : }
123 : :
124 : : /// @inheritdoc IRewardsController
- 125 : 1 : function claimRewardsOnBehalf(
+ 125 : : function claimRewardsOnBehalf(
126 : : address[] calldata assets,
127 : : uint256 amount,
128 : : address user,
129 : : address to,
130 : : address reward
131 : : ) external override onlyAuthorizedClaimers(msg.sender, user) returns (uint256) {
- 132 : 2 : require(user != address(0), 'INVALID_USER_ADDRESS');
- 133 : 2 : require(to != address(0), 'INVALID_TO_ADDRESS');
- 134 : 3 : return _claimRewards(assets, amount, msg.sender, user, to, reward);
+ 132 : 1 : require(user != address(0), 'INVALID_USER_ADDRESS');
+ 133 : 1 : require(to != address(0), 'INVALID_TO_ADDRESS');
+ 134 : 1 : return _claimRewards(assets, amount, msg.sender, user, to, reward);
135 : : }
136 : :
137 : : /// @inheritdoc IRewardsController
- 138 : 1 : function claimRewardsToSelf(
+ 138 : : function claimRewardsToSelf(
139 : : address[] calldata assets,
140 : : uint256 amount,
141 : : address reward
142 : : ) external override returns (uint256) {
- 143 : 3 : return _claimRewards(assets, amount, msg.sender, msg.sender, msg.sender, reward);
+ 143 : 1 : return _claimRewards(assets, amount, msg.sender, msg.sender, msg.sender, reward);
144 : : }
145 : :
146 : : /// @inheritdoc IRewardsController
- 147 : 1 : function claimAllRewards(
+ 147 : : function claimAllRewards(
148 : : address[] calldata assets,
149 : : address to
150 : : ) external override returns (address[] memory rewardsList, uint256[] memory claimedAmounts) {
- 151 : 2 : require(to != address(0), 'INVALID_TO_ADDRESS');
- 152 : 3 : return _claimAllRewards(assets, msg.sender, msg.sender, to);
+ 151 : 1 : require(to != address(0), 'INVALID_TO_ADDRESS');
+ 152 : 1 : return _claimAllRewards(assets, msg.sender, msg.sender, to);
153 : : }
154 : :
155 : : /// @inheritdoc IRewardsController
- 156 : 1 : function claimAllRewardsOnBehalf(
+ 156 : : function claimAllRewardsOnBehalf(
157 : : address[] calldata assets,
158 : : address user,
159 : : address to
@@ -234,22 +234,22 @@
163 : : onlyAuthorizedClaimers(msg.sender, user)
164 : : returns (address[] memory rewardsList, uint256[] memory claimedAmounts)
165 : : {
- 166 : 2 : require(user != address(0), 'INVALID_USER_ADDRESS');
- 167 : 2 : require(to != address(0), 'INVALID_TO_ADDRESS');
- 168 : 3 : return _claimAllRewards(assets, msg.sender, user, to);
+ 166 : 1 : require(user != address(0), 'INVALID_USER_ADDRESS');
+ 167 : 1 : require(to != address(0), 'INVALID_TO_ADDRESS');
+ 168 : 1 : return _claimAllRewards(assets, msg.sender, user, to);
169 : : }
170 : :
171 : : /// @inheritdoc IRewardsController
- 172 : 1 : function claimAllRewardsToSelf(
+ 172 : : function claimAllRewardsToSelf(
173 : : address[] calldata assets
174 : : ) external override returns (address[] memory rewardsList, uint256[] memory claimedAmounts) {
- 175 : 3 : return _claimAllRewards(assets, msg.sender, msg.sender, msg.sender);
+ 175 : 1 : return _claimAllRewards(assets, msg.sender, msg.sender, msg.sender);
176 : : }
177 : :
178 : : /// @inheritdoc IRewardsController
- 179 : 4 : function setClaimer(address user, address caller) external override onlyEmissionManager {
- 180 : 8 : _authorizedClaimers[user] = caller;
- 181 : 8 : emit ClaimerSet(user, caller);
+ 179 : : function setClaimer(address user, address caller) external override onlyEmissionManager {
+ 180 : 1004 : _authorizedClaimers[user] = caller;
+ 181 : 1004 : emit ClaimerSet(user, caller);
182 : : }
183 : :
184 : : /**
@@ -258,14 +258,14 @@
187 : : * @param user Address of the user
188 : : * @return userAssetBalances contains a list of structs with user balance and total supply of the given assets
189 : : */
- 190 : 19 : function _getUserAssetBalances(
+ 190 : : function _getUserAssetBalances(
191 : : address[] calldata assets,
192 : : address user
193 : : ) internal view override returns (RewardsDataTypes.UserAssetBalance[] memory userAssetBalances) {
- 194 : 38 : userAssetBalances = new RewardsDataTypes.UserAssetBalance[](assets.length);
- 195 : 95 : for (uint256 i = 0; i < assets.length; i++) {
- 196 : 38 : userAssetBalances[i].asset = assets[i];
- 197 : 38 : (userAssetBalances[i].userBalance, userAssetBalances[i].totalSupply) = IScaledBalanceToken(
+ 194 : 3537 : userAssetBalances = new RewardsDataTypes.UserAssetBalance[](assets.length);
+ 195 : 3537 : for (uint256 i = 0; i < assets.length; i++) {
+ 196 : 3537 : userAssetBalances[i].asset = assets[i];
+ 197 : 3537 : (userAssetBalances[i].userBalance, userAssetBalances[i].totalSupply) = IScaledBalanceToken(
198 : : assets[i]
199 : : ).getScaledUserBalanceAndSupply(user);
200 : : }
@@ -282,7 +282,7 @@
211 : : * @param reward Address of the reward token
212 : : * @return Rewards claimed
213 : : **/
- 214 : 6 : function _claimRewards(
+ 214 : : function _claimRewards(
215 : : address[] calldata assets,
216 : : uint256 amount,
217 : : address claimer,
@@ -290,34 +290,34 @@
219 : : address to,
220 : : address reward
221 : : ) internal returns (uint256) {
- 222 : 12 : if (amount == 0) {
- 223 : 2 : return 0;
+ 222 : 2523 : if (amount == 0) {
+ 223 : 1 : return 0;
224 : : }
- 225 : 10 : uint256 totalRewards;
+ 225 : 2522 : uint256 totalRewards;
226 : :
- 227 : 10 : _updateDataMultiple(user, _getUserAssetBalances(assets, user));
- 228 : 23 : for (uint256 i = 0; i < assets.length; i++) {
- 229 : 10 : address asset = assets[i];
- 230 : 10 : totalRewards += _assets[asset].rewards[reward].usersData[user].accrued;
+ 227 : 2522 : _updateDataMultiple(user, _getUserAssetBalances(assets, user));
+ 228 : 2522 : for (uint256 i = 0; i < assets.length; i++) {
+ 229 : 2522 : address asset = assets[i];
+ 230 : 2522 : totalRewards += _assets[asset].rewards[reward].usersData[user].accrued;
231 : :
- 232 : 10 : if (totalRewards <= amount) {
- 233 : 8 : _assets[asset].rewards[reward].usersData[user].accrued = 0;
+ 232 : 2522 : if (totalRewards <= amount) {
+ 233 : 2521 : _assets[asset].rewards[reward].usersData[user].accrued = 0;
234 : : } else {
- 235 : 3 : uint256 difference = totalRewards - amount;
- 236 : 2 : totalRewards -= difference;
- 237 : 2 : _assets[asset].rewards[reward].usersData[user].accrued = difference.toUint128();
- 238 : 2 : break;
+ 235 : 1 : uint256 difference = totalRewards - amount;
+ 236 : 1 : totalRewards -= difference;
+ 237 : 1 : _assets[asset].rewards[reward].usersData[user].accrued = difference.toUint128();
+ 238 : 1 : break;
239 : : }
240 : : }
241 : :
- 242 : 10 : if (totalRewards == 0) {
- 243 : 2 : return 0;
+ 242 : 2522 : if (totalRewards == 0) {
+ 243 : 623 : return 0;
244 : : }
245 : :
- 246 : 8 : _transferRewards(to, reward, totalRewards);
- 247 : 8 : emit RewardsClaimed(user, reward, to, claimer, totalRewards);
+ 246 : 1899 : _transferRewards(to, reward, totalRewards);
+ 247 : 1899 : emit RewardsClaimed(user, reward, to, claimer, totalRewards);
248 : :
- 249 : 8 : return totalRewards;
+ 249 : 1899 : return totalRewards;
250 : : }
251 : :
252 : : /**
@@ -330,36 +330,36 @@
259 : : * rewardsList List of reward addresses
260 : : * claimedAmount List of claimed amounts, follows "rewardsList" items order
261 : : **/
- 262 : 3 : function _claimAllRewards(
+ 262 : : function _claimAllRewards(
263 : : address[] calldata assets,
264 : : address claimer,
265 : : address user,
266 : : address to
267 : : ) internal returns (address[] memory rewardsList, uint256[] memory claimedAmounts) {
- 268 : 6 : uint256 rewardsListLength = _rewardsList.length;
- 269 : 6 : rewardsList = new address[](rewardsListLength);
- 270 : 6 : claimedAmounts = new uint256[](rewardsListLength);
+ 268 : 3 : uint256 rewardsListLength = _rewardsList.length;
+ 269 : 3 : rewardsList = new address[](rewardsListLength);
+ 270 : 3 : claimedAmounts = new uint256[](rewardsListLength);
271 : :
- 272 : 6 : _updateDataMultiple(user, _getUserAssetBalances(assets, user));
+ 272 : 3 : _updateDataMultiple(user, _getUserAssetBalances(assets, user));
273 : :
- 274 : 15 : for (uint256 i = 0; i < assets.length; i++) {
- 275 : 6 : address asset = assets[i];
- 276 : 15 : for (uint256 j = 0; j < rewardsListLength; j++) {
- 277 : 9 : if (rewardsList[j] == address(0)) {
- 278 : 6 : rewardsList[j] = _rewardsList[j];
+ 274 : 3 : for (uint256 i = 0; i < assets.length; i++) {
+ 275 : 3 : address asset = assets[i];
+ 276 : 3 : for (uint256 j = 0; j < rewardsListLength; j++) {
+ 277 : 3 : if (rewardsList[j] == address(0)) {
+ 278 : 3 : rewardsList[j] = _rewardsList[j];
279 : : }
- 280 : 6 : uint256 rewardAmount = _assets[asset].rewards[rewardsList[j]].usersData[user].accrued;
- 281 : 6 : if (rewardAmount != 0) {
- 282 : 6 : claimedAmounts[j] += rewardAmount;
- 283 : 6 : _assets[asset].rewards[rewardsList[j]].usersData[user].accrued = 0;
+ 280 : 3 : uint256 rewardAmount = _assets[asset].rewards[rewardsList[j]].usersData[user].accrued;
+ 281 : 3 : if (rewardAmount != 0) {
+ 282 : 3 : claimedAmounts[j] += rewardAmount;
+ 283 : 3 : _assets[asset].rewards[rewardsList[j]].usersData[user].accrued = 0;
284 : : }
285 : : }
286 : : }
- 287 : 15 : for (uint256 i = 0; i < rewardsListLength; i++) {
- 288 : 6 : _transferRewards(to, rewardsList[i], claimedAmounts[i]);
- 289 : 6 : emit RewardsClaimed(user, rewardsList[i], to, claimer, claimedAmounts[i]);
+ 287 : 3 : for (uint256 i = 0; i < rewardsListLength; i++) {
+ 288 : 3 : _transferRewards(to, rewardsList[i], claimedAmounts[i]);
+ 289 : 3 : emit RewardsClaimed(user, rewardsList[i], to, claimer, claimedAmounts[i]);
290 : : }
- 291 : 6 : return (rewardsList, claimedAmounts);
+ 291 : 3 : return (rewardsList, claimedAmounts);
292 : : }
293 : :
294 : : /**
@@ -368,12 +368,12 @@
297 : : * @param reward Address of the reward token
298 : : * @param amount Amount of rewards to transfer
299 : : */
- 300 : 7 : function _transferRewards(address to, address reward, uint256 amount) internal {
- 301 : 14 : ITransferStrategyBase transferStrategy = _transferStrategy[reward];
+ 300 : : function _transferRewards(address to, address reward, uint256 amount) internal {
+ 301 : 1902 : ITransferStrategyBase transferStrategy = _transferStrategy[reward];
302 : :
- 303 : 21 : bool success = transferStrategy.performTransfer(to, reward, amount);
+ 303 : 1902 : bool success = transferStrategy.performTransfer(to, reward, amount);
304 : :
- 305 : 14 : require(success == true, 'TRANSFER_ERROR');
+ 305 : 1902 : require(success == true, 'TRANSFER_ERROR');
306 : : }
307 : :
308 : : /**
@@ -381,17 +381,17 @@
310 : : * @param account The address of the account
311 : : * @return bool, true if contract, false otherwise
312 : : */
- 313 : 22 : function _isContract(address account) internal view returns (bool) {
+ 313 : : function _isContract(address account) internal view returns (bool) {
314 : : // This method relies on extcodesize, which returns 0 for contracts in
315 : : // construction, since the code is only stored at the end of the
316 : : // constructor execution.
317 : :
- 318 : 44 : uint256 size;
+ 318 : 9025 : uint256 size;
319 : : // solhint-disable-next-line no-inline-assembly
320 : : assembly {
- 321 : 44 : size := extcodesize(account)
+ 321 : 9025 : size := extcodesize(account)
322 : : }
- 323 : 66 : return size > 0;
+ 323 : 9025 : return size > 0;
324 : : }
325 : :
326 : : /**
@@ -399,16 +399,16 @@
328 : : * @param reward The address of the reward token
329 : : * @param transferStrategy The address of the reward TransferStrategy
330 : : */
- 331 : 22 : function _installTransferStrategy(
+ 331 : : function _installTransferStrategy(
332 : : address reward,
333 : : ITransferStrategyBase transferStrategy
334 : : ) internal {
- 335 : 44 : require(address(transferStrategy) != address(0), 'STRATEGY_CAN_NOT_BE_ZERO');
- 336 : 44 : require(_isContract(address(transferStrategy)) == true, 'STRATEGY_MUST_BE_CONTRACT');
+ 335 : 9025 : require(address(transferStrategy) != address(0), 'STRATEGY_CAN_NOT_BE_ZERO');
+ 336 : 9025 : require(_isContract(address(transferStrategy)) == true, 'STRATEGY_MUST_BE_CONTRACT');
337 : :
- 338 : 44 : _transferStrategy[reward] = transferStrategy;
+ 338 : 9025 : _transferStrategy[reward] = transferStrategy;
339 : :
- 340 : 44 : emit TransferStrategyInstalled(reward, address(transferStrategy));
+ 340 : 9025 : emit TransferStrategyInstalled(reward, address(transferStrategy));
341 : : }
342 : :
343 : : /**
@@ -418,10 +418,10 @@
347 : : * @param rewardOracle The address of the price oracle
348 : : */
349 : :
- 350 : 22 : function _setRewardOracle(address reward, IEACAggregatorProxy rewardOracle) internal {
- 351 : 44 : require(rewardOracle.latestAnswer() > 0, 'ORACLE_MUST_RETURN_PRICE');
- 352 : 44 : _rewardOracle[reward] = rewardOracle;
- 353 : 44 : emit RewardOracleUpdated(reward, address(rewardOracle));
+ 350 : : function _setRewardOracle(address reward, IEACAggregatorProxy rewardOracle) internal {
+ 351 : 9025 : require(rewardOracle.latestAnswer() > 0, 'ORACLE_MUST_RETURN_PRICE');
+ 352 : 9025 : _rewardOracle[reward] = rewardOracle;
+ 353 : 9025 : emit RewardOracleUpdated(reward, address(rewardOracle));
354 : : }
355 : : }
@@ -431,8 +431,8 @@
diff --git a/report/periphery/contracts/rewards/src/periphery/contracts/rewards/RewardsDistributor.sol.func-c.html b/report/rewards/RewardsDistributor.sol.func-c.html
similarity index 73%
rename from report/periphery/contracts/rewards/src/periphery/contracts/rewards/RewardsDistributor.sol.func-c.html
rename to report/rewards/RewardsDistributor.sol.func-c.html
index db9103f1..fb18b19d 100644
--- a/report/periphery/contracts/rewards/src/periphery/contracts/rewards/RewardsDistributor.sol.func-c.html
+++ b/report/rewards/RewardsDistributor.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/rewards/src/periphery/contracts/rewards/RewardsDistributor.sol - functions
-
+ LCOV - lcov.info.p - rewards/RewardsDistributor.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
+
+
-
-
+
|
-
-
-
+
+
+
|
@@ -53,33 +53,33 @@
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../glass.png) |
- RewardsDistributor.getAllUserRewards |
+ RewardsDistributor. |
- 1 |
+ 0 |
- RewardsDistributor.getAssetIndex |
+ RewardsDistributor.getAllUserRewards |
1 |
@@ -112,6 +112,13 @@
2 |
+
+
+ RewardsDistributor.onlyEmissionManager |
+
+ 2 |
+
+
RewardsDistributor.setDistributionEnd |
@@ -128,100 +135,107 @@
- RewardsDistributor.getEmissionManager |
+ RewardsDistributor.getRewardsData |
3 |
- RewardsDistributor.getRewardsData |
+ RewardsDistributor.getEmissionManager |
- 3 |
+ 5 |
- RewardsDistributor._updateDataMultiple |
+ RewardsDistributor.getRewardsList |
- 8 |
+ 30 |
RewardsDistributor._getPendingRewards |
- 9 |
+ 1009 |
RewardsDistributor._getUserReward |
- 10 |
+ 1011 |
RewardsDistributor.getUserRewards |
- 10 |
+ 1011 |
- RewardsDistributor._getRewards |
+ RewardsDistributor._updateDataMultiple |
- 17 |
+ 2525 |
RewardsDistributor._updateUserData |
- 17 |
+ 2533 |
+
+
+
+
+ RewardsDistributor._getRewards |
+
+ 2912 |
RewardsDistributor._configureAssets |
- 20 |
+ 9023 |
RewardsDistributor.getRewardsByAsset |
- 30 |
+ 9118 |
- RewardsDistributor.getRewardsList |
+ RewardsDistributor._updateRewardData |
- 30 |
+ 11558 |
- RewardsDistributor._updateRewardData |
+ RewardsDistributor.getAssetIndex |
- 39 |
+ 37954 |
RewardsDistributor._getAssetIndex |
- 49 |
+ 50521 |
RewardsDistributor._updateData |
- 53895 |
+ 141340 |
@@ -229,8 +243,8 @@
diff --git a/report/periphery/contracts/rewards/src/periphery/contracts/rewards/RewardsDistributor.sol.func.html b/report/rewards/RewardsDistributor.sol.func.html
similarity index 73%
rename from report/periphery/contracts/rewards/src/periphery/contracts/rewards/RewardsDistributor.sol.func.html
rename to report/rewards/RewardsDistributor.sol.func.html
index cf5b1b7f..0cafab95 100644
--- a/report/periphery/contracts/rewards/src/periphery/contracts/rewards/RewardsDistributor.sol.func.html
+++ b/report/rewards/RewardsDistributor.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/rewards/src/periphery/contracts/rewards/RewardsDistributor.sol - functions
-
+ LCOV - lcov.info.p - rewards/RewardsDistributor.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
+
+
-
-
+
|
-
-
-
+
+
+
|
@@ -53,84 +53,91 @@
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../glass.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../updown.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../updown.png) |
+
+
+
+
+ RewardsDistributor. |
+
+ 0 |
RewardsDistributor._configureAssets |
- 20 |
+ 9023 |
RewardsDistributor._getAssetIndex |
- 49 |
+ 50521 |
RewardsDistributor._getPendingRewards |
- 9 |
+ 1009 |
RewardsDistributor._getRewards |
- 17 |
+ 2912 |
RewardsDistributor._getUserReward |
- 10 |
+ 1011 |
RewardsDistributor._updateData |
- 53895 |
+ 141340 |
RewardsDistributor._updateDataMultiple |
- 8 |
+ 2525 |
RewardsDistributor._updateRewardData |
- 39 |
+ 11558 |
RewardsDistributor._updateUserData |
- 17 |
+ 2533 |
@@ -151,7 +158,7 @@
RewardsDistributor.getAssetIndex |
- 1 |
+ 37954 |
@@ -165,14 +172,14 @@
RewardsDistributor.getEmissionManager |
- 3 |
+ 5 |
RewardsDistributor.getRewardsByAsset |
- 30 |
+ 9118 |
@@ -207,7 +214,14 @@
RewardsDistributor.getUserRewards |
- 10 |
+ 1011 |
+
+
+
+
+ RewardsDistributor.onlyEmissionManager |
+
+ 2 |
@@ -229,8 +243,8 @@
diff --git a/report/periphery/contracts/rewards/src/periphery/contracts/rewards/RewardsDistributor.sol.gcov.html b/report/rewards/RewardsDistributor.sol.gcov.html
similarity index 84%
rename from report/periphery/contracts/rewards/src/periphery/contracts/rewards/RewardsDistributor.sol.gcov.html
rename to report/rewards/RewardsDistributor.sol.gcov.html
index dcb78dba..af1d21c0 100644
--- a/report/periphery/contracts/rewards/src/periphery/contracts/rewards/RewardsDistributor.sol.gcov.html
+++ b/report/rewards/RewardsDistributor.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/rewards/src/periphery/contracts/rewards/RewardsDistributor.sol
-
+ LCOV - lcov.info.p - rewards/RewardsDistributor.sol
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
+
+
-
-
+
|
-
-
-
+
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
@@ -72,9 +72,9 @@
1 : : // SPDX-License-Identifier: BUSL-1.1
2 : : pragma solidity ^0.8.10;
3 : :
- 4 : : import {IScaledBalanceToken} from 'aave-v3-core/contracts/interfaces/IScaledBalanceToken.sol';
- 5 : : import {IERC20Detailed} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol';
- 6 : : import {SafeCast} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol';
+ 4 : : import {IScaledBalanceToken} from '../interfaces/IScaledBalanceToken.sol';
+ 5 : : import {IERC20Detailed} from '../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
+ 6 : : import {SafeCast} from '../dependencies/openzeppelin/contracts/SafeCast.sol';
7 : : import {IRewardsDistributor} from './interfaces/IRewardsDistributor.sol';
8 : : import {RewardsDataTypes} from './libraries/RewardsDataTypes.sol';
9 : :
@@ -104,20 +104,20 @@
33 : : address[] internal _assetsList;
34 : :
35 : : modifier onlyEmissionManager() {
- 36 : : require(msg.sender == EMISSION_MANAGER, 'ONLY_EMISSION_MANAGER');
+ 36 : 2 : require(msg.sender == EMISSION_MANAGER, 'ONLY_EMISSION_MANAGER');
37 : : _;
38 : : }
39 : :
40 : : constructor(address emissionManager) {
- 41 : : EMISSION_MANAGER = emissionManager;
+ 41 : 0 : EMISSION_MANAGER = emissionManager;
42 : : }
43 : :
44 : : /// @inheritdoc IRewardsDistributor
- 45 : 3 : function getRewardsData(
+ 45 : : function getRewardsData(
46 : : address asset,
47 : : address reward
- 48 : : ) public view override returns (uint256, uint256, uint256, uint256) {
- 49 : 6 : return (
+ 48 : : ) external view override returns (uint256, uint256, uint256, uint256) {
+ 49 : 3 : return (
50 : : _assets[asset].rewards[reward].index,
51 : : _assets[asset].rewards[reward].emissionPerSecond,
52 : : _assets[asset].rewards[reward].lastUpdateTimestamp,
@@ -126,13 +126,13 @@
55 : : }
56 : :
57 : : /// @inheritdoc IRewardsDistributor
- 58 : 1 : function getAssetIndex(
+ 58 : : function getAssetIndex(
59 : : address asset,
60 : : address reward
61 : : ) external view override returns (uint256, uint256) {
- 62 : 2 : RewardsDataTypes.RewardData storage rewardData = _assets[asset].rewards[reward];
- 63 : 2 : return
- 64 : 2 : _getAssetIndex(
+ 62 : 37954 : RewardsDataTypes.RewardData storage rewardData = _assets[asset].rewards[reward];
+ 63 : 37954 : return
+ 64 : 37954 : _getAssetIndex(
65 : : rewardData,
66 : : IScaledBalanceToken(asset).scaledTotalSupply(),
67 : : 10 ** _assets[asset].decimals
@@ -140,62 +140,62 @@
69 : : }
70 : :
71 : : /// @inheritdoc IRewardsDistributor
- 72 : 1 : function getDistributionEnd(
+ 72 : : function getDistributionEnd(
73 : : address asset,
74 : : address reward
75 : : ) external view override returns (uint256) {
- 76 : 2 : return _assets[asset].rewards[reward].distributionEnd;
+ 76 : 1 : return _assets[asset].rewards[reward].distributionEnd;
77 : : }
78 : :
79 : : /// @inheritdoc IRewardsDistributor
- 80 : 30 : function getRewardsByAsset(address asset) external view override returns (address[] memory) {
- 81 : 60 : uint128 rewardsCount = _assets[asset].availableRewardsCount;
- 82 : 90 : address[] memory availableRewards = new address[](rewardsCount);
+ 80 : : function getRewardsByAsset(address asset) external view override returns (address[] memory) {
+ 81 : 9118 : uint128 rewardsCount = _assets[asset].availableRewardsCount;
+ 82 : 9118 : address[] memory availableRewards = new address[](rewardsCount);
83 : :
- 84 : 150 : for (uint128 i = 0; i < rewardsCount; i++) {
- 85 : 60 : availableRewards[i] = _assets[asset].availableRewards[i];
+ 84 : 9118 : for (uint128 i = 0; i < rewardsCount; i++) {
+ 85 : 9033 : availableRewards[i] = _assets[asset].availableRewards[i];
86 : : }
- 87 : 60 : return availableRewards;
+ 87 : 9118 : return availableRewards;
88 : : }
89 : :
90 : : /// @inheritdoc IRewardsDistributor
- 91 : 30 : function getRewardsList() external view override returns (address[] memory) {
- 92 : 60 : return _rewardsList;
+ 91 : : function getRewardsList() external view override returns (address[] memory) {
+ 92 : 30 : return _rewardsList;
93 : : }
94 : :
95 : : /// @inheritdoc IRewardsDistributor
- 96 : 1 : function getUserAssetIndex(
+ 96 : : function getUserAssetIndex(
97 : : address user,
98 : : address asset,
99 : : address reward
- 100 : : ) public view override returns (uint256) {
- 101 : 2 : return _assets[asset].rewards[reward].usersData[user].index;
+ 100 : : ) external view override returns (uint256) {
+ 101 : 1 : return _assets[asset].rewards[reward].usersData[user].index;
102 : : }
103 : :
104 : : /// @inheritdoc IRewardsDistributor
- 105 : 1 : function getUserAccruedRewards(
+ 105 : : function getUserAccruedRewards(
106 : : address user,
107 : : address reward
108 : : ) external view override returns (uint256) {
- 109 : 2 : uint256 totalAccrued;
- 110 : 5 : for (uint256 i = 0; i < _assetsList.length; i++) {
- 111 : 2 : totalAccrued += _assets[_assetsList[i]].rewards[reward].usersData[user].accrued;
+ 109 : 1 : uint256 totalAccrued;
+ 110 : 1 : for (uint256 i = 0; i < _assetsList.length; i++) {
+ 111 : 1 : totalAccrued += _assets[_assetsList[i]].rewards[reward].usersData[user].accrued;
112 : : }
113 : :
- 114 : 2 : return totalAccrued;
+ 114 : 1 : return totalAccrued;
115 : : }
116 : :
117 : : /// @inheritdoc IRewardsDistributor
- 118 : 10 : function getUserRewards(
+ 118 : : function getUserRewards(
119 : : address[] calldata assets,
120 : : address user,
121 : : address reward
122 : : ) external view override returns (uint256) {
- 123 : 30 : return _getUserReward(user, reward, _getUserAssetBalances(assets, user));
+ 123 : 1011 : return _getUserReward(user, reward, _getUserAssetBalances(assets, user));
124 : : }
125 : :
126 : : /// @inheritdoc IRewardsDistributor
- 127 : 1 : function getAllUserRewards(
+ 127 : : function getAllUserRewards(
128 : : address[] calldata assets,
129 : : address user
130 : : )
@@ -204,41 +204,41 @@
133 : : override
134 : : returns (address[] memory rewardsList, uint256[] memory unclaimedAmounts)
135 : : {
- 136 : 3 : RewardsDataTypes.UserAssetBalance[] memory userAssetBalances = _getUserAssetBalances(
+ 136 : 1 : RewardsDataTypes.UserAssetBalance[] memory userAssetBalances = _getUserAssetBalances(
137 : : assets,
138 : : user
139 : : );
- 140 : 2 : rewardsList = new address[](_rewardsList.length);
- 141 : 2 : unclaimedAmounts = new uint256[](rewardsList.length);
+ 140 : 1 : rewardsList = new address[](_rewardsList.length);
+ 141 : 1 : unclaimedAmounts = new uint256[](rewardsList.length);
142 : :
143 : : // Add unrealized rewards from user to unclaimedRewards
- 144 : 5 : for (uint256 i = 0; i < userAssetBalances.length; i++) {
- 145 : 5 : for (uint256 r = 0; r < rewardsList.length; r++) {
- 146 : 2 : rewardsList[r] = _rewardsList[r];
- 147 : 2 : unclaimedAmounts[r] += _assets[userAssetBalances[i].asset]
+ 144 : 1 : for (uint256 i = 0; i < userAssetBalances.length; i++) {
+ 145 : 1 : for (uint256 r = 0; r < rewardsList.length; r++) {
+ 146 : 1 : rewardsList[r] = _rewardsList[r];
+ 147 : 1 : unclaimedAmounts[r] += _assets[userAssetBalances[i].asset]
148 : : .rewards[rewardsList[r]]
149 : : .usersData[user]
150 : : .accrued;
151 : :
- 152 : 2 : if (userAssetBalances[i].userBalance == 0) {
- 153 : 2 : continue;
+ 152 : 1 : if (userAssetBalances[i].userBalance == 0) {
+ 153 : 1 : continue;
154 : : }
- 155 : 2 : unclaimedAmounts[r] += _getPendingRewards(user, rewardsList[r], userAssetBalances[i]);
+ 155 : 1 : unclaimedAmounts[r] += _getPendingRewards(user, rewardsList[r], userAssetBalances[i]);
156 : : }
157 : : }
- 158 : 2 : return (rewardsList, unclaimedAmounts);
+ 158 : 1 : return (rewardsList, unclaimedAmounts);
159 : : }
160 : :
161 : : /// @inheritdoc IRewardsDistributor
- 162 : 2 : function setDistributionEnd(
+ 162 : : function setDistributionEnd(
163 : : address asset,
164 : : address reward,
165 : : uint32 newDistributionEnd
166 : : ) external override onlyEmissionManager {
- 167 : 4 : uint256 oldDistributionEnd = _assets[asset].rewards[reward].distributionEnd;
- 168 : 4 : _assets[asset].rewards[reward].distributionEnd = newDistributionEnd;
+ 167 : 2 : uint256 oldDistributionEnd = _assets[asset].rewards[reward].distributionEnd;
+ 168 : 2 : _assets[asset].rewards[reward].distributionEnd = newDistributionEnd;
169 : :
- 170 : 4 : emit AssetConfigUpdated(
+ 170 : 2 : emit AssetConfigUpdated(
171 : : asset,
172 : : reward,
173 : : _assets[asset].rewards[reward].emissionPerSecond,
@@ -250,31 +250,31 @@
179 : : }
180 : :
181 : : /// @inheritdoc IRewardsDistributor
- 182 : 2 : function setEmissionPerSecond(
+ 182 : : function setEmissionPerSecond(
183 : : address asset,
184 : : address[] calldata rewards,
185 : : uint88[] calldata newEmissionsPerSecond
186 : : ) external override onlyEmissionManager {
- 187 : 4 : require(rewards.length == newEmissionsPerSecond.length, 'INVALID_INPUT');
- 188 : 10 : for (uint256 i = 0; i < rewards.length; i++) {
- 189 : 4 : RewardsDataTypes.AssetData storage assetConfig = _assets[asset];
- 190 : 4 : RewardsDataTypes.RewardData storage rewardConfig = _assets[asset].rewards[rewards[i]];
- 191 : 4 : uint256 decimals = assetConfig.decimals;
- 192 : 4 : require(
+ 187 : 2 : require(rewards.length == newEmissionsPerSecond.length, 'INVALID_INPUT');
+ 188 : 2 : for (uint256 i = 0; i < rewards.length; i++) {
+ 189 : 2 : RewardsDataTypes.AssetData storage assetConfig = _assets[asset];
+ 190 : 2 : RewardsDataTypes.RewardData storage rewardConfig = _assets[asset].rewards[rewards[i]];
+ 191 : 2 : uint256 decimals = assetConfig.decimals;
+ 192 : 2 : require(
193 : : decimals != 0 && rewardConfig.lastUpdateTimestamp != 0,
194 : : 'DISTRIBUTION_DOES_NOT_EXIST'
195 : : );
196 : :
- 197 : 6 : (uint256 newIndex, ) = _updateRewardData(
+ 197 : 2 : (uint256 newIndex, ) = _updateRewardData(
198 : : rewardConfig,
199 : : IScaledBalanceToken(asset).scaledTotalSupply(),
200 : : 10 ** decimals
201 : : );
202 : :
- 203 : 4 : uint256 oldEmissionPerSecond = rewardConfig.emissionPerSecond;
- 204 : 4 : rewardConfig.emissionPerSecond = newEmissionsPerSecond[i];
+ 203 : 2 : uint256 oldEmissionPerSecond = rewardConfig.emissionPerSecond;
+ 204 : 2 : rewardConfig.emissionPerSecond = newEmissionsPerSecond[i];
205 : :
- 206 : 4 : emit AssetConfigUpdated(
+ 206 : 2 : emit AssetConfigUpdated(
207 : : asset,
208 : : rewards[i],
209 : : oldEmissionPerSecond,
@@ -290,49 +290,49 @@
219 : : * @dev Configure the _assets for a specific emission
220 : : * @param rewardsInput The array of each asset configuration
221 : : **/
- 222 : 20 : function _configureAssets(RewardsDataTypes.RewardsConfigInput[] memory rewardsInput) internal {
- 223 : 100 : for (uint256 i = 0; i < rewardsInput.length; i++) {
- 224 : 40 : if (_assets[rewardsInput[i].asset].decimals == 0) {
+ 222 : : function _configureAssets(RewardsDataTypes.RewardsConfigInput[] memory rewardsInput) internal {
+ 223 : 9023 : for (uint256 i = 0; i < rewardsInput.length; i++) {
+ 224 : 9023 : if (_assets[rewardsInput[i].asset].decimals == 0) {
225 : : //never initialized before, adding to the list of assets
- 226 : 40 : _assetsList.push(rewardsInput[i].asset);
+ 226 : 9023 : _assetsList.push(rewardsInput[i].asset);
227 : : }
228 : :
- 229 : 60 : uint256 decimals = _assets[rewardsInput[i].asset].decimals = IERC20Detailed(
+ 229 : 9023 : uint256 decimals = _assets[rewardsInput[i].asset].decimals = IERC20Detailed(
230 : : rewardsInput[i].asset
231 : : ).decimals();
232 : :
- 233 : 40 : RewardsDataTypes.RewardData storage rewardConfig = _assets[rewardsInput[i].asset].rewards[
+ 233 : 9023 : RewardsDataTypes.RewardData storage rewardConfig = _assets[rewardsInput[i].asset].rewards[
234 : : rewardsInput[i].reward
235 : : ];
236 : :
237 : : // Add reward address to asset available rewards if latestUpdateTimestamp is zero
- 238 : 40 : if (rewardConfig.lastUpdateTimestamp == 0) {
- 239 : 40 : _assets[rewardsInput[i].asset].availableRewards[
+ 238 : 9023 : if (rewardConfig.lastUpdateTimestamp == 0) {
+ 239 : 9023 : _assets[rewardsInput[i].asset].availableRewards[
240 : : _assets[rewardsInput[i].asset].availableRewardsCount
241 : : ] = rewardsInput[i].reward;
- 242 : 40 : _assets[rewardsInput[i].asset].availableRewardsCount++;
+ 242 : 9023 : _assets[rewardsInput[i].asset].availableRewardsCount++;
243 : : }
244 : :
245 : : // Add reward address to global rewards list if still not enabled
- 246 : 40 : if (_isRewardEnabled[rewardsInput[i].reward] == false) {
- 247 : 40 : _isRewardEnabled[rewardsInput[i].reward] = true;
- 248 : 40 : _rewardsList.push(rewardsInput[i].reward);
+ 246 : 9023 : if (_isRewardEnabled[rewardsInput[i].reward] == false) {
+ 247 : 9023 : _isRewardEnabled[rewardsInput[i].reward] = true;
+ 248 : 9023 : _rewardsList.push(rewardsInput[i].reward);
249 : : }
250 : :
251 : : // Due emissions is still zero, updates only latestUpdateTimestamp
- 252 : 60 : (uint256 newIndex, ) = _updateRewardData(
+ 252 : 9023 : (uint256 newIndex, ) = _updateRewardData(
253 : : rewardConfig,
254 : : rewardsInput[i].totalSupply,
255 : : 10 ** decimals
256 : : );
257 : :
258 : : // Configure emission and distribution end of the reward per asset
- 259 : 40 : uint88 oldEmissionsPerSecond = rewardConfig.emissionPerSecond;
- 260 : 40 : uint32 oldDistributionEnd = rewardConfig.distributionEnd;
- 261 : 40 : rewardConfig.emissionPerSecond = rewardsInput[i].emissionPerSecond;
- 262 : 40 : rewardConfig.distributionEnd = rewardsInput[i].distributionEnd;
+ 259 : 9023 : uint88 oldEmissionsPerSecond = rewardConfig.emissionPerSecond;
+ 260 : 9023 : uint32 oldDistributionEnd = rewardConfig.distributionEnd;
+ 261 : 9023 : rewardConfig.emissionPerSecond = rewardsInput[i].emissionPerSecond;
+ 262 : 9023 : rewardConfig.distributionEnd = rewardsInput[i].distributionEnd;
263 : :
- 264 : 40 : emit AssetConfigUpdated(
+ 264 : 9023 : emit AssetConfigUpdated(
265 : : rewardsInput[i].asset,
266 : : rewardsInput[i].reward,
267 : : oldEmissionsPerSecond,
@@ -352,25 +352,25 @@
281 : : * @return The new distribution index
282 : : * @return True if the index was updated, false otherwise
283 : : **/
- 284 : 39 : function _updateRewardData(
+ 284 : : function _updateRewardData(
285 : : RewardsDataTypes.RewardData storage rewardData,
286 : : uint256 totalSupply,
287 : : uint256 assetUnit
288 : : ) internal returns (uint256, bool) {
- 289 : 117 : (uint256 oldIndex, uint256 newIndex) = _getAssetIndex(rewardData, totalSupply, assetUnit);
- 290 : 78 : bool indexUpdated;
- 291 : 78 : if (newIndex != oldIndex) {
- 292 : 16 : require(newIndex <= type(uint104).max, 'INDEX_OVERFLOW');
- 293 : 16 : indexUpdated = true;
+ 289 : 11558 : (uint256 oldIndex, uint256 newIndex) = _getAssetIndex(rewardData, totalSupply, assetUnit);
+ 290 : 11558 : bool indexUpdated;
+ 291 : 11558 : if (newIndex != oldIndex) {
+ 292 : 1903 : require(newIndex <= type(uint104).max, 'INDEX_OVERFLOW');
+ 293 : 1903 : indexUpdated = true;
294 : :
295 : : //optimization: storing one after another saves one SSTORE
- 296 : 16 : rewardData.index = uint104(newIndex);
- 297 : 16 : rewardData.lastUpdateTimestamp = block.timestamp.toUint32();
+ 296 : 1903 : rewardData.index = uint104(newIndex);
+ 297 : 1903 : rewardData.lastUpdateTimestamp = block.timestamp.toUint32();
298 : : } else {
- 299 : 62 : rewardData.lastUpdateTimestamp = block.timestamp.toUint32();
+ 299 : 9655 : rewardData.lastUpdateTimestamp = block.timestamp.toUint32();
300 : : }
301 : :
- 302 : 78 : return (newIndex, indexUpdated);
+ 302 : 11558 : return (newIndex, indexUpdated);
303 : : }
304 : :
305 : : /**
@@ -382,26 +382,26 @@
311 : : * @param assetUnit One unit of asset (10**decimals)
312 : : * @return The rewards accrued since the last update
313 : : **/
- 314 : 17 : function _updateUserData(
+ 314 : : function _updateUserData(
315 : : RewardsDataTypes.RewardData storage rewardData,
316 : : address user,
317 : : uint256 userBalance,
318 : : uint256 newAssetIndex,
319 : : uint256 assetUnit
320 : : ) internal returns (uint256, bool) {
- 321 : 34 : uint256 userIndex = rewardData.usersData[user].index;
- 322 : 34 : uint256 rewardsAccrued;
- 323 : 34 : bool dataUpdated;
- 324 : 17 : if ((dataUpdated = userIndex != newAssetIndex)) {
+ 321 : 2533 : uint256 userIndex = rewardData.usersData[user].index;
+ 322 : 2533 : uint256 rewardsAccrued;
+ 323 : 2533 : bool dataUpdated;
+ 324 : 2533 : if ((dataUpdated = userIndex != newAssetIndex)) {
325 : : // already checked for overflow in _updateRewardData
- 326 : 16 : rewardData.usersData[user].index = uint104(newAssetIndex);
- 327 : 16 : if (userBalance != 0) {
- 328 : 16 : rewardsAccrued = _getRewards(userBalance, newAssetIndex, userIndex, assetUnit);
+ 326 : 1903 : rewardData.usersData[user].index = uint104(newAssetIndex);
+ 327 : 1903 : if (userBalance != 0) {
+ 328 : 1903 : rewardsAccrued = _getRewards(userBalance, newAssetIndex, userIndex, assetUnit);
329 : :
- 330 : 16 : rewardData.usersData[user].accrued += rewardsAccrued.toUint128();
+ 330 : 1903 : rewardData.usersData[user].accrued += rewardsAccrued.toUint128();
331 : : }
332 : : }
- 333 : 34 : return (rewardsAccrued, dataUpdated);
+ 333 : 2533 : return (rewardsAccrued, dataUpdated);
334 : : }
335 : :
336 : : /**
@@ -411,33 +411,33 @@
340 : : * @param userBalance The current user asset balance
341 : : * @param totalSupply Total supply of the asset
342 : : **/
- 343 : 53895 : function _updateData(
+ 343 : : function _updateData(
344 : : address asset,
345 : : address user,
346 : : uint256 userBalance,
347 : : uint256 totalSupply
348 : : ) internal {
- 349 : 107790 : uint256 assetUnit;
- 350 : 107790 : uint256 numAvailableRewards = _assets[asset].availableRewardsCount;
+ 349 : 141340 : uint256 assetUnit;
+ 350 : 141340 : uint256 numAvailableRewards = _assets[asset].availableRewardsCount;
351 : : unchecked {
- 352 : 107790 : assetUnit = 10 ** _assets[asset].decimals;
+ 352 : 141340 : assetUnit = 10 ** _assets[asset].decimals;
353 : : }
354 : :
- 355 : 107790 : if (numAvailableRewards == 0) {
- 356 : 107756 : return;
+ 355 : 141340 : if (numAvailableRewards == 0) {
+ 356 : 138807 : return;
357 : : }
358 : : unchecked {
- 359 : 85 : for (uint128 r = 0; r < numAvailableRewards; r++) {
- 360 : 34 : address reward = _assets[asset].availableRewards[r];
- 361 : 34 : RewardsDataTypes.RewardData storage rewardData = _assets[asset].rewards[reward];
+ 359 : 2533 : for (uint128 r = 0; r < numAvailableRewards; r++) {
+ 360 : 2533 : address reward = _assets[asset].availableRewards[r];
+ 361 : 2533 : RewardsDataTypes.RewardData storage rewardData = _assets[asset].rewards[reward];
362 : :
- 363 : 51 : (uint256 newAssetIndex, bool rewardDataUpdated) = _updateRewardData(
+ 363 : 2533 : (uint256 newAssetIndex, bool rewardDataUpdated) = _updateRewardData(
364 : : rewardData,
365 : : totalSupply,
366 : : assetUnit
367 : : );
368 : :
- 369 : 51 : (uint256 rewardsAccrued, bool userDataUpdated) = _updateUserData(
+ 369 : 2533 : (uint256 rewardsAccrued, bool userDataUpdated) = _updateUserData(
370 : : rewardData,
371 : : user,
372 : : userBalance,
@@ -445,8 +445,8 @@
374 : : assetUnit
375 : : );
376 : :
- 377 : 34 : if (rewardDataUpdated || userDataUpdated) {
- 378 : 16 : emit Accrued(asset, reward, user, newAssetIndex, newAssetIndex, rewardsAccrued);
+ 377 : 2533 : if (rewardDataUpdated || userDataUpdated) {
+ 378 : 1903 : emit Accrued(asset, reward, user, newAssetIndex, newAssetIndex, rewardsAccrued);
379 : : }
380 : : }
381 : : }
@@ -457,12 +457,12 @@
386 : : * @param user The address of the user
387 : : * @param userAssetBalances List of structs with the user balance and total supply of a set of assets
388 : : **/
- 389 : 8 : function _updateDataMultiple(
+ 389 : : function _updateDataMultiple(
390 : : address user,
391 : : RewardsDataTypes.UserAssetBalance[] memory userAssetBalances
392 : : ) internal {
- 393 : 40 : for (uint256 i = 0; i < userAssetBalances.length; i++) {
- 394 : 16 : _updateData(
+ 393 : 2525 : for (uint256 i = 0; i < userAssetBalances.length; i++) {
+ 394 : 2525 : _updateData(
395 : : userAssetBalances[i].asset,
396 : : user,
397 : : userAssetBalances[i].userBalance,
@@ -478,20 +478,20 @@
407 : : * @param userAssetBalances List of structs with the user balance and total supply of a set of assets
408 : : * @return unclaimedRewards The accrued rewards for the user until the moment
409 : : **/
- 410 : 10 : function _getUserReward(
+ 410 : : function _getUserReward(
411 : : address user,
412 : : address reward,
413 : : RewardsDataTypes.UserAssetBalance[] memory userAssetBalances
414 : : ) internal view returns (uint256 unclaimedRewards) {
415 : : // Add unrealized rewards
- 416 : 50 : for (uint256 i = 0; i < userAssetBalances.length; i++) {
- 417 : 20 : if (userAssetBalances[i].userBalance == 0) {
- 418 : 4 : unclaimedRewards += _assets[userAssetBalances[i].asset]
+ 416 : 1011 : for (uint256 i = 0; i < userAssetBalances.length; i++) {
+ 417 : 1011 : if (userAssetBalances[i].userBalance == 0) {
+ 418 : 3 : unclaimedRewards += _assets[userAssetBalances[i].asset]
419 : : .rewards[reward]
420 : : .usersData[user]
421 : : .accrued;
422 : : } else {
- 423 : 16 : unclaimedRewards +=
+ 423 : 1008 : unclaimedRewards +=
424 : : _getPendingRewards(user, reward, userAssetBalances[i]) +
425 : : _assets[userAssetBalances[i].asset].rewards[reward].usersData[user].accrued;
426 : : }
@@ -507,19 +507,19 @@
436 : : * @param userAssetBalance struct with the user balance and total supply of the incentivized asset
437 : : * @return The pending rewards for the user since the last user action
438 : : **/
- 439 : 9 : function _getPendingRewards(
+ 439 : : function _getPendingRewards(
440 : : address user,
441 : : address reward,
442 : : RewardsDataTypes.UserAssetBalance memory userAssetBalance
443 : : ) internal view returns (uint256) {
- 444 : 18 : RewardsDataTypes.RewardData storage rewardData = _assets[userAssetBalance.asset].rewards[
+ 444 : 1009 : RewardsDataTypes.RewardData storage rewardData = _assets[userAssetBalance.asset].rewards[
445 : : reward
446 : : ];
- 447 : 27 : uint256 assetUnit = 10 ** _assets[userAssetBalance.asset].decimals;
- 448 : 27 : (, uint256 nextIndex) = _getAssetIndex(rewardData, userAssetBalance.totalSupply, assetUnit);
+ 447 : 1009 : uint256 assetUnit = 10 ** _assets[userAssetBalance.asset].decimals;
+ 448 : 1009 : (, uint256 nextIndex) = _getAssetIndex(rewardData, userAssetBalance.totalSupply, assetUnit);
449 : :
- 450 : 18 : return
- 451 : 18 : _getRewards(
+ 450 : 1009 : return
+ 451 : 1009 : _getRewards(
452 : : userAssetBalance.userBalance,
453 : : nextIndex,
454 : : rewardData.usersData[user].index,
@@ -535,17 +535,17 @@
464 : : * @param assetUnit One unit of asset (10**decimals)
465 : : * @return The rewards
466 : : **/
- 467 : 17 : function _getRewards(
+ 467 : : function _getRewards(
468 : : uint256 userBalance,
469 : : uint256 reserveIndex,
470 : : uint256 userIndex,
471 : : uint256 assetUnit
472 : : ) internal pure returns (uint256) {
- 473 : 51 : uint256 result = userBalance * (reserveIndex - userIndex);
+ 473 : 2912 : uint256 result = userBalance * (reserveIndex - userIndex);
474 : : assembly {
- 475 : 34 : result := div(result, assetUnit)
+ 475 : 2912 : result := div(result, assetUnit)
476 : : }
- 477 : 34 : return result;
+ 477 : 2912 : return result;
478 : : }
479 : :
480 : : /**
@@ -555,34 +555,34 @@
484 : : * @param assetUnit One unit of asset (10**decimals)
485 : : * @return The new index.
486 : : **/
- 487 : 49 : function _getAssetIndex(
+ 487 : : function _getAssetIndex(
488 : : RewardsDataTypes.RewardData storage rewardData,
489 : : uint256 totalSupply,
490 : : uint256 assetUnit
491 : : ) internal view returns (uint256, uint256) {
- 492 : 98 : uint256 oldIndex = rewardData.index;
- 493 : 98 : uint256 distributionEnd = rewardData.distributionEnd;
- 494 : 98 : uint256 emissionPerSecond = rewardData.emissionPerSecond;
- 495 : 98 : uint256 lastUpdateTimestamp = rewardData.lastUpdateTimestamp;
+ 492 : 50521 : uint256 oldIndex = rewardData.index;
+ 493 : 50521 : uint256 distributionEnd = rewardData.distributionEnd;
+ 494 : 50521 : uint256 emissionPerSecond = rewardData.emissionPerSecond;
+ 495 : 50521 : uint256 lastUpdateTimestamp = rewardData.lastUpdateTimestamp;
496 : :
497 : : if (
- 498 : 245 : emissionPerSecond == 0 ||
- 499 : 58 : totalSupply == 0 ||
- 500 : 36 : lastUpdateTimestamp == block.timestamp ||
- 501 : 36 : lastUpdateTimestamp >= distributionEnd
+ 498 : 50521 : emissionPerSecond == 0 ||
+ 499 : 40167 : totalSupply == 0 ||
+ 500 : 31462 : lastUpdateTimestamp == block.timestamp ||
+ 501 : 20033 : lastUpdateTimestamp >= distributionEnd
502 : : ) {
- 503 : 62 : return (oldIndex, oldIndex);
+ 503 : 31961 : return (oldIndex, oldIndex);
504 : : }
505 : :
- 506 : 54 : uint256 currentTimestamp = block.timestamp > distributionEnd
+ 506 : 18560 : uint256 currentTimestamp = block.timestamp > distributionEnd
507 : : ? distributionEnd
508 : : : block.timestamp;
- 509 : 54 : uint256 timeDelta = currentTimestamp - lastUpdateTimestamp;
- 510 : 72 : uint256 firstTerm = emissionPerSecond * timeDelta * assetUnit;
+ 509 : 18560 : uint256 timeDelta = currentTimestamp - lastUpdateTimestamp;
+ 510 : 18560 : uint256 firstTerm = emissionPerSecond * timeDelta * assetUnit;
511 : : assembly {
- 512 : 36 : firstTerm := div(firstTerm, totalSupply)
+ 512 : 18560 : firstTerm := div(firstTerm, totalSupply)
513 : : }
- 514 : 36 : return (oldIndex, (firstTerm + oldIndex));
+ 514 : 18560 : return (oldIndex, (firstTerm + oldIndex));
515 : : }
516 : :
517 : : /**
@@ -597,13 +597,13 @@
526 : : ) internal view virtual returns (RewardsDataTypes.UserAssetBalance[] memory userAssetBalances);
527 : :
528 : : /// @inheritdoc IRewardsDistributor
- 529 : 2 : function getAssetDecimals(address asset) external view returns (uint8) {
- 530 : 4 : return _assets[asset].decimals;
+ 529 : : function getAssetDecimals(address asset) external view returns (uint8) {
+ 530 : 2 : return _assets[asset].decimals;
531 : : }
532 : :
533 : : /// @inheritdoc IRewardsDistributor
- 534 : 3 : function getEmissionManager() external view returns (address) {
- 535 : 6 : return EMISSION_MANAGER;
+ 534 : : function getEmissionManager() external view returns (address) {
+ 535 : 5 : return EMISSION_MANAGER;
536 : : }
537 : : }
@@ -613,8 +613,8 @@
diff --git a/report/periphery/contracts/rewards/src/periphery/contracts/rewards/index.html b/report/rewards/index-sort-b.html
similarity index 57%
rename from report/periphery/contracts/rewards/src/periphery/contracts/rewards/index.html
rename to report/rewards/index-sort-b.html
index c312bdc4..40bea0d0 100644
--- a/report/periphery/contracts/rewards/src/periphery/contracts/rewards/index.html
+++ b/report/rewards/index-sort-b.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/rewards/src/periphery/contracts/rewards
-
+ LCOV - lcov.info.p - rewards
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../glass.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../glass.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../updown.png) |
Rate |
@@ -96,57 +96,57 @@
Hit |
- EmissionManager.sol |
+ EmissionManager.sol |
-
+
|
100.0 % |
- 16 |
- 16 |
+ 18 |
+ 18 |
- |
|
|
100.0 % |
- 10 |
- 10 |
+ 12 |
+ 12 |
- RewardsController.sol |
+ RewardsController.sol |
-
+
|
- 98.7 % |
+ 98.8 % |
+ 80 |
79 |
- 78 |
- |
|
|
- 100.0 % |
- 23 |
- 23 |
+ 96.0 % |
+ 25 |
+ 24 |
- RewardsDistributor.sol |
+ RewardsDistributor.sol |
-
+
|
- 99.2 % |
+ 98.3 % |
+ 121 |
119 |
- 118 |
- |
|
|
- 100.0 % |
- 22 |
- 22 |
+ 95.8 % |
+ 24 |
+ 23 |
diff --git a/report/periphery/contracts/rewards/src/periphery/contracts/rewards/index-sort-f.html b/report/rewards/index-sort-f.html
similarity index 57%
rename from report/periphery/contracts/rewards/src/periphery/contracts/rewards/index-sort-f.html
rename to report/rewards/index-sort-f.html
index 52a4a0d6..f8ef4622 100644
--- a/report/periphery/contracts/rewards/src/periphery/contracts/rewards/index-sort-f.html
+++ b/report/rewards/index-sort-f.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/rewards/src/periphery/contracts/rewards
-
+ LCOV - lcov.info.p - rewards
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../glass.png) |
+ File ![Click to sort table by file name Sort by file name](../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../glass.png) |
Rate |
@@ -96,57 +96,57 @@
Hit |
- EmissionManager.sol |
+ RewardsDistributor.sol |
-
+
|
- 100.0 % |
- 16 |
- 16 |
+ 98.3 % |
+ 121 |
+ 119 |
- |
|
|
- 100.0 % |
- 10 |
- 10 |
+ 95.8 % |
+ 24 |
+ 23 |
- RewardsDistributor.sol |
+ RewardsController.sol |
-
+
|
- 99.2 % |
- 119 |
- 118 |
+ 98.8 % |
+ 80 |
+ 79 |
- |
|
|
- 100.0 % |
- 22 |
- 22 |
+ 96.0 % |
+ 25 |
+ 24 |
- RewardsController.sol |
+ EmissionManager.sol |
-
+
|
- 98.7 % |
- 79 |
- 78 |
+ 100.0 % |
+ 18 |
+ 18 |
- |
|
|
100.0 % |
- 23 |
- 23 |
+ 12 |
+ 12 |
diff --git a/report/periphery/contracts/rewards/src/periphery/contracts/rewards/index-sort-l.html b/report/rewards/index-sort-l.html
similarity index 57%
rename from report/periphery/contracts/rewards/src/periphery/contracts/rewards/index-sort-l.html
rename to report/rewards/index-sort-l.html
index 03d2ac1a..9d3a50d5 100644
--- a/report/periphery/contracts/rewards/src/periphery/contracts/rewards/index-sort-l.html
+++ b/report/rewards/index-sort-l.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/rewards/src/periphery/contracts/rewards
-
+ LCOV - lcov.info.p - rewards
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../glass.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../glass.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../updown.png) |
Rate |
@@ -96,57 +96,57 @@
Hit |
- RewardsController.sol |
+ RewardsDistributor.sol |
-
+
|
- 98.7 % |
- 79 |
- 78 |
+ 98.3 % |
+ 121 |
+ 119 |
- |
|
|
- 100.0 % |
- 23 |
+ 95.8 % |
+ 24 |
23 |
- RewardsDistributor.sol |
+ RewardsController.sol |
-
+
|
- 99.2 % |
- 119 |
- 118 |
+ 98.8 % |
+ 80 |
+ 79 |
- |
|
|
- 100.0 % |
- 22 |
- 22 |
+ 96.0 % |
+ 25 |
+ 24 |
- EmissionManager.sol |
+ EmissionManager.sol |
-
+
|
100.0 % |
- 16 |
- 16 |
+ 18 |
+ 18 |
- |
|
|
100.0 % |
- 10 |
- 10 |
+ 12 |
+ 12 |
diff --git a/report/periphery/contracts/rewards/src/periphery/contracts/rewards/index-sort-b.html b/report/rewards/index.html
similarity index 57%
rename from report/periphery/contracts/rewards/src/periphery/contracts/rewards/index-sort-b.html
rename to report/rewards/index.html
index e5282164..a50dcfc8 100644
--- a/report/periphery/contracts/rewards/src/periphery/contracts/rewards/index-sort-b.html
+++ b/report/rewards/index.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/rewards/src/periphery/contracts/rewards
-
+ LCOV - lcov.info.p - rewards
+
LCOV - code coverage report |
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
|
- ![](../../../../../../../glass.png) |
+ ![](../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../glass.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../glass.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../updown.png) |
Rate |
@@ -96,57 +96,57 @@
Hit |
- EmissionManager.sol |
+ EmissionManager.sol |
-
+
|
100.0 % |
- 16 |
- 16 |
+ 18 |
+ 18 |
- |
|
|
100.0 % |
- 10 |
- 10 |
+ 12 |
+ 12 |
- RewardsController.sol |
+ RewardsController.sol |
-
+
|
- 98.7 % |
+ 98.8 % |
+ 80 |
79 |
- 78 |
- |
|
|
- 100.0 % |
- 23 |
- 23 |
+ 96.0 % |
+ 25 |
+ 24 |
- RewardsDistributor.sol |
+ RewardsDistributor.sol |
-
+
|
- 99.2 % |
+ 98.3 % |
+ 121 |
119 |
- 118 |
- |
|
|
- 100.0 % |
- 22 |
- 22 |
+ 95.8 % |
+ 24 |
+ 23 |
diff --git a/report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/PullRewardsTransferStrategy.sol.func-c.html b/report/rewards/transfer-strategies/PullRewardsTransferStrategy.sol.func-c.html
similarity index 64%
rename from report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/PullRewardsTransferStrategy.sol.func-c.html
rename to report/rewards/transfer-strategies/PullRewardsTransferStrategy.sol.func-c.html
index cf59fe14..744cbbcd 100644
--- a/report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/PullRewardsTransferStrategy.sol.func-c.html
+++ b/report/rewards/transfer-strategies/PullRewardsTransferStrategy.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/PullRewardsTransferStrategy.sol - functions
-
+ LCOV - lcov.info.p - rewards/transfer-strategies/PullRewardsTransferStrategy.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,21 +53,21 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../updown.png) |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../glass.png) |
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../glass.png) |
@@ -77,11 +77,18 @@
1 |
+
+
+ PullRewardsTransferStrategy. |
+
+ 866 |
+
+
PullRewardsTransferStrategy.performTransfer |
- 7 |
+ 1902 |
@@ -89,8 +96,8 @@
diff --git a/report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/PullRewardsTransferStrategy.sol.func.html b/report/rewards/transfer-strategies/PullRewardsTransferStrategy.sol.func.html
similarity index 64%
rename from report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/PullRewardsTransferStrategy.sol.func.html
rename to report/rewards/transfer-strategies/PullRewardsTransferStrategy.sol.func.html
index ed02ea5a..b36edeb1 100644
--- a/report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/PullRewardsTransferStrategy.sol.func.html
+++ b/report/rewards/transfer-strategies/PullRewardsTransferStrategy.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/PullRewardsTransferStrategy.sol - functions
-
+ LCOV - lcov.info.p - rewards/transfer-strategies/PullRewardsTransferStrategy.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,21 +53,28 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../glass.png) |
+
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../updown.png) |
+
+
+
+
+ PullRewardsTransferStrategy. |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../updown.png) |
+ 866 |
@@ -81,7 +88,7 @@
PullRewardsTransferStrategy.performTransfer |
- 7 |
+ 1902 |
@@ -89,8 +96,8 @@
diff --git a/report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/PullRewardsTransferStrategy.sol.gcov.html b/report/rewards/transfer-strategies/PullRewardsTransferStrategy.sol.gcov.html
similarity index 79%
rename from report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/PullRewardsTransferStrategy.sol.gcov.html
rename to report/rewards/transfer-strategies/PullRewardsTransferStrategy.sol.gcov.html
index c52092d8..28784529 100644
--- a/report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/PullRewardsTransferStrategy.sol.gcov.html
+++ b/report/rewards/transfer-strategies/PullRewardsTransferStrategy.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/PullRewardsTransferStrategy.sol
-
+ LCOV - lcov.info.p - rewards/transfer-strategies/PullRewardsTransferStrategy.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -75,8 +75,8 @@
4 : : import {IPullRewardsTransferStrategy} from '../interfaces/IPullRewardsTransferStrategy.sol';
5 : : import {ITransferStrategyBase} from '../interfaces/ITransferStrategyBase.sol';
6 : : import {TransferStrategyBase} from './TransferStrategyBase.sol';
- 7 : : import {GPv2SafeERC20} from 'aave-v3-core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol';
- 8 : : import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
+ 7 : : import {GPv2SafeERC20} from '../../dependencies/gnosis/contracts/GPv2SafeERC20.sol';
+ 8 : : import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
9 : :
10 : : /**
11 : : * @title PullRewardsTransferStrategy
@@ -94,11 +94,11 @@
23 : : address rewardsAdmin,
24 : : address rewardsVault
25 : : ) TransferStrategyBase(incentivesController, rewardsAdmin) {
- 26 : : REWARDS_VAULT = rewardsVault;
+ 26 : 380 : REWARDS_VAULT = rewardsVault;
27 : : }
28 : :
29 : : /// @inheritdoc TransferStrategyBase
- 30 : 7 : function performTransfer(
+ 30 : : function performTransfer(
31 : : address to,
32 : : address reward,
33 : : uint256 amount
@@ -108,14 +108,14 @@
37 : : onlyIncentivesController
38 : : returns (bool)
39 : : {
- 40 : 14 : IERC20(reward).safeTransferFrom(REWARDS_VAULT, to, amount);
+ 40 : 1902 : IERC20(reward).safeTransferFrom(REWARDS_VAULT, to, amount);
41 : :
- 42 : 14 : return true;
+ 42 : 1902 : return true;
43 : : }
44 : :
45 : : /// @inheritdoc IPullRewardsTransferStrategy
- 46 : 1 : function getRewardsVault() external view returns (address) {
- 47 : 2 : return REWARDS_VAULT;
+ 46 : : function getRewardsVault() external view returns (address) {
+ 47 : 1 : return REWARDS_VAULT;
48 : : }
49 : : }
@@ -125,8 +125,8 @@
diff --git a/report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/StakedTokenTransferStrategy.sol.func-c.html b/report/rewards/transfer-strategies/StakedTokenTransferStrategy.sol.func-c.html
similarity index 67%
rename from report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/StakedTokenTransferStrategy.sol.func-c.html
rename to report/rewards/transfer-strategies/StakedTokenTransferStrategy.sol.func-c.html
index 95d87bcd..b68d95c7 100644
--- a/report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/StakedTokenTransferStrategy.sol.func-c.html
+++ b/report/rewards/transfer-strategies/StakedTokenTransferStrategy.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/StakedTokenTransferStrategy.sol - functions
-
+ LCOV - lcov.info.p - rewards/transfer-strategies/StakedTokenTransferStrategy.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,17 +31,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
@@ -53,21 +53,28 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../updown.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../updown.png) |
+
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../glass.png) |
+
+
+
+
+ StakedTokenTransferStrategy. |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../glass.png) |
+ 0 |
@@ -110,8 +117,8 @@
diff --git a/report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/StakedTokenTransferStrategy.sol.func.html b/report/rewards/transfer-strategies/StakedTokenTransferStrategy.sol.func.html
similarity index 67%
rename from report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/StakedTokenTransferStrategy.sol.func.html
rename to report/rewards/transfer-strategies/StakedTokenTransferStrategy.sol.func.html
index 26f341d4..f0e7459a 100644
--- a/report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/StakedTokenTransferStrategy.sol.func.html
+++ b/report/rewards/transfer-strategies/StakedTokenTransferStrategy.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/StakedTokenTransferStrategy.sol - functions
-
+ LCOV - lcov.info.p - rewards/transfer-strategies/StakedTokenTransferStrategy.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,17 +31,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
@@ -53,21 +53,28 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- Function Name ![Click to sort table by function name Sort by function name](../../../../../../../../../glass.png) |
+ Function Name ![Click to sort table by function name Sort by function name](../../glass.png) |
+
+ Hit count ![Click to sort table by function hit count Sort by function hit count](../../updown.png) |
+
+
+
+
+ StakedTokenTransferStrategy. |
- Hit count ![Click to sort table by function hit count Sort by function hit count](../../../../../../../../../updown.png) |
+ 0 |
@@ -110,8 +117,8 @@
diff --git a/report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/StakedTokenTransferStrategy.sol.gcov.html b/report/rewards/transfer-strategies/StakedTokenTransferStrategy.sol.gcov.html
similarity index 76%
rename from report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/StakedTokenTransferStrategy.sol.gcov.html
rename to report/rewards/transfer-strategies/StakedTokenTransferStrategy.sol.gcov.html
index 07c0b5dc..b71c62ba 100644
--- a/report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/StakedTokenTransferStrategy.sol.gcov.html
+++ b/report/rewards/transfer-strategies/StakedTokenTransferStrategy.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/StakedTokenTransferStrategy.sol
-
+ LCOV - lcov.info.p - rewards/transfer-strategies/StakedTokenTransferStrategy.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,17 +31,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -76,8 +76,8 @@
5 : : import {IStakedTokenTransferStrategy} from '../interfaces/IStakedTokenTransferStrategy.sol';
6 : : import {ITransferStrategyBase} from '../interfaces/ITransferStrategyBase.sol';
7 : : import {TransferStrategyBase} from './TransferStrategyBase.sol';
- 8 : : import {GPv2SafeERC20} from 'aave-v3-core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol';
- 9 : : import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
+ 8 : : import {GPv2SafeERC20} from '../../dependencies/gnosis/contracts/GPv2SafeERC20.sol';
+ 9 : : import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
10 : :
11 : : /**
12 : : * @title StakedTokenTransferStrategy
@@ -96,15 +96,15 @@
25 : : address rewardsAdmin,
26 : : IStakedToken stakeToken
27 : : ) TransferStrategyBase(incentivesController, rewardsAdmin) {
- 28 : : STAKE_CONTRACT = stakeToken;
- 29 : : UNDERLYING_TOKEN = STAKE_CONTRACT.STAKED_TOKEN();
+ 28 : 0 : STAKE_CONTRACT = stakeToken;
+ 29 : 0 : UNDERLYING_TOKEN = STAKE_CONTRACT.STAKED_TOKEN();
30 : :
- 31 : : IERC20(UNDERLYING_TOKEN).approve(address(STAKE_CONTRACT), 0);
- 32 : : IERC20(UNDERLYING_TOKEN).approve(address(STAKE_CONTRACT), type(uint256).max);
+ 31 : 0 : IERC20(UNDERLYING_TOKEN).approve(address(STAKE_CONTRACT), 0);
+ 32 : 0 : IERC20(UNDERLYING_TOKEN).approve(address(STAKE_CONTRACT), type(uint256).max);
33 : : }
34 : :
35 : : /// @inheritdoc TransferStrategyBase
- 36 : 1 : function performTransfer(
+ 36 : : function performTransfer(
37 : : address to,
38 : : address reward,
39 : : uint256 amount
@@ -114,32 +114,32 @@
43 : : onlyIncentivesController
44 : : returns (bool)
45 : : {
- 46 : 2 : require(reward == address(STAKE_CONTRACT), 'REWARD_TOKEN_NOT_STAKE_CONTRACT');
+ 46 : 1 : require(reward == address(STAKE_CONTRACT), 'REWARD_TOKEN_NOT_STAKE_CONTRACT');
47 : :
- 48 : 2 : STAKE_CONTRACT.stake(to, amount);
+ 48 : 1 : STAKE_CONTRACT.stake(to, amount);
49 : :
- 50 : 2 : return true;
+ 50 : 1 : return true;
51 : : }
52 : :
53 : : /// @inheritdoc IStakedTokenTransferStrategy
- 54 : 1 : function renewApproval() external onlyRewardsAdmin {
- 55 : 2 : IERC20(UNDERLYING_TOKEN).approve(address(STAKE_CONTRACT), 0);
- 56 : 2 : IERC20(UNDERLYING_TOKEN).approve(address(STAKE_CONTRACT), type(uint256).max);
+ 54 : : function renewApproval() external onlyRewardsAdmin {
+ 55 : 1 : IERC20(UNDERLYING_TOKEN).approve(address(STAKE_CONTRACT), 0);
+ 56 : 1 : IERC20(UNDERLYING_TOKEN).approve(address(STAKE_CONTRACT), type(uint256).max);
57 : : }
58 : :
59 : : /// @inheritdoc IStakedTokenTransferStrategy
- 60 : 1 : function dropApproval() external onlyRewardsAdmin {
- 61 : 2 : IERC20(UNDERLYING_TOKEN).approve(address(STAKE_CONTRACT), 0);
+ 60 : : function dropApproval() external onlyRewardsAdmin {
+ 61 : 1 : IERC20(UNDERLYING_TOKEN).approve(address(STAKE_CONTRACT), 0);
62 : : }
63 : :
64 : : /// @inheritdoc IStakedTokenTransferStrategy
- 65 : 1 : function getStakeContract() external view returns (address) {
- 66 : 3 : return address(STAKE_CONTRACT);
+ 65 : : function getStakeContract() external view returns (address) {
+ 66 : 1 : return address(STAKE_CONTRACT);
67 : : }
68 : :
69 : : /// @inheritdoc IStakedTokenTransferStrategy
- 70 : 1 : function getUnderlyingToken() external view returns (address) {
- 71 : 2 : return UNDERLYING_TOKEN;
+ 70 : : function getUnderlyingToken() external view returns (address) {
+ 71 : 1 : return UNDERLYING_TOKEN;
72 : : }
73 : : }
@@ -149,8 +149,8 @@
diff --git a/report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/TransferStrategyBase.sol.func-c.html b/report/rewards/transfer-strategies/TransferStrategyBase.sol.func-c.html
similarity index 57%
rename from report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/TransferStrategyBase.sol.func-c.html
rename to report/rewards/transfer-strategies/TransferStrategyBase.sol.func-c.html
index 9221e237..baaa9b82 100644
--- a/report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/TransferStrategyBase.sol.func-c.html
+++ b/report/rewards/transfer-strategies/TransferStrategyBase.sol.func-c.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/TransferStrategyBase.sol - functions
-
+ LCOV - lcov.info.p - rewards/transfer-strategies/TransferStrategyBase.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,21 +53,21 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
diff --git a/report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/TransferStrategyBase.sol.func.html b/report/rewards/transfer-strategies/TransferStrategyBase.sol.func.html
similarity index 57%
rename from report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/TransferStrategyBase.sol.func.html
rename to report/rewards/transfer-strategies/TransferStrategyBase.sol.func.html
index 4a7b7bdd..ce59f793 100644
--- a/report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/TransferStrategyBase.sol.func.html
+++ b/report/rewards/transfer-strategies/TransferStrategyBase.sol.func.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/TransferStrategyBase.sol - functions
-
+ LCOV - lcov.info.p - rewards/transfer-strategies/TransferStrategyBase.sol - functions
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,21 +53,28 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
diff --git a/report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/TransferStrategyBase.sol.gcov.html b/report/rewards/transfer-strategies/TransferStrategyBase.sol.gcov.html
similarity index 78%
rename from report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/TransferStrategyBase.sol.gcov.html
rename to report/rewards/transfer-strategies/TransferStrategyBase.sol.gcov.html
index 7ae8da4c..6eb5665f 100644
--- a/report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/TransferStrategyBase.sol.gcov.html
+++ b/report/rewards/transfer-strategies/TransferStrategyBase.sol.gcov.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/TransferStrategyBase.sol
-
+ LCOV - lcov.info.p - rewards/transfer-strategies/TransferStrategyBase.sol
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -32,17 +32,17 @@
|
-
-
+
+
-
+
|
-
-
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -73,8 +73,8 @@
2 : : pragma solidity ^0.8.10;
3 : :
4 : : import {ITransferStrategyBase} from '../interfaces/ITransferStrategyBase.sol';
- 5 : : import {GPv2SafeERC20} from 'aave-v3-core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol';
- 6 : : import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
+ 5 : : import {GPv2SafeERC20} from '../../dependencies/gnosis/contracts/GPv2SafeERC20.sol';
+ 6 : : import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
7 : :
8 : : /**
9 : : * @title TransferStrategyStorage
@@ -87,15 +87,15 @@
16 : : address internal immutable REWARDS_ADMIN;
17 : :
18 : : constructor(address incentivesController, address rewardsAdmin) {
- 19 : : INCENTIVES_CONTROLLER = incentivesController;
- 20 : : REWARDS_ADMIN = rewardsAdmin;
+ 19 : 344 : INCENTIVES_CONTROLLER = incentivesController;
+ 20 : 398 : REWARDS_ADMIN = rewardsAdmin;
21 : : }
22 : :
23 : : /**
24 : : * @dev Modifier for incentives controller only functions
25 : : */
26 : : modifier onlyIncentivesController() {
- 27 : : require(INCENTIVES_CONTROLLER == msg.sender, 'CALLER_NOT_INCENTIVES_CONTROLLER');
+ 27 : 1903 : require(INCENTIVES_CONTROLLER == msg.sender, 'CALLER_NOT_INCENTIVES_CONTROLLER');
28 : : _;
29 : : }
30 : :
@@ -103,18 +103,18 @@
32 : : * @dev Modifier for reward admin only functions
33 : : */
34 : : modifier onlyRewardsAdmin() {
- 35 : : require(msg.sender == REWARDS_ADMIN, 'ONLY_REWARDS_ADMIN');
+ 35 : 1 : require(msg.sender == REWARDS_ADMIN, 'ONLY_REWARDS_ADMIN');
36 : : _;
37 : : }
38 : :
39 : : /// @inheritdoc ITransferStrategyBase
- 40 : 1 : function getIncentivesController() external view override returns (address) {
- 41 : 2 : return INCENTIVES_CONTROLLER;
+ 40 : : function getIncentivesController() external view override returns (address) {
+ 41 : 1 : return INCENTIVES_CONTROLLER;
42 : : }
43 : :
44 : : /// @inheritdoc ITransferStrategyBase
- 45 : 1 : function getRewardsAdmin() external view override returns (address) {
- 46 : 2 : return REWARDS_ADMIN;
+ 45 : : function getRewardsAdmin() external view override returns (address) {
+ 46 : 1 : return REWARDS_ADMIN;
47 : : }
48 : :
49 : : /// @inheritdoc ITransferStrategyBase
@@ -125,14 +125,14 @@
54 : : ) external virtual returns (bool);
55 : :
56 : : /// @inheritdoc ITransferStrategyBase
- 57 : 1 : function emergencyWithdrawal(
+ 57 : : function emergencyWithdrawal(
58 : : address token,
59 : : address to,
60 : : uint256 amount
61 : : ) external onlyRewardsAdmin {
- 62 : 2 : IERC20(token).safeTransfer(to, amount);
+ 62 : 1 : IERC20(token).safeTransfer(to, amount);
63 : :
- 64 : 2 : emit EmergencyWithdrawal(msg.sender, token, to, amount);
+ 64 : 1 : emit EmergencyWithdrawal(msg.sender, token, to, amount);
65 : : }
66 : : }
@@ -142,8 +142,8 @@
diff --git a/report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/index-sort-b.html b/report/rewards/transfer-strategies/index-sort-b.html
similarity index 60%
rename from report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/index-sort-b.html
rename to report/rewards/transfer-strategies/index-sort-b.html
index 93cc44a3..3a810862 100644
--- a/report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/index-sort-b.html
+++ b/report/rewards/transfer-strategies/index-sort-b.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies
-
+ LCOV - lcov.info.p - rewards/transfer-strategies
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../glass.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../glass.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../updown.png) |
Rate |
@@ -96,57 +96,57 @@
Hit |
- PullRewardsTransferStrategy.sol |
+ PullRewardsTransferStrategy.sol |
-
+
|
100.0 % |
- 3 |
- 3 |
+ 4 |
+ 4 |
- |
|
|
100.0 % |
- 2 |
- 2 |
+ 3 |
+ 3 |
- StakedTokenTransferStrategy.sol |
+ StakedTokenTransferStrategy.sol |
-
+
|
- 100.0 % |
- 8 |
+ 66.7 % |
+ 12 |
8 |
- |
|
|
- 100.0 % |
- 5 |
+ 83.3 % |
+ 6 |
5 |
- TransferStrategyBase.sol |
+ TransferStrategyBase.sol |
-
+
|
100.0 % |
- 4 |
- 4 |
+ 8 |
+ 8 |
- |
|
|
100.0 % |
- 3 |
- 3 |
+ 6 |
+ 6 |
diff --git a/report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/index-sort-f.html b/report/rewards/transfer-strategies/index-sort-f.html
similarity index 60%
rename from report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/index-sort-f.html
rename to report/rewards/transfer-strategies/index-sort-f.html
index a0bf2774..dd9ad31f 100644
--- a/report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/index-sort-f.html
+++ b/report/rewards/transfer-strategies/index-sort-f.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies
-
+ LCOV - lcov.info.p - rewards/transfer-strategies
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../glass.png) |
+ File ![Click to sort table by file name Sort by file name](../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../glass.png) |
Rate |
@@ -96,24 +96,24 @@
Hit |
- PullRewardsTransferStrategy.sol |
+ StakedTokenTransferStrategy.sol |
-
+
|
- 100.0 % |
- 3 |
- 3 |
+ 66.7 % |
+ 12 |
+ 8 |
- |
|
|
- 100.0 % |
- 2 |
- 2 |
+ 83.3 % |
+ 6 |
+ 5 |
- TransferStrategyBase.sol |
+ PullRewardsTransferStrategy.sol |
-
+
|
100.0 % |
4 |
@@ -126,9 +126,9 @@
3 |
- StakedTokenTransferStrategy.sol |
+ TransferStrategyBase.sol |
-
+
|
100.0 % |
8 |
@@ -137,16 +137,16 @@
|
|
100.0 % |
- 5 |
- 5 |
+ 6 |
+ 6 |
diff --git a/report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/index-sort-l.html b/report/rewards/transfer-strategies/index-sort-l.html
similarity index 60%
rename from report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/index-sort-l.html
rename to report/rewards/transfer-strategies/index-sort-l.html
index 5949512f..d96ecee6 100644
--- a/report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/index-sort-l.html
+++ b/report/rewards/transfer-strategies/index-sort-l.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies
-
+ LCOV - lcov.info.p - rewards/transfer-strategies
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../updown.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../glass.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../../updown.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../glass.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../updown.png) |
Rate |
@@ -96,24 +96,24 @@
Hit |
- PullRewardsTransferStrategy.sol |
+ StakedTokenTransferStrategy.sol |
-
+
|
- 100.0 % |
- 3 |
- 3 |
+ 66.7 % |
+ 12 |
+ 8 |
- |
|
|
- 100.0 % |
- 2 |
- 2 |
+ 83.3 % |
+ 6 |
+ 5 |
- TransferStrategyBase.sol |
+ PullRewardsTransferStrategy.sol |
-
+
|
100.0 % |
4 |
@@ -126,9 +126,9 @@
3 |
- StakedTokenTransferStrategy.sol |
+ TransferStrategyBase.sol |
-
+
|
100.0 % |
8 |
@@ -137,16 +137,16 @@
|
|
100.0 % |
- 5 |
- 5 |
+ 6 |
+ 6 |
diff --git a/report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/index.html b/report/rewards/transfer-strategies/index.html
similarity index 60%
rename from report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/index.html
rename to report/rewards/transfer-strategies/index.html
index 1059339f..c141bbe9 100644
--- a/report/periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies/index.html
+++ b/report/rewards/transfer-strategies/index.html
@@ -4,22 +4,22 @@
- LCOV - lcov.info.p - periphery/contracts/rewards/transfer-strategies/src/periphery/contracts/rewards/transfer-strategies
-
+ LCOV - lcov.info.p - rewards/transfer-strategies
+
LCOV - code coverage report |
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
-
+
|
|
@@ -31,18 +31,18 @@
|
-
-
-
+
+
+
-
+
|
-
-
-
+
+
+
|
@@ -53,12 +53,12 @@
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
|
- ![](../../../../../../../../../glass.png) |
+ ![](../../glass.png) |
@@ -79,10 +79,10 @@
- Filename ![Click to sort table by file name Sort by file name](../../../../../../../../../glass.png) |
- Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../../../../../../../../updown.png) |
- Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../../../../../../../../updown.png) |
- Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../../../../../../../../updown.png) |
+ File ![Click to sort table by file name Sort by file name](../../glass.png) |
+ Line Coverage ![Click to sort table by line coverage Sort by line coverage](../../updown.png) |
+ Branch Coverage ![Click to sort table by branch coverage Sort by branch coverage](../../updown.png) |
+ Function Coverage ![Click to sort table by function coverage Sort by function coverage](../../updown.png) |
Rate |
@@ -96,57 +96,57 @@
Hit |
- PullRewardsTransferStrategy.sol |
+ PullRewardsTransferStrategy.sol |
-
+
|
100.0 % |
- 3 |
- 3 |
+ 4 |
+ 4 |
- |
|
|
100.0 % |
- 2 |
- 2 |
+ 3 |
+ 3 |
- StakedTokenTransferStrategy.sol |
+ StakedTokenTransferStrategy.sol |
-
+
|
- 100.0 % |
- 8 |
+ 66.7 % |
+ 12 |
8 |
- |
|
|
- 100.0 % |
- 5 |
+ 83.3 % |
+ 6 |
5 |
- TransferStrategyBase.sol |
+ TransferStrategyBase.sol |
-
+
|
100.0 % |
- 4 |
- 4 |
+ 8 |
+ 8 |
- |
|
|
100.0 % |
- 3 |
- 3 |
+ 6 |
+ 6 |
diff --git a/scripts/misc/LibraryPreCompileOne.sol b/scripts/misc/LibraryPreCompileOne.sol
index 502b5cdf..746a7920 100644
--- a/scripts/misc/LibraryPreCompileOne.sol
+++ b/scripts/misc/LibraryPreCompileOne.sol
@@ -71,16 +71,16 @@ contract LibraryPreCompileOne is FfiUtils, Script, DeployUtils {
return
string(
abi.encodePacked(
- 'aave-v3-core/contracts/protocol/libraries/logic/BorrowLogic.sol:BorrowLogic:',
+ 'src/contracts/protocol/libraries/logic/BorrowLogic.sol:BorrowLogic:',
vm.toString(report.borrowLogic),
',',
- 'aave-v3-core/contracts/protocol/libraries/logic/BridgeLogic.sol:BridgeLogic:',
+ 'src/contracts/protocol/libraries/logic/BridgeLogic.sol:BridgeLogic:',
vm.toString(report.bridgeLogic),
',',
- 'aave-v3-core/contracts/protocol/libraries/logic/ConfiguratorLogic.sol:ConfiguratorLogic:',
+ 'src/contracts/protocol/libraries/logic/ConfiguratorLogic.sol:ConfiguratorLogic:',
vm.toString(report.configuratorLogic),
',',
- 'aave-v3-core/contracts/protocol/libraries/logic/EModeLogic.sol:EModeLogic:',
+ 'src/contracts/protocol/libraries/logic/EModeLogic.sol:EModeLogic:',
vm.toString(report.eModeLogic)
)
);
diff --git a/scripts/misc/LibraryPreCompileTwo.sol b/scripts/misc/LibraryPreCompileTwo.sol
index cab49cec..9b381a66 100644
--- a/scripts/misc/LibraryPreCompileTwo.sol
+++ b/scripts/misc/LibraryPreCompileTwo.sol
@@ -71,16 +71,16 @@ contract LibraryPreCompileTwo is FfiUtils, Script, DeployUtils {
string(
abi.encodePacked(
',',
- 'aave-v3-core/contracts/protocol/libraries/logic/FlashLoanLogic.sol:FlashLoanLogic:',
+ 'src/contracts/protocol/libraries/logic/FlashLoanLogic.sol:FlashLoanLogic:',
vm.toString(report.flashLoanLogic),
',',
- 'aave-v3-core/contracts/protocol/libraries/logic/LiquidationLogic.sol:LiquidationLogic:',
+ 'src/contracts/protocol/libraries/logic/LiquidationLogic.sol:LiquidationLogic:',
vm.toString(report.liquidationLogic),
',',
- 'aave-v3-core/contracts/protocol/libraries/logic/PoolLogic.sol:PoolLogic:',
+ 'src/contracts/protocol/libraries/logic/PoolLogic.sol:PoolLogic:',
vm.toString(report.poolLogic),
',',
- 'aave-v3-core/contracts/protocol/libraries/logic/SupplyLogic.sol:SupplyLogic:',
+ 'src/contracts/protocol/libraries/logic/SupplyLogic.sol:SupplyLogic:',
vm.toString(report.supplyLogic)
)
);
diff --git a/src/core/contracts/dependencies/chainlink/AggregatorInterface.sol b/src/contracts/dependencies/chainlink/AggregatorInterface.sol
similarity index 100%
rename from src/core/contracts/dependencies/chainlink/AggregatorInterface.sol
rename to src/contracts/dependencies/chainlink/AggregatorInterface.sol
diff --git a/src/core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol b/src/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol
similarity index 100%
rename from src/core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol
rename to src/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol
diff --git a/src/periphery/contracts/dependencies/openzeppelin/ReentrancyGuard.sol b/src/contracts/dependencies/openzeppelin/ReentrancyGuard.sol
similarity index 100%
rename from src/periphery/contracts/dependencies/openzeppelin/ReentrancyGuard.sol
rename to src/contracts/dependencies/openzeppelin/ReentrancyGuard.sol
diff --git a/src/core/contracts/dependencies/openzeppelin/contracts/AccessControl.sol b/src/contracts/dependencies/openzeppelin/contracts/AccessControl.sol
similarity index 100%
rename from src/core/contracts/dependencies/openzeppelin/contracts/AccessControl.sol
rename to src/contracts/dependencies/openzeppelin/contracts/AccessControl.sol
diff --git a/src/core/contracts/dependencies/openzeppelin/contracts/Address.sol b/src/contracts/dependencies/openzeppelin/contracts/Address.sol
similarity index 100%
rename from src/core/contracts/dependencies/openzeppelin/contracts/Address.sol
rename to src/contracts/dependencies/openzeppelin/contracts/Address.sol
diff --git a/src/core/contracts/dependencies/openzeppelin/contracts/Context.sol b/src/contracts/dependencies/openzeppelin/contracts/Context.sol
similarity index 100%
rename from src/core/contracts/dependencies/openzeppelin/contracts/Context.sol
rename to src/contracts/dependencies/openzeppelin/contracts/Context.sol
diff --git a/src/core/contracts/dependencies/openzeppelin/contracts/ERC165.sol b/src/contracts/dependencies/openzeppelin/contracts/ERC165.sol
similarity index 100%
rename from src/core/contracts/dependencies/openzeppelin/contracts/ERC165.sol
rename to src/contracts/dependencies/openzeppelin/contracts/ERC165.sol
diff --git a/src/core/contracts/dependencies/openzeppelin/contracts/ERC20.sol b/src/contracts/dependencies/openzeppelin/contracts/ERC20.sol
similarity index 100%
rename from src/core/contracts/dependencies/openzeppelin/contracts/ERC20.sol
rename to src/contracts/dependencies/openzeppelin/contracts/ERC20.sol
diff --git a/src/core/contracts/dependencies/openzeppelin/contracts/IAccessControl.sol b/src/contracts/dependencies/openzeppelin/contracts/IAccessControl.sol
similarity index 100%
rename from src/core/contracts/dependencies/openzeppelin/contracts/IAccessControl.sol
rename to src/contracts/dependencies/openzeppelin/contracts/IAccessControl.sol
diff --git a/src/core/contracts/dependencies/openzeppelin/contracts/IERC165.sol b/src/contracts/dependencies/openzeppelin/contracts/IERC165.sol
similarity index 100%
rename from src/core/contracts/dependencies/openzeppelin/contracts/IERC165.sol
rename to src/contracts/dependencies/openzeppelin/contracts/IERC165.sol
diff --git a/src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol b/src/contracts/dependencies/openzeppelin/contracts/IERC20.sol
similarity index 100%
rename from src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol
rename to src/contracts/dependencies/openzeppelin/contracts/IERC20.sol
diff --git a/src/core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol b/src/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol
similarity index 100%
rename from src/core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol
rename to src/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol
diff --git a/src/core/contracts/dependencies/openzeppelin/contracts/Ownable.sol b/src/contracts/dependencies/openzeppelin/contracts/Ownable.sol
similarity index 100%
rename from src/core/contracts/dependencies/openzeppelin/contracts/Ownable.sol
rename to src/contracts/dependencies/openzeppelin/contracts/Ownable.sol
diff --git a/src/core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol b/src/contracts/dependencies/openzeppelin/contracts/SafeCast.sol
similarity index 100%
rename from src/core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol
rename to src/contracts/dependencies/openzeppelin/contracts/SafeCast.sol
diff --git a/src/core/contracts/dependencies/openzeppelin/contracts/SafeERC20.sol b/src/contracts/dependencies/openzeppelin/contracts/SafeERC20.sol
similarity index 100%
rename from src/core/contracts/dependencies/openzeppelin/contracts/SafeERC20.sol
rename to src/contracts/dependencies/openzeppelin/contracts/SafeERC20.sol
diff --git a/src/core/contracts/dependencies/openzeppelin/contracts/SafeMath.sol b/src/contracts/dependencies/openzeppelin/contracts/SafeMath.sol
similarity index 100%
rename from src/core/contracts/dependencies/openzeppelin/contracts/SafeMath.sol
rename to src/contracts/dependencies/openzeppelin/contracts/SafeMath.sol
diff --git a/src/core/contracts/dependencies/openzeppelin/contracts/Strings.sol b/src/contracts/dependencies/openzeppelin/contracts/Strings.sol
similarity index 100%
rename from src/core/contracts/dependencies/openzeppelin/contracts/Strings.sol
rename to src/contracts/dependencies/openzeppelin/contracts/Strings.sol
diff --git a/src/core/contracts/dependencies/openzeppelin/upgradeability/AdminUpgradeabilityProxy.sol b/src/contracts/dependencies/openzeppelin/upgradeability/AdminUpgradeabilityProxy.sol
similarity index 100%
rename from src/core/contracts/dependencies/openzeppelin/upgradeability/AdminUpgradeabilityProxy.sol
rename to src/contracts/dependencies/openzeppelin/upgradeability/AdminUpgradeabilityProxy.sol
diff --git a/src/core/contracts/dependencies/openzeppelin/upgradeability/BaseAdminUpgradeabilityProxy.sol b/src/contracts/dependencies/openzeppelin/upgradeability/BaseAdminUpgradeabilityProxy.sol
similarity index 100%
rename from src/core/contracts/dependencies/openzeppelin/upgradeability/BaseAdminUpgradeabilityProxy.sol
rename to src/contracts/dependencies/openzeppelin/upgradeability/BaseAdminUpgradeabilityProxy.sol
diff --git a/src/core/contracts/dependencies/openzeppelin/upgradeability/BaseUpgradeabilityProxy.sol b/src/contracts/dependencies/openzeppelin/upgradeability/BaseUpgradeabilityProxy.sol
similarity index 100%
rename from src/core/contracts/dependencies/openzeppelin/upgradeability/BaseUpgradeabilityProxy.sol
rename to src/contracts/dependencies/openzeppelin/upgradeability/BaseUpgradeabilityProxy.sol
diff --git a/src/core/contracts/dependencies/openzeppelin/upgradeability/Initializable.sol b/src/contracts/dependencies/openzeppelin/upgradeability/Initializable.sol
similarity index 100%
rename from src/core/contracts/dependencies/openzeppelin/upgradeability/Initializable.sol
rename to src/contracts/dependencies/openzeppelin/upgradeability/Initializable.sol
diff --git a/src/core/contracts/dependencies/openzeppelin/upgradeability/InitializableAdminUpgradeabilityProxy.sol b/src/contracts/dependencies/openzeppelin/upgradeability/InitializableAdminUpgradeabilityProxy.sol
similarity index 100%
rename from src/core/contracts/dependencies/openzeppelin/upgradeability/InitializableAdminUpgradeabilityProxy.sol
rename to src/contracts/dependencies/openzeppelin/upgradeability/InitializableAdminUpgradeabilityProxy.sol
diff --git a/src/core/contracts/dependencies/openzeppelin/upgradeability/InitializableUpgradeabilityProxy.sol b/src/contracts/dependencies/openzeppelin/upgradeability/InitializableUpgradeabilityProxy.sol
similarity index 100%
rename from src/core/contracts/dependencies/openzeppelin/upgradeability/InitializableUpgradeabilityProxy.sol
rename to src/contracts/dependencies/openzeppelin/upgradeability/InitializableUpgradeabilityProxy.sol
diff --git a/src/core/contracts/dependencies/openzeppelin/upgradeability/Proxy.sol b/src/contracts/dependencies/openzeppelin/upgradeability/Proxy.sol
similarity index 100%
rename from src/core/contracts/dependencies/openzeppelin/upgradeability/Proxy.sol
rename to src/contracts/dependencies/openzeppelin/upgradeability/Proxy.sol
diff --git a/src/core/contracts/dependencies/openzeppelin/upgradeability/UpgradeabilityProxy.sol b/src/contracts/dependencies/openzeppelin/upgradeability/UpgradeabilityProxy.sol
similarity index 100%
rename from src/core/contracts/dependencies/openzeppelin/upgradeability/UpgradeabilityProxy.sol
rename to src/contracts/dependencies/openzeppelin/upgradeability/UpgradeabilityProxy.sol
diff --git a/src/core/contracts/dependencies/weth/WETH9.sol b/src/contracts/dependencies/weth/WETH9.sol
similarity index 100%
rename from src/core/contracts/dependencies/weth/WETH9.sol
rename to src/contracts/dependencies/weth/WETH9.sol
diff --git a/src/periphery/contracts/adapters/paraswap/AaveParaSwapFeeClaimer.sol b/src/contracts/extensions/paraswap-adapters/AaveParaSwapFeeClaimer.sol
similarity index 95%
rename from src/periphery/contracts/adapters/paraswap/AaveParaSwapFeeClaimer.sol
rename to src/contracts/extensions/paraswap-adapters/AaveParaSwapFeeClaimer.sol
index d4ebff35..0f91ff05 100644
--- a/src/periphery/contracts/adapters/paraswap/AaveParaSwapFeeClaimer.sol
+++ b/src/contracts/extensions/paraswap-adapters/AaveParaSwapFeeClaimer.sol
@@ -3,7 +3,7 @@
pragma solidity ^0.8.0;
import {IFeeClaimer} from './interfaces/IFeeClaimer.sol';
-import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
+import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
/**
* @title AaveParaSwapFeeClaimer
diff --git a/src/periphery/contracts/adapters/paraswap/BaseParaSwapAdapter.sol b/src/contracts/extensions/paraswap-adapters/BaseParaSwapAdapter.sol
similarity index 79%
rename from src/periphery/contracts/adapters/paraswap/BaseParaSwapAdapter.sol
rename to src/contracts/extensions/paraswap-adapters/BaseParaSwapAdapter.sol
index 247f4437..45988edf 100644
--- a/src/periphery/contracts/adapters/paraswap/BaseParaSwapAdapter.sol
+++ b/src/contracts/extensions/paraswap-adapters/BaseParaSwapAdapter.sol
@@ -1,16 +1,16 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.10;
-import {DataTypes} from 'aave-v3-core/contracts/protocol/libraries/types/DataTypes.sol';
-import {FlashLoanSimpleReceiverBase} from 'aave-v3-core/contracts/flashloan/base/FlashLoanSimpleReceiverBase.sol';
-import {GPv2SafeERC20} from 'aave-v3-core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol';
-import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
-import {IERC20Detailed} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol';
-import {IERC20WithPermit} from 'aave-v3-core/contracts/interfaces/IERC20WithPermit.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
-import {IPriceOracleGetter} from 'aave-v3-core/contracts/interfaces/IPriceOracleGetter.sol';
-import {SafeMath} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/SafeMath.sol';
-import {Ownable} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/Ownable.sol';
+import {DataTypes} from '../../protocol/libraries/types/DataTypes.sol';
+import {FlashLoanSimpleReceiverBase} from '../../misc/flashloan/base/FlashLoanSimpleReceiverBase.sol';
+import {GPv2SafeERC20} from '../../dependencies/gnosis/contracts/GPv2SafeERC20.sol';
+import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
+import {IERC20Detailed} from '../../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
+import {IERC20WithPermit} from '../../interfaces/IERC20WithPermit.sol';
+import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
+import {IPriceOracleGetter} from '../../interfaces/IPriceOracleGetter.sol';
+import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol';
+import {Ownable} from '../../dependencies/openzeppelin/contracts/Ownable.sol';
/**
* @title BaseParaSwapAdapter
diff --git a/src/periphery/contracts/adapters/paraswap/BaseParaSwapBuyAdapter.sol b/src/contracts/extensions/paraswap-adapters/BaseParaSwapBuyAdapter.sol
similarity index 89%
rename from src/periphery/contracts/adapters/paraswap/BaseParaSwapBuyAdapter.sol
rename to src/contracts/extensions/paraswap-adapters/BaseParaSwapBuyAdapter.sol
index 522ac1c8..abff3e87 100644
--- a/src/periphery/contracts/adapters/paraswap/BaseParaSwapBuyAdapter.sol
+++ b/src/contracts/extensions/paraswap-adapters/BaseParaSwapBuyAdapter.sol
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.10;
-import {SafeERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/SafeERC20.sol';
-import {SafeMath} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/SafeMath.sol';
-import {PercentageMath} from 'aave-v3-core/contracts/protocol/libraries/math/PercentageMath.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
-import {IERC20Detailed} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol';
+import {SafeERC20} from '../../dependencies/openzeppelin/contracts/SafeERC20.sol';
+import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol';
+import {PercentageMath} from '../../protocol/libraries/math/PercentageMath.sol';
+import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
+import {IERC20Detailed} from '../../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
import {IParaSwapAugustus} from './interfaces/IParaSwapAugustus.sol';
import {IParaSwapAugustusRegistry} from './interfaces/IParaSwapAugustusRegistry.sol';
import {BaseParaSwapAdapter} from './BaseParaSwapAdapter.sol';
diff --git a/src/periphery/contracts/adapters/paraswap/BaseParaSwapSellAdapter.sol b/src/contracts/extensions/paraswap-adapters/BaseParaSwapSellAdapter.sol
similarity index 89%
rename from src/periphery/contracts/adapters/paraswap/BaseParaSwapSellAdapter.sol
rename to src/contracts/extensions/paraswap-adapters/BaseParaSwapSellAdapter.sol
index ce34288c..2b5a306f 100644
--- a/src/periphery/contracts/adapters/paraswap/BaseParaSwapSellAdapter.sol
+++ b/src/contracts/extensions/paraswap-adapters/BaseParaSwapSellAdapter.sol
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.10;
-import {SafeERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/SafeERC20.sol';
-import {SafeMath} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/SafeMath.sol';
-import {PercentageMath} from 'aave-v3-core/contracts/protocol/libraries/math/PercentageMath.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
-import {IERC20Detailed} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol';
+import {SafeERC20} from '../../dependencies/openzeppelin/contracts/SafeERC20.sol';
+import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol';
+import {PercentageMath} from '../../protocol/libraries/math/PercentageMath.sol';
+import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
+import {IERC20Detailed} from '../../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
import {IParaSwapAugustus} from './interfaces/IParaSwapAugustus.sol';
import {IParaSwapAugustusRegistry} from './interfaces/IParaSwapAugustusRegistry.sol';
import {BaseParaSwapAdapter} from './BaseParaSwapAdapter.sol';
diff --git a/src/periphery/contracts/adapters/paraswap/ParaSwapLiquiditySwapAdapter.sol b/src/contracts/extensions/paraswap-adapters/ParaSwapLiquiditySwapAdapter.sol
similarity index 94%
rename from src/periphery/contracts/adapters/paraswap/ParaSwapLiquiditySwapAdapter.sol
rename to src/contracts/extensions/paraswap-adapters/ParaSwapLiquiditySwapAdapter.sol
index 7852f16e..db855a33 100644
--- a/src/periphery/contracts/adapters/paraswap/ParaSwapLiquiditySwapAdapter.sol
+++ b/src/contracts/extensions/paraswap-adapters/ParaSwapLiquiditySwapAdapter.sol
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.10;
-import {IERC20Detailed} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol';
-import {IERC20WithPermit} from 'aave-v3-core/contracts/interfaces/IERC20WithPermit.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
-import {SafeERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/SafeERC20.sol';
-import {SafeMath} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/SafeMath.sol';
+import {IERC20Detailed} from '../../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
+import {IERC20WithPermit} from '../../interfaces/IERC20WithPermit.sol';
+import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
+import {SafeERC20} from '../../dependencies/openzeppelin/contracts/SafeERC20.sol';
+import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol';
import {BaseParaSwapSellAdapter} from './BaseParaSwapSellAdapter.sol';
import {IParaSwapAugustusRegistry} from './interfaces/IParaSwapAugustusRegistry.sol';
import {IParaSwapAugustus} from './interfaces/IParaSwapAugustus.sol';
diff --git a/src/periphery/contracts/adapters/paraswap/ParaSwapRepayAdapter.sol b/src/contracts/extensions/paraswap-adapters/ParaSwapRepayAdapter.sol
similarity index 90%
rename from src/periphery/contracts/adapters/paraswap/ParaSwapRepayAdapter.sol
rename to src/contracts/extensions/paraswap-adapters/ParaSwapRepayAdapter.sol
index f199b9ba..659aae7c 100644
--- a/src/periphery/contracts/adapters/paraswap/ParaSwapRepayAdapter.sol
+++ b/src/contracts/extensions/paraswap-adapters/ParaSwapRepayAdapter.sol
@@ -1,13 +1,13 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.10;
-import {DataTypes} from 'aave-v3-core/contracts/protocol/libraries/types/DataTypes.sol';
-import {IERC20Detailed} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol';
-import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
-import {IERC20WithPermit} from 'aave-v3-core/contracts/interfaces/IERC20WithPermit.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
-import {SafeERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/SafeERC20.sol';
-import {SafeMath} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/SafeMath.sol';
+import {DataTypes} from '../../protocol/libraries/types/DataTypes.sol';
+import {IERC20Detailed} from '../../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
+import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
+import {IERC20WithPermit} from '../../interfaces/IERC20WithPermit.sol';
+import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
+import {SafeERC20} from '../../dependencies/openzeppelin/contracts/SafeERC20.sol';
+import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol';
import {BaseParaSwapBuyAdapter} from './BaseParaSwapBuyAdapter.sol';
import {IParaSwapAugustusRegistry} from './interfaces/IParaSwapAugustusRegistry.sol';
import {IParaSwapAugustus} from './interfaces/IParaSwapAugustus.sol';
@@ -222,13 +222,13 @@ contract ParaSwapRepayAdapter is BaseParaSwapBuyAdapter, ReentrancyGuard {
uint256 debtRepayAmount,
address initiator
) private view returns (uint256) {
+ require(
+ DataTypes.InterestRateMode(rateMode) == DataTypes.InterestRateMode.VARIABLE,
+ 'INVALID_RATE_MODE'
+ );
DataTypes.ReserveDataLegacy memory debtReserveData = _getReserveData(address(debtAsset));
- address debtToken = DataTypes.InterestRateMode(rateMode) == DataTypes.InterestRateMode.STABLE
- ? debtReserveData.stableDebtTokenAddress
- : debtReserveData.variableDebtTokenAddress;
-
- uint256 currentDebt = IERC20(debtToken).balanceOf(initiator);
+ uint256 currentDebt = IERC20(debtReserveData.variableDebtTokenAddress).balanceOf(initiator);
if (buyAllBalanceOffset != 0) {
require(currentDebt <= debtRepayAmount, 'INSUFFICIENT_AMOUNT_TO_REPAY');
diff --git a/src/periphery/contracts/adapters/paraswap/ParaSwapWithdrawSwapAdapter.sol b/src/contracts/extensions/paraswap-adapters/ParaSwapWithdrawSwapAdapter.sol
similarity index 87%
rename from src/periphery/contracts/adapters/paraswap/ParaSwapWithdrawSwapAdapter.sol
rename to src/contracts/extensions/paraswap-adapters/ParaSwapWithdrawSwapAdapter.sol
index 499c7d6a..2522ee88 100644
--- a/src/periphery/contracts/adapters/paraswap/ParaSwapWithdrawSwapAdapter.sol
+++ b/src/contracts/extensions/paraswap-adapters/ParaSwapWithdrawSwapAdapter.sol
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.10;
-import {IERC20Detailed} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol';
-import {IERC20WithPermit} from 'aave-v3-core/contracts/interfaces/IERC20WithPermit.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
+import {IERC20Detailed} from '../../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
+import {IERC20WithPermit} from '../../interfaces/IERC20WithPermit.sol';
+import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
import {BaseParaSwapSellAdapter} from './BaseParaSwapSellAdapter.sol';
import {IParaSwapAugustusRegistry} from './interfaces/IParaSwapAugustusRegistry.sol';
-import {SafeERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/SafeERC20.sol';
+import {SafeERC20} from '../../dependencies/openzeppelin/contracts/SafeERC20.sol';
import {IParaSwapAugustus} from './interfaces/IParaSwapAugustus.sol';
import {ReentrancyGuard} from '../../dependencies/openzeppelin/ReentrancyGuard.sol';
diff --git a/src/periphery/contracts/adapters/paraswap/interfaces/IFeeClaimer.sol b/src/contracts/extensions/paraswap-adapters/interfaces/IFeeClaimer.sol
similarity index 97%
rename from src/periphery/contracts/adapters/paraswap/interfaces/IFeeClaimer.sol
rename to src/contracts/extensions/paraswap-adapters/interfaces/IFeeClaimer.sol
index 5fd9d59a..161bcd51 100644
--- a/src/periphery/contracts/adapters/paraswap/interfaces/IFeeClaimer.sol
+++ b/src/contracts/extensions/paraswap-adapters/interfaces/IFeeClaimer.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: ISC
pragma solidity ^0.8.0;
-import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
+import {IERC20} from '../../../dependencies/openzeppelin/contracts/IERC20.sol';
interface IFeeClaimer {
/**
diff --git a/src/periphery/contracts/adapters/paraswap/interfaces/IParaSwapAugustus.sol b/src/contracts/extensions/paraswap-adapters/interfaces/IParaSwapAugustus.sol
similarity index 100%
rename from src/periphery/contracts/adapters/paraswap/interfaces/IParaSwapAugustus.sol
rename to src/contracts/extensions/paraswap-adapters/interfaces/IParaSwapAugustus.sol
diff --git a/src/periphery/contracts/adapters/paraswap/interfaces/IParaSwapAugustusRegistry.sol b/src/contracts/extensions/paraswap-adapters/interfaces/IParaSwapAugustusRegistry.sol
similarity index 100%
rename from src/periphery/contracts/adapters/paraswap/interfaces/IParaSwapAugustusRegistry.sol
rename to src/contracts/extensions/paraswap-adapters/interfaces/IParaSwapAugustusRegistry.sol
diff --git a/src/periphery/contracts/static-a-token/ERC20AaveLMUpgradeable.sol b/src/contracts/extensions/static-a-token/ERC20AaveLMUpgradeable.sol
similarity index 99%
rename from src/periphery/contracts/static-a-token/ERC20AaveLMUpgradeable.sol
rename to src/contracts/extensions/static-a-token/ERC20AaveLMUpgradeable.sol
index 651c2fa0..71d52c59 100644
--- a/src/periphery/contracts/static-a-token/ERC20AaveLMUpgradeable.sol
+++ b/src/contracts/extensions/static-a-token/ERC20AaveLMUpgradeable.sol
@@ -6,7 +6,7 @@ import {IERC20} from 'openzeppelin-contracts/contracts/interfaces/IERC20.sol';
import {SafeERC20} from 'openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol';
import {SafeCast} from 'solidity-utils/contracts/oz-common/SafeCast.sol';
-import {IRewardsController} from '../rewards/interfaces/IRewardsController.sol';
+import {IRewardsController} from '../../rewards/interfaces/IRewardsController.sol';
import {IERC20AaveLM} from './interfaces/IERC20AaveLM.sol';
/**
@@ -45,6 +45,7 @@ abstract contract ERC20AaveLMUpgradeable is ERC20Upgradeable, IERC20AaveLM {
function __ERC20AaveLM_init(address referenceAsset_) internal onlyInitializing {
__ERC20AaveLM_init_unchained(referenceAsset_);
}
+
function __ERC20AaveLM_init_unchained(address referenceAsset_) internal onlyInitializing {
ERC20AaveLMStorage storage $ = _getERC20AaveLMStorage();
$._referenceAsset = referenceAsset_;
diff --git a/src/periphery/contracts/static-a-token/ERC4626StataTokenUpgradeable.sol b/src/contracts/extensions/static-a-token/ERC4626StataTokenUpgradeable.sol
similarity index 97%
rename from src/periphery/contracts/static-a-token/ERC4626StataTokenUpgradeable.sol
rename to src/contracts/extensions/static-a-token/ERC4626StataTokenUpgradeable.sol
index 2a2d0cdd..060fc135 100644
--- a/src/periphery/contracts/static-a-token/ERC4626StataTokenUpgradeable.sol
+++ b/src/contracts/extensions/static-a-token/ERC4626StataTokenUpgradeable.sol
@@ -5,9 +5,9 @@ import {ERC4626Upgradeable, Math, IERC4626} from 'openzeppelin-contracts-upgrade
import {SafeERC20, IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol';
import {IERC20Permit} from 'openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol';
-import {IPool, IPoolAddressesProvider} from '../../../core/contracts/interfaces/IPool.sol';
-import {IAaveOracle} from '../../../core/contracts/interfaces/IAaveOracle.sol';
-import {DataTypes, ReserveConfiguration} from '../../../core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
+import {IPool, IPoolAddressesProvider} from '../../interfaces/IPool.sol';
+import {IAaveOracle} from '../../interfaces/IAaveOracle.sol';
+import {DataTypes, ReserveConfiguration} from '../../protocol/libraries/configuration/ReserveConfiguration.sol';
import {IAToken} from './interfaces/IAToken.sol';
import {IERC4626StataToken} from './interfaces/IERC4626StataToken.sol';
diff --git a/src/periphery/contracts/static-a-token/README.md b/src/contracts/extensions/static-a-token/README.md
similarity index 100%
rename from src/periphery/contracts/static-a-token/README.md
rename to src/contracts/extensions/static-a-token/README.md
diff --git a/src/periphery/contracts/static-a-token/StataTokenFactory.sol b/src/contracts/extensions/static-a-token/StataTokenFactory.sol
similarity index 97%
rename from src/periphery/contracts/static-a-token/StataTokenFactory.sol
rename to src/contracts/extensions/static-a-token/StataTokenFactory.sol
index e7ba0929..5ca2bb28 100644
--- a/src/periphery/contracts/static-a-token/StataTokenFactory.sol
+++ b/src/contracts/extensions/static-a-token/StataTokenFactory.sol
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.10;
-import {IPool, DataTypes} from '../../../core/contracts/interfaces/IPool.sol';
import {IERC20Metadata} from 'solidity-utils/contracts/oz-common/interfaces/IERC20Metadata.sol';
import {ITransparentProxyFactory} from 'solidity-utils/contracts/transparent-proxy/interfaces/ITransparentProxyFactory.sol';
import {Initializable} from 'solidity-utils/contracts/transparent-proxy/Initializable.sol';
+import {IPool, DataTypes} from '../../../contracts/interfaces/IPool.sol';
import {StataTokenV2} from './StataTokenV2.sol';
import {IStataTokenFactory} from './interfaces/IStataTokenFactory.sol';
diff --git a/src/periphery/contracts/static-a-token/StataTokenV2.sol b/src/contracts/extensions/static-a-token/StataTokenV2.sol
similarity index 98%
rename from src/periphery/contracts/static-a-token/StataTokenV2.sol
rename to src/contracts/extensions/static-a-token/StataTokenV2.sol
index f3784053..f2af30b7 100644
--- a/src/periphery/contracts/static-a-token/StataTokenV2.sol
+++ b/src/contracts/extensions/static-a-token/StataTokenV2.sol
@@ -8,7 +8,7 @@ import {IRescuable, Rescuable} from 'solidity-utils/contracts/utils/Rescuable.so
import {IRescuableBase, RescuableBase} from 'solidity-utils/contracts/utils/RescuableBase.sol';
import {IERC20Permit} from '@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol';
-import {IACLManager} from '../../../core/contracts/interfaces/IACLManager.sol';
+import {IACLManager} from '../../../contracts/interfaces/IACLManager.sol';
import {ERC4626Upgradeable, ERC4626StataTokenUpgradeable, IPool, Math, IERC20} from './ERC4626StataTokenUpgradeable.sol';
import {ERC20AaveLMUpgradeable, IRewardsController} from './ERC20AaveLMUpgradeable.sol';
import {IStataTokenV2} from './interfaces/IStataTokenV2.sol';
diff --git a/src/periphery/contracts/static-a-token/inheritance.png b/src/contracts/extensions/static-a-token/inheritance.png
similarity index 100%
rename from src/periphery/contracts/static-a-token/inheritance.png
rename to src/contracts/extensions/static-a-token/inheritance.png
diff --git a/src/periphery/contracts/static-a-token/interfaces/IAToken.sol b/src/contracts/extensions/static-a-token/interfaces/IAToken.sol
similarity index 100%
rename from src/periphery/contracts/static-a-token/interfaces/IAToken.sol
rename to src/contracts/extensions/static-a-token/interfaces/IAToken.sol
diff --git a/src/periphery/contracts/static-a-token/interfaces/IERC20AaveLM.sol b/src/contracts/extensions/static-a-token/interfaces/IERC20AaveLM.sol
similarity index 100%
rename from src/periphery/contracts/static-a-token/interfaces/IERC20AaveLM.sol
rename to src/contracts/extensions/static-a-token/interfaces/IERC20AaveLM.sol
diff --git a/src/periphery/contracts/static-a-token/interfaces/IERC4626StataToken.sol b/src/contracts/extensions/static-a-token/interfaces/IERC4626StataToken.sol
similarity index 100%
rename from src/periphery/contracts/static-a-token/interfaces/IERC4626StataToken.sol
rename to src/contracts/extensions/static-a-token/interfaces/IERC4626StataToken.sol
diff --git a/src/periphery/contracts/static-a-token/interfaces/IStataTokenFactory.sol b/src/contracts/extensions/static-a-token/interfaces/IStataTokenFactory.sol
similarity index 100%
rename from src/periphery/contracts/static-a-token/interfaces/IStataTokenFactory.sol
rename to src/contracts/extensions/static-a-token/interfaces/IStataTokenFactory.sol
diff --git a/src/periphery/contracts/static-a-token/interfaces/IStataTokenV2.sol b/src/contracts/extensions/static-a-token/interfaces/IStataTokenV2.sol
similarity index 100%
rename from src/periphery/contracts/static-a-token/interfaces/IStataTokenV2.sol
rename to src/contracts/extensions/static-a-token/interfaces/IStataTokenV2.sol
diff --git a/src/periphery/contracts/v3-config-engine/AaveV3ConfigEngine.sol b/src/contracts/extensions/v3-config-engine/AaveV3ConfigEngine.sol
similarity index 94%
rename from src/periphery/contracts/v3-config-engine/AaveV3ConfigEngine.sol
rename to src/contracts/extensions/v3-config-engine/AaveV3ConfigEngine.sol
index 25b07174..3c9df057 100644
--- a/src/periphery/contracts/v3-config-engine/AaveV3ConfigEngine.sol
+++ b/src/contracts/extensions/v3-config-engine/AaveV3ConfigEngine.sol
@@ -30,7 +30,6 @@ contract AaveV3ConfigEngine is IAaveV3ConfigEngine {
IAaveOracle public immutable ORACLE;
address public immutable ATOKEN_IMPL;
address public immutable VTOKEN_IMPL;
- address public immutable STOKEN_IMPL;
address public immutable REWARDS_CONTROLLER;
address public immutable COLLECTOR;
address public immutable DEFAULT_INTEREST_RATE_STRATEGY;
@@ -47,14 +46,12 @@ contract AaveV3ConfigEngine is IAaveV3ConfigEngine {
* @dev Constructor.
* @param aTokenImpl The address of default aToken implementation.
* @param vTokenImpl The address of default variable debt token implementation.
- * @param sTokenImpl The address of default stable debt token implementation.
* @param engineConstants The struct containing all the engine constants.
* @param engineLibraries The struct containing the addresses of stateless libraries containing the engine logic.
*/
constructor(
address aTokenImpl,
address vTokenImpl,
- address sTokenImpl,
EngineConstants memory engineConstants,
EngineLibraries memory engineLibraries
) {
@@ -68,10 +65,7 @@ contract AaveV3ConfigEngine is IAaveV3ConfigEngine {
'ONLY_NONZERO_ENGINE_CONSTANTS'
);
- require(
- aTokenImpl != address(0) && vTokenImpl != address(0) && sTokenImpl != address(0),
- 'ONLY_NONZERO_TOKEN_IMPLS'
- );
+ require(aTokenImpl != address(0) && vTokenImpl != address(0), 'ONLY_NONZERO_TOKEN_IMPLS');
require(
engineLibraries.borrowEngine != address(0) &&
@@ -84,7 +78,6 @@ contract AaveV3ConfigEngine is IAaveV3ConfigEngine {
ATOKEN_IMPL = aTokenImpl;
VTOKEN_IMPL = vTokenImpl;
- STOKEN_IMPL = sTokenImpl;
POOL = engineConstants.pool;
POOL_CONFIGURATOR = engineConstants.poolConfigurator;
ORACLE = engineConstants.oracle;
@@ -108,11 +101,7 @@ contract AaveV3ConfigEngine is IAaveV3ConfigEngine {
for (uint256 i = 0; i < listings.length; i++) {
customListings[i] = ListingWithCustomImpl({
base: listings[i],
- implementations: TokenImplementations({
- aToken: ATOKEN_IMPL,
- vToken: VTOKEN_IMPL,
- sToken: STOKEN_IMPL
- })
+ implementations: TokenImplementations({aToken: ATOKEN_IMPL, vToken: VTOKEN_IMPL})
});
}
diff --git a/src/periphery/contracts/v3-config-engine/AaveV3Payload.sol b/src/contracts/extensions/v3-config-engine/AaveV3Payload.sol
similarity index 93%
rename from src/periphery/contracts/v3-config-engine/AaveV3Payload.sol
rename to src/contracts/extensions/v3-config-engine/AaveV3Payload.sol
index 57ed5837..50ecc07a 100644
--- a/src/periphery/contracts/v3-config-engine/AaveV3Payload.sol
+++ b/src/contracts/extensions/v3-config-engine/AaveV3Payload.sol
@@ -2,7 +2,7 @@
pragma solidity ^0.8.0;
import {Address} from 'solidity-utils/contracts/oz-common/Address.sol';
-import {WadRayMath} from '../../../core/contracts/protocol/libraries/math/WadRayMath.sol';
+import {WadRayMath} from '../../protocol/libraries/math/WadRayMath.sol';
import {IAaveV3ConfigEngine as IEngine} from './IAaveV3ConfigEngine.sol';
import {EngineFlags} from './EngineFlags.sol';
@@ -18,7 +18,7 @@ import {EngineFlags} from './EngineFlags.sol';
* - Updates of caps (supply cap, borrow cap).
* - Updates of price feeds
* - Updates of interest rate strategies
- * - Updates of borrow parameters (flashloanable, stableRateModeEnabled, borrowableInIsolation, withSiloedBorrowing, reserveFactor)
+ * - Updates of borrow parameters (flashloanable, borrowableInIsolation, withSiloedBorrowing, reserveFactor)
* - Updates of collateral parameters (ltv, liq threshold, liq bonus, liq protocol fee, debt ceiling)
* - Updates of emode category parameters (ltv, liq threshold, liq bonus, price source, label)
* - Updates of emode category of assets (e-mode id)
@@ -49,7 +49,7 @@ abstract contract AaveV3Payload {
IEngine.BorrowUpdate[] memory borrows = borrowsUpdates();
IEngine.RateStrategyUpdate[] memory rates = rateStrategiesUpdates();
IEngine.PriceFeedUpdate[] memory priceFeeds = priceFeedsUpdates();
- IEngine.AssetEModeUpdate[] memory assetsEMode = assetsEModeUpdates();
+ IEngine.AssetEModeUpdate[] memory assetsEModes = assetsEModeUpdates();
IEngine.CapsUpdate[] memory caps = capsUpdates();
if (eModeCategories.length != 0) {
@@ -98,9 +98,9 @@ abstract contract AaveV3Payload {
);
}
- if (assetsEMode.length != 0) {
+ if (assetsEModes.length != 0) {
address(CONFIG_ENGINE).functionDelegateCall(
- abi.encodeWithSelector(CONFIG_ENGINE.updateAssetsEMode.selector, assetsEMode)
+ abi.encodeWithSelector(CONFIG_ENGINE.updateAssetsEMode.selector, assetsEModes)
);
}
@@ -151,7 +151,7 @@ abstract contract AaveV3Payload {
returns (IEngine.EModeCategoryUpdate[] memory)
{}
- /// @dev to be defined in the child with a list of assets for which eMode categories to update
+ /// @dev to be defined in the child with a list of assets for which eMode collateral to update
function assetsEModeUpdates() public view virtual returns (IEngine.AssetEModeUpdate[] memory) {}
/// @dev to be defined in the child with a list of set of parameters of rate strategies
diff --git a/src/periphery/contracts/v3-config-engine/EngineFlags.sol b/src/contracts/extensions/v3-config-engine/EngineFlags.sol
similarity index 100%
rename from src/periphery/contracts/v3-config-engine/EngineFlags.sol
rename to src/contracts/extensions/v3-config-engine/EngineFlags.sol
diff --git a/src/periphery/contracts/v3-config-engine/IAaveV3ConfigEngine.sol b/src/contracts/extensions/v3-config-engine/IAaveV3ConfigEngine.sol
similarity index 91%
rename from src/periphery/contracts/v3-config-engine/IAaveV3ConfigEngine.sol
rename to src/contracts/extensions/v3-config-engine/IAaveV3ConfigEngine.sol
index ddbcdf13..500d7eb7 100644
--- a/src/periphery/contracts/v3-config-engine/IAaveV3ConfigEngine.sol
+++ b/src/contracts/extensions/v3-config-engine/IAaveV3ConfigEngine.sol
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
-import {IPool} from '../../../core/contracts/interfaces/IPool.sol';
-import {IPoolConfigurator} from '../../../core/contracts/interfaces/IPoolConfigurator.sol';
-import {IAaveOracle} from '../../../core/contracts/interfaces/IAaveOracle.sol';
-import {IDefaultInterestRateStrategyV2} from '../../../core/contracts/interfaces/IDefaultInterestRateStrategyV2.sol';
+import {IPool} from '../../interfaces/IPool.sol';
+import {IPoolConfigurator} from '../../interfaces/IPoolConfigurator.sol';
+import {IAaveOracle} from '../../interfaces/IAaveOracle.sol';
+import {IDefaultInterestRateStrategyV2} from '../../interfaces/IDefaultInterestRateStrategyV2.sol';
/// @dev Examples here assume the usage of the `AaveV3Payload` base contracts
/// contained in this same repository
@@ -67,7 +67,6 @@ interface IAaveV3ConfigEngine {
* }),
* enabledToBorrow: EngineFlags.ENABLED,
* flashloanable: EngineFlags.ENABLED,
- * stableRateModeEnabled: EngineFlags.DISABLED,
* borrowableInIsolation: EngineFlags.ENABLED,
* withSiloedBorrowing:, EngineFlags.DISABLED,
* ltv: 70_50, // 70.5%
@@ -87,7 +86,6 @@ interface IAaveV3ConfigEngine {
address priceFeed;
InterestRateInputData rateStrategyParams; // Mandatory, no matter if enabled for borrowing or not
uint256 enabledToBorrow;
- uint256 stableRateModeEnabled; // Only considered is enabledToBorrow == EngineFlags.ENABLED (true)
uint256 borrowableInIsolation; // Only considered is enabledToBorrow == EngineFlags.ENABLED (true)
uint256 withSiloedBorrowing; // Only considered if enabledToBorrow == EngineFlags.ENABLED (true)
uint256 flashloanable; // Independent from enabled to borrow: an asset can be flashloanble and not enabled to borrow
@@ -99,7 +97,6 @@ interface IAaveV3ConfigEngine {
uint256 borrowCap; // If passing any value distinct to EngineFlags.KEEP_CURRENT, always configured
uint256 debtCeiling; // Only considered if liqThreshold > 0
uint256 liqProtocolFee; // Only considered if liqThreshold > 0
- uint8 eModeCategory; // If `O`, no eMode category will be set
}
struct RepackedListings {
@@ -108,7 +105,6 @@ interface IAaveV3ConfigEngine {
BorrowUpdate[] borrowsUpdates;
CollateralUpdate[] collateralsUpdates;
PriceFeedUpdate[] priceFeedsUpdates;
- AssetEModeUpdate[] assetsEModeUpdates;
CapsUpdate[] capsUpdates;
IDefaultInterestRateStrategyV2.InterestRateData[] rates;
}
@@ -116,7 +112,6 @@ interface IAaveV3ConfigEngine {
struct TokenImplementations {
address aToken;
address vToken;
- address sToken;
}
struct ListingWithCustomImpl {
@@ -176,7 +171,6 @@ interface IAaveV3ConfigEngine {
* asset: AaveV3EthereumAssets.AAVE_UNDERLYING,
* enabledToBorrow: EngineFlags.ENABLED,
* flashloanable: EngineFlags.KEEP_CURRENT,
- * stableRateModeEnabled: EngineFlags.KEEP_CURRENT,
* borrowableInIsolation: EngineFlags.KEEP_CURRENT,
* withSiloedBorrowing: EngineFlags.KEEP_CURRENT,
* reserveFactor: 15_00, // 15%
@@ -186,7 +180,6 @@ interface IAaveV3ConfigEngine {
address asset;
uint256 enabledToBorrow;
uint256 flashloanable;
- uint256 stableRateModeEnabled;
uint256 borrowableInIsolation;
uint256 withSiloedBorrowing;
uint256 reserveFactor;
@@ -197,11 +190,15 @@ interface IAaveV3ConfigEngine {
* AssetEModeUpdate({
* asset: AaveV3EthereumAssets.rETH_UNDERLYING,
* eModeCategory: 1, // ETH correlated
+ * borrowable: EngineFlags.ENABLED,
+ * collateral: EngineFlags.KEEP_CURRENT,
* })
*/
struct AssetEModeUpdate {
address asset;
uint8 eModeCategory;
+ uint256 borrowable;
+ uint256 collateral;
}
/**
@@ -211,7 +208,6 @@ interface IAaveV3ConfigEngine {
* ltv: 60_00,
* liqThreshold: 70_00,
* liqBonus: EngineFlags.KEEP_CURRENT,
- * priceSource: EngineFlags.KEEP_CURRENT_ADDRESS,
* label: EngineFlags.KEEP_CURRENT_STRING
* })
*/
@@ -220,7 +216,6 @@ interface IAaveV3ConfigEngine {
uint256 ltv;
uint256 liqThreshold;
uint256 liqBonus;
- address priceSource;
string label;
}
@@ -308,8 +303,9 @@ interface IAaveV3ConfigEngine {
function updateEModeCategories(EModeCategoryUpdate[] memory updates) external;
/**
- * @notice Performs an update of the e-mode category of the assets, in the Aave pool configured in this engine instance
- * @param updates `AssetEModeUpdate[]` list of declarative updates containing the new parameters
+ * @notice Performs an update of the e-mode category.
+ * Sets a specified asset collateral and/or borrowable, in the Aave pool configured in this engine instance
+ * @param updates `EModeCollateralUpdate[]` list of declarative updates containing the new parameters
* More information on the documentation of the struct.
*/
function updateAssetsEMode(AssetEModeUpdate[] calldata updates) external;
@@ -326,8 +322,6 @@ interface IAaveV3ConfigEngine {
function VTOKEN_IMPL() external view returns (address);
- function STOKEN_IMPL() external view returns (address);
-
function REWARDS_CONTROLLER() external view returns (address);
function COLLECTOR() external view returns (address);
diff --git a/src/periphery/contracts/v3-config-engine/README.md b/src/contracts/extensions/v3-config-engine/README.md
similarity index 100%
rename from src/periphery/contracts/v3-config-engine/README.md
rename to src/contracts/extensions/v3-config-engine/README.md
diff --git a/src/periphery/contracts/v3-config-engine/libraries/BorrowEngine.sol b/src/contracts/extensions/v3-config-engine/libraries/BorrowEngine.sol
similarity index 76%
rename from src/periphery/contracts/v3-config-engine/libraries/BorrowEngine.sol
rename to src/contracts/extensions/v3-config-engine/libraries/BorrowEngine.sol
index 4fa237b6..bbe2d8f2 100644
--- a/src/periphery/contracts/v3-config-engine/libraries/BorrowEngine.sol
+++ b/src/contracts/extensions/v3-config-engine/libraries/BorrowEngine.sol
@@ -1,9 +1,9 @@
-// SPDX-License-Identifier: MIT
+// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.18;
import {EngineFlags} from '../EngineFlags.sol';
-import {DataTypes} from '../../../../core/contracts/protocol/libraries/types/DataTypes.sol';
-import {ReserveConfiguration} from '../../../../core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
+import {DataTypes} from '../../../protocol/libraries/types/DataTypes.sol';
+import {ReserveConfiguration} from '../../../protocol/libraries/configuration/ReserveConfiguration.sol';
import {IAaveV3ConfigEngine as IEngine, IPoolConfigurator, IPool} from '../IAaveV3ConfigEngine.sol';
library BorrowEngine {
@@ -30,19 +30,10 @@ library BorrowEngine {
EngineFlags.toBool(updates[i].enabledToBorrow)
);
} else {
- (, , bool borrowingEnabled, , ) = pool.getConfiguration(updates[i].asset).getFlags();
+ (, , bool borrowingEnabled, ) = pool.getConfiguration(updates[i].asset).getFlags();
updates[i].enabledToBorrow = EngineFlags.fromBool(borrowingEnabled);
}
- if (updates[i].enabledToBorrow == EngineFlags.ENABLED) {
- if (updates[i].stableRateModeEnabled != EngineFlags.KEEP_CURRENT) {
- poolConfigurator.setReserveStableRateBorrowing(
- updates[i].asset,
- EngineFlags.toBool(updates[i].stableRateModeEnabled)
- );
- }
- }
-
if (updates[i].borrowableInIsolation != EngineFlags.KEEP_CURRENT) {
poolConfigurator.setBorrowableInIsolation(
updates[i].asset,
diff --git a/src/periphery/contracts/v3-config-engine/libraries/CapsEngine.sol b/src/contracts/extensions/v3-config-engine/libraries/CapsEngine.sol
similarity index 96%
rename from src/periphery/contracts/v3-config-engine/libraries/CapsEngine.sol
rename to src/contracts/extensions/v3-config-engine/libraries/CapsEngine.sol
index b06c61fc..084ebc26 100644
--- a/src/periphery/contracts/v3-config-engine/libraries/CapsEngine.sol
+++ b/src/contracts/extensions/v3-config-engine/libraries/CapsEngine.sol
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: MIT
+// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.18;
import {EngineFlags} from '../EngineFlags.sol';
diff --git a/src/periphery/contracts/v3-config-engine/libraries/CollateralEngine.sol b/src/contracts/extensions/v3-config-engine/libraries/CollateralEngine.sol
similarity index 90%
rename from src/periphery/contracts/v3-config-engine/libraries/CollateralEngine.sol
rename to src/contracts/extensions/v3-config-engine/libraries/CollateralEngine.sol
index 73e9a7f0..3bd70a3c 100644
--- a/src/periphery/contracts/v3-config-engine/libraries/CollateralEngine.sol
+++ b/src/contracts/extensions/v3-config-engine/libraries/CollateralEngine.sol
@@ -1,10 +1,10 @@
-// SPDX-License-Identifier: MIT
+// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.18;
-import {DataTypes} from '../../../../core/contracts/protocol/libraries/types/DataTypes.sol';
-import {ReserveConfiguration} from '../../../../core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
+import {DataTypes} from '../../../protocol/libraries/types/DataTypes.sol';
+import {ReserveConfiguration} from '../../../protocol/libraries/configuration/ReserveConfiguration.sol';
import {IAaveV3ConfigEngine as IEngine, IPoolConfigurator, IPool} from '../IAaveV3ConfigEngine.sol';
-import {PercentageMath} from '../../../../core/contracts/protocol/libraries/math/PercentageMath.sol';
+import {PercentageMath} from '../../../protocol/libraries/math/PercentageMath.sol';
import {EngineFlags} from '../EngineFlags.sol';
library CollateralEngine {
@@ -44,7 +44,6 @@ library CollateralEngine {
uint256 currentLiqThreshold,
uint256 currentLiqBonus,
,
- ,
) = configuration.getParams();
diff --git a/src/periphery/contracts/v3-config-engine/libraries/EModeEngine.sol b/src/contracts/extensions/v3-config-engine/libraries/EModeEngine.sol
similarity index 76%
rename from src/periphery/contracts/v3-config-engine/libraries/EModeEngine.sol
rename to src/contracts/extensions/v3-config-engine/libraries/EModeEngine.sol
index 5ccf4231..df2f72ab 100644
--- a/src/periphery/contracts/v3-config-engine/libraries/EModeEngine.sol
+++ b/src/contracts/extensions/v3-config-engine/libraries/EModeEngine.sol
@@ -1,10 +1,10 @@
-// SPDX-License-Identifier: MIT
+// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.18;
import {EngineFlags} from '../EngineFlags.sol';
-import {DataTypes} from '../../../../core/contracts/protocol/libraries/types/DataTypes.sol';
+import {DataTypes} from '../../../protocol/libraries/types/DataTypes.sol';
import {SafeCast} from 'solidity-utils/contracts/oz-common/SafeCast.sol';
-import {PercentageMath} from '../../../../core/contracts/protocol/libraries/math/PercentageMath.sol';
+import {PercentageMath} from '../../../protocol/libraries/math/PercentageMath.sol';
import {IAaveV3ConfigEngine as IEngine, IPoolConfigurator, IPool} from '../IAaveV3ConfigEngine.sol';
library EModeEngine {
@@ -34,8 +34,19 @@ library EModeEngine {
IEngine.AssetEModeUpdate[] memory updates
) internal {
for (uint256 i = 0; i < updates.length; i++) {
- if (updates[i].eModeCategory != EngineFlags.KEEP_CURRENT) {
- poolConfigurator.setAssetEModeCategory(updates[i].asset, updates[i].eModeCategory);
+ if (updates[i].collateral != EngineFlags.KEEP_CURRENT) {
+ poolConfigurator.setAssetCollateralInEMode(
+ updates[i].asset,
+ updates[i].eModeCategory,
+ EngineFlags.toBool(updates[i].collateral)
+ );
+ }
+ if (updates[i].borrowable != EngineFlags.KEEP_CURRENT) {
+ poolConfigurator.setAssetBorrowableInEMode(
+ updates[i].asset,
+ updates[i].eModeCategory,
+ EngineFlags.toBool(updates[i].borrowable)
+ );
}
}
}
@@ -49,44 +60,38 @@ library EModeEngine {
bool atLeastOneKeepCurrent = updates[i].ltv == EngineFlags.KEEP_CURRENT ||
updates[i].liqThreshold == EngineFlags.KEEP_CURRENT ||
updates[i].liqBonus == EngineFlags.KEEP_CURRENT ||
- updates[i].priceSource == EngineFlags.KEEP_CURRENT_ADDRESS ||
keccak256(abi.encode(updates[i].label)) ==
keccak256(abi.encode(EngineFlags.KEEP_CURRENT_STRING));
bool notAllKeepCurrent = updates[i].ltv != EngineFlags.KEEP_CURRENT ||
updates[i].liqThreshold != EngineFlags.KEEP_CURRENT ||
updates[i].liqBonus != EngineFlags.KEEP_CURRENT ||
- updates[i].priceSource != EngineFlags.KEEP_CURRENT_ADDRESS ||
keccak256(abi.encode(updates[i].label)) !=
keccak256(abi.encode(EngineFlags.KEEP_CURRENT_STRING));
if (notAllKeepCurrent && atLeastOneKeepCurrent) {
- DataTypes.EModeCategory memory configuration = pool.getEModeCategoryData(
+ DataTypes.CollateralConfig memory cfg = pool.getEModeCategoryCollateralConfig(
updates[i].eModeCategory
);
if (updates[i].ltv == EngineFlags.KEEP_CURRENT) {
- updates[i].ltv = configuration.ltv;
+ updates[i].ltv = cfg.ltv;
}
if (updates[i].liqThreshold == EngineFlags.KEEP_CURRENT) {
- updates[i].liqThreshold = configuration.liquidationThreshold;
+ updates[i].liqThreshold = cfg.liquidationThreshold;
}
if (updates[i].liqBonus == EngineFlags.KEEP_CURRENT) {
// Subtracting 100_00 to be consistent with the engine as 100_00 gets added while setting the liqBonus
- updates[i].liqBonus = configuration.liquidationBonus - 100_00;
- }
-
- if (updates[i].priceSource == EngineFlags.KEEP_CURRENT_ADDRESS) {
- updates[i].priceSource = configuration.priceSource;
+ updates[i].liqBonus = cfg.liquidationBonus - 100_00;
}
if (
keccak256(abi.encode(updates[i].label)) ==
keccak256(abi.encode(EngineFlags.KEEP_CURRENT_STRING))
) {
- updates[i].label = configuration.label;
+ updates[i].label = pool.getEModeCategoryLabel(updates[i].eModeCategory);
}
}
@@ -104,7 +109,6 @@ library EModeEngine {
// For reference, this is to simplify the interaction with the Aave protocol,
// as there the definition is as e.g. 105% (5% bonus for liquidators)
(100_00 + updates[i].liqBonus).toUint16(),
- updates[i].priceSource,
updates[i].label
);
}
diff --git a/src/periphery/contracts/v3-config-engine/libraries/ListingEngine.sol b/src/contracts/extensions/v3-config-engine/libraries/ListingEngine.sol
similarity index 82%
rename from src/periphery/contracts/v3-config-engine/libraries/ListingEngine.sol
rename to src/contracts/extensions/v3-config-engine/libraries/ListingEngine.sol
index 4e1e8a7f..29d98807 100644
--- a/src/periphery/contracts/v3-config-engine/libraries/ListingEngine.sol
+++ b/src/contracts/extensions/v3-config-engine/libraries/ListingEngine.sol
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: MIT
+// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.18;
import {IAaveV3ConfigEngine as IEngine, IPoolConfigurator, IPool, IDefaultInterestRateStrategyV2} from '../IAaveV3ConfigEngine.sol';
@@ -7,9 +7,9 @@ import {CapsEngine} from './CapsEngine.sol';
import {BorrowEngine} from './BorrowEngine.sol';
import {CollateralEngine} from './CollateralEngine.sol';
import {EModeEngine} from './EModeEngine.sol';
-import {ConfiguratorInputTypes} from '../../../../core/contracts/protocol/libraries/types/ConfiguratorInputTypes.sol';
+import {ConfiguratorInputTypes} from '../../../protocol/libraries/types/ConfiguratorInputTypes.sol';
import {Address} from 'solidity-utils/contracts/oz-common/Address.sol';
-import {SafeCast} from '../../../../core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol';
+import {SafeCast} from '../../../dependencies/openzeppelin/contracts/SafeCast.sol';
library ListingEngine {
using Address for address;
@@ -67,16 +67,6 @@ library ListingEngine {
repacked.collateralsUpdates
)
);
-
- // For an asset listing we only update the e-mode category id for the asset and do not make changes
- // to the e-mode category configuration
- engineLibraries.eModeEngine.functionDelegateCall(
- abi.encodeWithSelector(
- EModeEngine.executeAssetsEModeUpdate.selector,
- engineConstants,
- repacked.assetsEModeUpdates
- )
- );
}
function _repackListing(
@@ -90,9 +80,6 @@ library ListingEngine {
IEngine.PriceFeedUpdate[] memory priceFeedsUpdates = new IEngine.PriceFeedUpdate[](
listings.length
);
- IEngine.AssetEModeUpdate[] memory assetsEModeUpdates = new IEngine.AssetEModeUpdate[](
- listings.length
- );
IEngine.CapsUpdate[] memory capsUpdates = new IEngine.CapsUpdate[](listings.length);
IEngine.Basic[] memory basics = new IEngine.Basic[](listings.length);
@@ -114,7 +101,6 @@ library ListingEngine {
asset: listings[i].base.asset,
enabledToBorrow: listings[i].base.enabledToBorrow,
flashloanable: listings[i].base.flashloanable,
- stableRateModeEnabled: listings[i].base.stableRateModeEnabled,
borrowableInIsolation: listings[i].base.borrowableInIsolation,
withSiloedBorrowing: listings[i].base.withSiloedBorrowing,
reserveFactor: listings[i].base.reserveFactor
@@ -142,10 +128,6 @@ library ListingEngine {
variableRateSlope1: listings[i].base.rateStrategyParams.variableRateSlope1.toUint32(),
variableRateSlope2: listings[i].base.rateStrategyParams.variableRateSlope2.toUint32()
});
- assetsEModeUpdates[i] = IEngine.AssetEModeUpdate({
- asset: listings[i].base.asset,
- eModeCategory: listings[i].base.eModeCategory
- });
}
return
@@ -155,7 +137,6 @@ library ListingEngine {
borrowsUpdates,
collateralsUpdates,
priceFeedsUpdates,
- assetsEModeUpdates,
capsUpdates,
rates
);
@@ -178,7 +159,6 @@ library ListingEngine {
for (uint256 i = 0; i < ids.length; i++) {
initReserveInputs[i] = ConfiguratorInputTypes.InitReserveInput({
aTokenImpl: basics[i].implementations.aToken,
- stableDebtTokenImpl: basics[i].implementations.sToken,
variableDebtTokenImpl: basics[i].implementations.vToken,
interestRateStrategyAddress: rateStrategy,
interestRateData: abi.encode(rates[i]),
@@ -199,17 +179,6 @@ library ListingEngine {
context.networkAbbreviation,
basics[i].assetSymbol
),
- stableDebtTokenName: string.concat(
- 'Aave ',
- context.networkName,
- ' Stable Debt ',
- basics[i].assetSymbol
- ),
- stableDebtTokenSymbol: string.concat(
- 'stableDebt',
- context.networkAbbreviation,
- basics[i].assetSymbol
- ),
params: bytes('')
});
}
diff --git a/src/periphery/contracts/v3-config-engine/libraries/PriceFeedEngine.sol b/src/contracts/extensions/v3-config-engine/libraries/PriceFeedEngine.sol
similarity index 88%
rename from src/periphery/contracts/v3-config-engine/libraries/PriceFeedEngine.sol
rename to src/contracts/extensions/v3-config-engine/libraries/PriceFeedEngine.sol
index d7186082..75cc49f4 100644
--- a/src/periphery/contracts/v3-config-engine/libraries/PriceFeedEngine.sol
+++ b/src/contracts/extensions/v3-config-engine/libraries/PriceFeedEngine.sol
@@ -1,8 +1,8 @@
-// SPDX-License-Identifier: MIT
+// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.18;
import {IAaveV3ConfigEngine as IEngine, IAaveOracle} from '../IAaveV3ConfigEngine.sol';
-import {IEACAggregatorProxy} from '../../../../periphery/contracts/misc/interfaces/IEACAggregatorProxy.sol';
+import {IEACAggregatorProxy} from '../../../helpers/interfaces/IEACAggregatorProxy.sol';
library PriceFeedEngine {
function executePriceFeedsUpdate(
diff --git a/src/periphery/contracts/v3-config-engine/libraries/RateEngine.sol b/src/contracts/extensions/v3-config-engine/libraries/RateEngine.sol
similarity index 93%
rename from src/periphery/contracts/v3-config-engine/libraries/RateEngine.sol
rename to src/contracts/extensions/v3-config-engine/libraries/RateEngine.sol
index db9c37d3..8ae88e2b 100644
--- a/src/periphery/contracts/v3-config-engine/libraries/RateEngine.sol
+++ b/src/contracts/extensions/v3-config-engine/libraries/RateEngine.sol
@@ -1,8 +1,8 @@
-// SPDX-License-Identifier: MIT
+// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.18;
-import {IDefaultInterestRateStrategyV2} from '../../../../core/contracts/interfaces/IDefaultInterestRateStrategyV2.sol';
-import {SafeCast} from '../../../../core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol';
+import {IDefaultInterestRateStrategyV2} from '../../../interfaces/IDefaultInterestRateStrategyV2.sol';
+import {SafeCast} from '../../../dependencies/openzeppelin/contracts/SafeCast.sol';
import {EngineFlags} from '../EngineFlags.sol';
import {IAaveV3ConfigEngine as IEngine, IPoolConfigurator} from '../IAaveV3ConfigEngine.sol';
diff --git a/src/core/contracts/misc/AaveProtocolDataProvider.sol b/src/contracts/helpers/AaveProtocolDataProvider.sol
similarity index 86%
rename from src/core/contracts/misc/AaveProtocolDataProvider.sol
rename to src/contracts/helpers/AaveProtocolDataProvider.sol
index 4db9441b..671b658b 100644
--- a/src/core/contracts/misc/AaveProtocolDataProvider.sol
+++ b/src/contracts/helpers/AaveProtocolDataProvider.sol
@@ -7,7 +7,6 @@ import {UserConfiguration} from '../protocol/libraries/configuration/UserConfigu
import {DataTypes} from '../protocol/libraries/types/DataTypes.sol';
import {WadRayMath} from '../protocol/libraries/math/WadRayMath.sol';
import {IPoolAddressesProvider} from '../interfaces/IPoolAddressesProvider.sol';
-import {IStableDebtToken} from '../interfaces/IStableDebtToken.sol';
import {IVariableDebtToken} from '../interfaces/IVariableDebtToken.sol';
import {IPool} from '../interfaces/IPool.sol';
import {IPoolDataProvider} from '../interfaces/IPoolDataProvider.sol';
@@ -96,19 +95,15 @@ contract AaveProtocolDataProvider is IPoolDataProvider {
DataTypes.ReserveConfigurationMap memory configuration = IPool(ADDRESSES_PROVIDER.getPool())
.getConfiguration(asset);
- (ltv, liquidationThreshold, liquidationBonus, decimals, reserveFactor, ) = configuration
+ (ltv, liquidationThreshold, liquidationBonus, decimals, reserveFactor) = configuration
.getParams();
- (isActive, isFrozen, borrowingEnabled, stableBorrowRateEnabled, ) = configuration.getFlags();
+ (isActive, isFrozen, borrowingEnabled, ) = configuration.getFlags();
- usageAsCollateralEnabled = liquidationThreshold != 0;
- }
+ // @notice all stable debt related parameters deprecated in v3.2.0
+ stableBorrowRateEnabled = false;
- /// @inheritdoc IPoolDataProvider
- function getReserveEModeCategory(address asset) external view override returns (uint256) {
- DataTypes.ReserveConfigurationMap memory configuration = IPool(ADDRESSES_PROVIDER.getPool())
- .getConfiguration(asset);
- return configuration.getEModeCategory();
+ usageAsCollateralEnabled = liquidationThreshold != 0;
}
/// @inheritdoc IPoolDataProvider
@@ -120,7 +115,7 @@ contract AaveProtocolDataProvider is IPoolDataProvider {
/// @inheritdoc IPoolDataProvider
function getPaused(address asset) external view override returns (bool isPaused) {
- (, , , , isPaused) = IPool(ADDRESSES_PROVIDER.getPool()).getConfiguration(asset).getFlags();
+ (, , , isPaused) = IPool(ADDRESSES_PROVIDER.getPool()).getConfiguration(asset).getFlags();
}
/// @inheritdoc IPoolDataProvider
@@ -174,16 +169,17 @@ contract AaveProtocolDataProvider is IPoolDataProvider {
asset
);
+ // @notice all stable debt related parameters deprecated in v3.2.0
return (
reserve.unbacked,
reserve.accruedToTreasury,
IERC20Detailed(reserve.aTokenAddress).totalSupply(),
- IERC20Detailed(reserve.stableDebtTokenAddress).totalSupply(),
+ 0,
IERC20Detailed(reserve.variableDebtTokenAddress).totalSupply(),
reserve.currentLiquidityRate,
reserve.currentVariableBorrowRate,
- reserve.currentStableBorrowRate,
- IStableDebtToken(reserve.stableDebtTokenAddress).getAverageStableRate(),
+ 0,
+ 0,
reserve.liquidityIndex,
reserve.variableBorrowIndex,
reserve.lastUpdateTimestamp
@@ -203,9 +199,7 @@ contract AaveProtocolDataProvider is IPoolDataProvider {
DataTypes.ReserveDataLegacy memory reserve = IPool(ADDRESSES_PROVIDER.getPool()).getReserveData(
asset
);
- return
- IERC20Detailed(reserve.stableDebtTokenAddress).totalSupply() +
- IERC20Detailed(reserve.variableDebtTokenAddress).totalSupply();
+ return IERC20Detailed(reserve.variableDebtTokenAddress).totalSupply();
}
/// @inheritdoc IPoolDataProvider
@@ -237,14 +231,12 @@ contract AaveProtocolDataProvider is IPoolDataProvider {
currentATokenBalance = IERC20Detailed(reserve.aTokenAddress).balanceOf(user);
currentVariableDebt = IERC20Detailed(reserve.variableDebtTokenAddress).balanceOf(user);
- currentStableDebt = IERC20Detailed(reserve.stableDebtTokenAddress).balanceOf(user);
- principalStableDebt = IStableDebtToken(reserve.stableDebtTokenAddress).principalBalanceOf(user);
+
+ // @notice all stable debt related parameters deprecated in v3.2.0
+ currentStableDebt = principalStableDebt = stableBorrowRate = stableRateLastUpdated = 0;
+
scaledVariableDebt = IVariableDebtToken(reserve.variableDebtTokenAddress).scaledBalanceOf(user);
liquidityRate = reserve.currentLiquidityRate;
- stableBorrowRate = IStableDebtToken(reserve.stableDebtTokenAddress).getUserStableRate(user);
- stableRateLastUpdated = IStableDebtToken(reserve.stableDebtTokenAddress).getUserLastUpdated(
- user
- );
usageAsCollateralEnabled = userConfig.isUsingAsCollateral(reserve.id);
}
@@ -265,11 +257,8 @@ contract AaveProtocolDataProvider is IPoolDataProvider {
asset
);
- return (
- reserve.aTokenAddress,
- reserve.stableDebtTokenAddress,
- reserve.variableDebtTokenAddress
- );
+ // @notice all stable debt related parameters deprecated in v3.2.0
+ return (reserve.aTokenAddress, address(0), reserve.variableDebtTokenAddress);
}
/// @inheritdoc IPoolDataProvider
diff --git a/src/core/contracts/misc/L2Encoder.sol b/src/contracts/helpers/L2Encoder.sol
similarity index 87%
rename from src/core/contracts/misc/L2Encoder.sol
rename to src/contracts/helpers/L2Encoder.sol
index bdcd225e..7c1bd96c 100644
--- a/src/core/contracts/misc/L2Encoder.sol
+++ b/src/contracts/helpers/L2Encoder.sol
@@ -118,7 +118,7 @@ contract L2Encoder {
* @dev Without an onBehalfOf parameter as the compact calls to L2Pool will use msg.sender as onBehalfOf
* @param asset The address of the underlying asset to borrow
* @param amount The amount to be borrowed
- * @param interestRateMode The interest rate mode at which the user wants to borrow: 1 for Stable, 2 for Variable
+ * @param interestRateMode The interest rate mode at which the user wants to borrow: 2 for Variable, 1 is deprecated (changed on v3.2.0)
* @param referralCode The code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
* @return compact representation of withdraw parameters
@@ -153,7 +153,7 @@ contract L2Encoder {
* @param asset The address of the borrowed underlying asset previously borrowed
* @param amount The amount to repay
* - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `interestRateMode`
- * @param interestRateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable
+ * @param interestRateMode The interest rate mode at of the debt the user wants to repay: 2 for Variable, 1 is deprecated (changed on v3.2.0)
* @return compact representation of repay parameters
*/
function encodeRepayParams(
@@ -180,7 +180,7 @@ contract L2Encoder {
* @param asset The address of the borrowed underlying asset previously borrowed
* @param amount The amount to repay
* - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `debtMode`
- * @param interestRateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable
+ * @param interestRateMode The interest rate mode at of the debt the user wants to repay: 2 for Variable, 1 is deprecated (changed on v3.2.0)
* @param deadline The deadline timestamp that the permit is valid
* @param permitV The V parameter of ERC712 permit sig
* @param permitR The R parameter of ERC712 permit sig
@@ -226,7 +226,7 @@ contract L2Encoder {
* @param asset The address of the borrowed underlying asset previously borrowed
* @param amount The amount to repay
* - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `debtMode`
- * @param interestRateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable
+ * @param interestRateMode The interest rate mode at of the debt the user wants to repay: 2 for Variable, 1 is deprecated (changed on v3.2.0)
* @return compact representation of repay with aToken parameters
*/
function encodeRepayWithATokensParams(
@@ -237,46 +237,6 @@ contract L2Encoder {
return encodeRepayParams(asset, amount, interestRateMode);
}
- /**
- * @notice Encodes swap borrow rate mode parameters from standard input to compact representation of 1 bytes32
- * @param asset The address of the underlying asset borrowed
- * @param interestRateMode The current interest rate mode of the position being swapped: 1 for Stable, 2 for Variable
- * @return compact representation of swap borrow rate mode parameters
- */
- function encodeSwapBorrowRateMode(
- address asset,
- uint256 interestRateMode
- ) external view returns (bytes32) {
- DataTypes.ReserveDataLegacy memory data = POOL.getReserveData(asset);
- uint16 assetId = data.id;
- uint8 shortenedInterestRateMode = interestRateMode.toUint8();
- bytes32 res;
- assembly {
- res := add(assetId, shl(16, shortenedInterestRateMode))
- }
- return res;
- }
-
- /**
- * @notice Encodes rebalance stable borrow rate parameters from standard input to compact representation of 1 bytes32
- * @param asset The address of the underlying asset borrowed
- * @param user The address of the user to be rebalanced
- * @return compact representation of rebalance stable borrow rate parameters
- */
- function encodeRebalanceStableBorrowRate(
- address asset,
- address user
- ) external view returns (bytes32) {
- DataTypes.ReserveDataLegacy memory data = POOL.getReserveData(asset);
- uint16 assetId = data.id;
-
- bytes32 res;
- assembly {
- res := add(assetId, shl(16, user))
- }
- return res;
- }
-
/**
* @notice Encodes set user use reserve as collateral parameters from standard input to compact representation of 1 bytes32
* @param asset The address of the underlying asset borrowed
diff --git a/src/periphery/contracts/misc/UiIncentiveDataProviderV3.sol b/src/contracts/helpers/UiIncentiveDataProviderV3.sol
similarity index 69%
rename from src/periphery/contracts/misc/UiIncentiveDataProviderV3.sol
rename to src/contracts/helpers/UiIncentiveDataProviderV3.sol
index 5c8f3e7f..79a1829d 100644
--- a/src/periphery/contracts/misc/UiIncentiveDataProviderV3.sol
+++ b/src/contracts/helpers/UiIncentiveDataProviderV3.sol
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.10;
-import {IERC20Detailed} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
-import {IPool} from 'aave-v3-core/contracts/interfaces/IPool.sol';
-import {IncentivizedERC20} from 'aave-v3-core/contracts/protocol/tokenization/base/IncentivizedERC20.sol';
-import {UserConfiguration} from 'aave-v3-core/contracts/protocol/libraries/configuration/UserConfiguration.sol';
-import {DataTypes} from 'aave-v3-core/contracts/protocol/libraries/types/DataTypes.sol';
+import {IERC20Detailed} from '../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
+import {IPoolAddressesProvider} from '../interfaces/IPoolAddressesProvider.sol';
+import {IPool} from '../interfaces/IPool.sol';
+import {IncentivizedERC20} from '../protocol/tokenization/base/IncentivizedERC20.sol';
+import {UserConfiguration} from '../../contracts/protocol/libraries/configuration/UserConfiguration.sol';
+import {DataTypes} from '../protocol/libraries/types/DataTypes.sol';
import {IRewardsController} from '../rewards/interfaces/IRewardsController.sol';
import {IEACAggregatorProxy} from './interfaces/IEACAggregatorProxy.sol';
import {IUiIncentiveDataProviderV3} from './interfaces/IUiIncentiveDataProviderV3.sol';
@@ -47,7 +47,6 @@ contract UiIncentiveDataProviderV3 is IUiIncentiveDataProviderV3 {
DataTypes.ReserveDataLegacy memory baseData = pool.getReserveData(reserves[i]);
// Get aTokens rewards information
- // TODO: check that this is deployed correctly on contract and remove casting
IRewardsController aTokenIncentiveController = IRewardsController(
address(IncentivizedERC20(baseData.aTokenAddress).getIncentivesController())
);
@@ -155,60 +154,6 @@ contract UiIncentiveDataProviderV3 is IUiIncentiveDataProviderV3 {
address(vTokenIncentiveController),
vRewardsInformation
);
-
- // Get sTokens rewards information
- IRewardsController sTokenIncentiveController = IRewardsController(
- address(IncentivizedERC20(baseData.stableDebtTokenAddress).getIncentivesController())
- );
- RewardInfo[] memory sRewardsInformation;
- if (address(sTokenIncentiveController) != address(0)) {
- address[] memory sTokenRewardAddresses = sTokenIncentiveController.getRewardsByAsset(
- baseData.stableDebtTokenAddress
- );
- sRewardsInformation = new RewardInfo[](sTokenRewardAddresses.length);
- for (uint256 j = 0; j < sTokenRewardAddresses.length; ++j) {
- RewardInfo memory rewardInformation;
- rewardInformation.rewardTokenAddress = sTokenRewardAddresses[j];
-
- (
- rewardInformation.tokenIncentivesIndex,
- rewardInformation.emissionPerSecond,
- rewardInformation.incentivesLastUpdateTimestamp,
- rewardInformation.emissionEndTimestamp
- ) = sTokenIncentiveController.getRewardsData(
- baseData.stableDebtTokenAddress,
- rewardInformation.rewardTokenAddress
- );
-
- rewardInformation.precision = sTokenIncentiveController.getAssetDecimals(
- baseData.stableDebtTokenAddress
- );
- rewardInformation.rewardTokenDecimals = IERC20Detailed(
- rewardInformation.rewardTokenAddress
- ).decimals();
- rewardInformation.rewardTokenSymbol = IERC20Detailed(rewardInformation.rewardTokenAddress)
- .symbol();
-
- // Get price of reward token from Chainlink Proxy Oracle
- rewardInformation.rewardOracleAddress = sTokenIncentiveController.getRewardOracle(
- rewardInformation.rewardTokenAddress
- );
- rewardInformation.priceFeedDecimals = IEACAggregatorProxy(
- rewardInformation.rewardOracleAddress
- ).decimals();
- rewardInformation.rewardPriceFeed = IEACAggregatorProxy(
- rewardInformation.rewardOracleAddress
- ).latestAnswer();
-
- sRewardsInformation[j] = rewardInformation;
- }
- }
-
- reserveIncentiveData.sIncentiveData = IncentiveData(
- baseData.stableDebtTokenAddress,
- address(sTokenIncentiveController),
- sRewardsInformation
- );
}
return (reservesIncentiveData);
@@ -342,59 +287,6 @@ contract UiIncentiveDataProviderV3 is IUiIncentiveDataProviderV3 {
vUserRewardsInformation
);
}
-
- // stable debt token
- IRewardsController sTokenIncentiveController = IRewardsController(
- address(IncentivizedERC20(baseData.stableDebtTokenAddress).getIncentivesController())
- );
- if (address(sTokenIncentiveController) != address(0)) {
- // get all rewards information from the asset
- address[] memory sTokenRewardAddresses = sTokenIncentiveController.getRewardsByAsset(
- baseData.stableDebtTokenAddress
- );
- UserRewardInfo[] memory sUserRewardsInformation = new UserRewardInfo[](
- sTokenRewardAddresses.length
- );
- for (uint256 j = 0; j < sTokenRewardAddresses.length; ++j) {
- UserRewardInfo memory userRewardInformation;
- userRewardInformation.rewardTokenAddress = sTokenRewardAddresses[j];
-
- userRewardInformation.tokenIncentivesUserIndex = sTokenIncentiveController
- .getUserAssetIndex(
- user,
- baseData.stableDebtTokenAddress,
- userRewardInformation.rewardTokenAddress
- );
-
- userRewardInformation.userUnclaimedRewards = sTokenIncentiveController
- .getUserAccruedRewards(user, userRewardInformation.rewardTokenAddress);
- userRewardInformation.rewardTokenDecimals = IERC20Detailed(
- userRewardInformation.rewardTokenAddress
- ).decimals();
- userRewardInformation.rewardTokenSymbol = IERC20Detailed(
- userRewardInformation.rewardTokenAddress
- ).symbol();
-
- // Get price of reward token from Chainlink Proxy Oracle
- userRewardInformation.rewardOracleAddress = sTokenIncentiveController.getRewardOracle(
- userRewardInformation.rewardTokenAddress
- );
- userRewardInformation.priceFeedDecimals = IEACAggregatorProxy(
- userRewardInformation.rewardOracleAddress
- ).decimals();
- userRewardInformation.rewardPriceFeed = IEACAggregatorProxy(
- userRewardInformation.rewardOracleAddress
- ).latestAnswer();
-
- sUserRewardsInformation[j] = userRewardInformation;
- }
-
- userReservesIncentivesData[i].sTokenIncentivesUserData = UserIncentiveData(
- baseData.stableDebtTokenAddress,
- address(aTokenIncentiveController),
- sUserRewardsInformation
- );
- }
}
return (userReservesIncentivesData);
diff --git a/src/periphery/contracts/misc/UiPoolDataProviderV3.sol b/src/contracts/helpers/UiPoolDataProviderV3.sol
similarity index 75%
rename from src/periphery/contracts/misc/UiPoolDataProviderV3.sol
rename to src/contracts/helpers/UiPoolDataProviderV3.sol
index 8906d694..b079d2dd 100644
--- a/src/periphery/contracts/misc/UiPoolDataProviderV3.sol
+++ b/src/contracts/helpers/UiPoolDataProviderV3.sol
@@ -1,19 +1,18 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.10;
-import {IERC20Detailed} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
-import {IPool} from 'aave-v3-core/contracts/interfaces/IPool.sol';
-import {IAaveOracle} from 'aave-v3-core/contracts/interfaces/IAaveOracle.sol';
-import {IAToken} from 'aave-v3-core/contracts/interfaces/IAToken.sol';
-import {IVariableDebtToken} from 'aave-v3-core/contracts/interfaces/IVariableDebtToken.sol';
-import {IStableDebtToken} from 'aave-v3-core/contracts/interfaces/IStableDebtToken.sol';
-import {IDefaultInterestRateStrategyV2} from 'aave-v3-core/contracts/interfaces/IDefaultInterestRateStrategyV2.sol';
-import {AaveProtocolDataProvider} from 'aave-v3-core/contracts/misc/AaveProtocolDataProvider.sol';
-import {WadRayMath} from 'aave-v3-core/contracts/protocol/libraries/math/WadRayMath.sol';
-import {ReserveConfiguration} from 'aave-v3-core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
-import {UserConfiguration} from 'aave-v3-core/contracts/protocol/libraries/configuration/UserConfiguration.sol';
-import {DataTypes} from 'aave-v3-core/contracts/protocol/libraries/types/DataTypes.sol';
+import {IERC20Detailed} from '../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
+import {IPoolAddressesProvider} from '../interfaces/IPoolAddressesProvider.sol';
+import {IPool} from '../interfaces/IPool.sol';
+import {IAaveOracle} from '../interfaces/IAaveOracle.sol';
+import {IAToken} from '../interfaces/IAToken.sol';
+import {IVariableDebtToken} from '../interfaces/IVariableDebtToken.sol';
+import {IDefaultInterestRateStrategyV2} from '../interfaces/IDefaultInterestRateStrategyV2.sol';
+import {AaveProtocolDataProvider} from './AaveProtocolDataProvider.sol';
+import {WadRayMath} from '../protocol/libraries/math/WadRayMath.sol';
+import {ReserveConfiguration} from '../protocol/libraries/configuration/ReserveConfiguration.sol';
+import {UserConfiguration} from '../protocol/libraries/configuration/UserConfiguration.sol';
+import {DataTypes} from '../protocol/libraries/types/DataTypes.sol';
import {IEACAggregatorProxy} from './interfaces/IEACAggregatorProxy.sol';
import {IERC20DetailedBytes} from './interfaces/IERC20DetailedBytes.sol';
import {IUiPoolDataProviderV3} from './interfaces/IUiPoolDataProviderV3.sol';
@@ -71,11 +70,8 @@ contract UiPoolDataProviderV3 is IUiPoolDataProviderV3 {
reserveData.liquidityRate = baseData.currentLiquidityRate;
//the current variable borrow rate. Expressed in ray
reserveData.variableBorrowRate = baseData.currentVariableBorrowRate;
- //the current stable borrow rate. Expressed in ray
- reserveData.stableBorrowRate = baseData.currentStableBorrowRate;
reserveData.lastUpdateTimestamp = baseData.lastUpdateTimestamp;
reserveData.aTokenAddress = baseData.aTokenAddress;
- reserveData.stableDebtTokenAddress = baseData.stableDebtTokenAddress;
reserveData.variableDebtTokenAddress = baseData.variableDebtTokenAddress;
//address of the interest rate strategy
reserveData.interestRateStrategyAddress = baseData.interestRateStrategyAddress;
@@ -86,12 +82,6 @@ contract UiPoolDataProviderV3 is IUiPoolDataProviderV3 {
reserveData.availableLiquidity = IERC20Detailed(reserveData.underlyingAsset).balanceOf(
reserveData.aTokenAddress
);
- (
- reserveData.totalPrincipalStableDebt,
- ,
- reserveData.averageStableRate,
- reserveData.stableDebtLastUpdateTimestamp
- ) = IStableDebtToken(reserveData.stableDebtTokenAddress).getSupplyData();
reserveData.totalScaledVariableDebt = IVariableDebtToken(reserveData.variableDebtTokenAddress)
.scaledTotalSupply();
@@ -108,14 +98,12 @@ contract UiPoolDataProviderV3 is IUiPoolDataProviderV3 {
//stores the reserve configuration
DataTypes.ReserveConfigurationMap memory reserveConfigurationMap = baseData.configuration;
- uint256 eModeCategoryId;
(
reserveData.baseLTVasCollateral,
reserveData.reserveLiquidationThreshold,
reserveData.reserveLiquidationBonus,
reserveData.decimals,
- reserveData.reserveFactor,
- eModeCategoryId
+ reserveData.reserveFactor
) = reserveConfigurationMap.getParams();
reserveData.usageAsCollateralEnabled = reserveData.baseLTVasCollateral != 0;
@@ -123,7 +111,6 @@ contract UiPoolDataProviderV3 is IUiPoolDataProviderV3 {
reserveData.isActive,
reserveData.isFrozen,
reserveData.borrowingEnabled,
- reserveData.stableBorrowRateEnabled,
reserveData.isPaused
) = reserveConfigurationMap.getFlags();
@@ -138,12 +125,8 @@ contract UiPoolDataProviderV3 is IUiPoolDataProviderV3 {
reserveData.variableRateSlope2 = res.variableRateSlope2;
reserveData.optimalUsageRatio = res.optimalUsageRatio;
} catch {}
- reserveData.stableRateSlope1 = 0;
- reserveData.stableRateSlope2 = 0;
- reserveData.baseStableBorrowRate = 0;
// v3 only
- reserveData.eModeCategoryId = uint8(eModeCategoryId);
reserveData.debtCeiling = reserveConfigurationMap.getDebtCeiling();
reserveData.debtCeilingDecimals = poolDataProvider.getDebtCeilingDecimals();
(reserveData.borrowCap, reserveData.supplyCap) = reserveConfigurationMap.getCaps();
@@ -161,16 +144,6 @@ contract UiPoolDataProviderV3 is IUiPoolDataProviderV3 {
reserveData.isolationModeTotalDebt = baseData.isolationModeTotalDebt;
reserveData.accruedToTreasury = baseData.accruedToTreasury;
- DataTypes.EModeCategory memory categoryData = pool.getEModeCategoryData(
- reserveData.eModeCategoryId
- );
- reserveData.eModeLtv = categoryData.ltv;
- reserveData.eModeLiquidationThreshold = categoryData.liquidationThreshold;
- reserveData.eModeLiquidationBonus = categoryData.liquidationBonus;
- // each eMode category may or may not have a custom oracle to override the individual assets price oracles
- reserveData.eModePriceSource = categoryData.priceSource;
- reserveData.eModeLabel = categoryData.label;
-
reserveData.borrowableInIsolation = reserveConfigurationMap.getBorrowableInIsolation();
try poolDataProvider.getIsVirtualAccActive(reserveData.underlyingAsset) returns (
@@ -209,6 +182,41 @@ contract UiPoolDataProviderV3 is IUiPoolDataProviderV3 {
return (reservesData, baseCurrencyInfo);
}
+ /// @inheritdoc IUiPoolDataProviderV3
+ function getEModes(IPoolAddressesProvider provider) external view returns (Emode[] memory) {
+ IPool pool = IPool(provider.getPool());
+ Emode[] memory tempCategories = new Emode[](256);
+ uint8 eModesFound = 0;
+ uint8 missCounter = 0;
+ for (uint8 i = 1; i < 256; i++) {
+ DataTypes.CollateralConfig memory cfg = pool.getEModeCategoryCollateralConfig(i);
+ if (cfg.liquidationThreshold != 0) {
+ tempCategories[eModesFound] = Emode({
+ eMode: DataTypes.EModeCategory({
+ ltv: cfg.ltv,
+ liquidationThreshold: cfg.liquidationThreshold,
+ liquidationBonus: cfg.liquidationBonus,
+ label: pool.getEModeCategoryLabel(i),
+ collateralBitmap: pool.getEModeCategoryCollateralBitmap(i),
+ borrowableBitmap: pool.getEModeCategoryBorrowableBitmap(i)
+ }),
+ id: i
+ });
+ ++eModesFound;
+ missCounter = 0;
+ } else {
+ ++missCounter;
+ }
+ // assumes there will never be a gap > 2 when setting eModes
+ if (missCounter > 2) break;
+ }
+ Emode[] memory categories = new Emode[](eModesFound);
+ for (uint8 i = 0; i < eModesFound; i++) {
+ categories[i] = tempCategories[i];
+ }
+ return categories;
+ }
+
function getUserReservesData(
IPoolAddressesProvider provider,
address user
@@ -237,15 +245,6 @@ contract UiPoolDataProviderV3 is IUiPoolDataProviderV3 {
userReservesData[i].scaledVariableDebt = IVariableDebtToken(
baseData.variableDebtTokenAddress
).scaledBalanceOf(user);
- userReservesData[i].principalStableDebt = IStableDebtToken(baseData.stableDebtTokenAddress)
- .principalBalanceOf(user);
- if (userReservesData[i].principalStableDebt != 0) {
- userReservesData[i].stableBorrowRate = IStableDebtToken(baseData.stableDebtTokenAddress)
- .getUserStableRate(user);
- userReservesData[i].stableBorrowLastUpdateTimestamp = IStableDebtToken(
- baseData.stableDebtTokenAddress
- ).getUserLastUpdated(user);
- }
}
}
diff --git a/src/periphery/contracts/misc/WalletBalanceProvider.sol b/src/contracts/helpers/WalletBalanceProvider.sol
similarity index 81%
rename from src/periphery/contracts/misc/WalletBalanceProvider.sol
rename to src/contracts/helpers/WalletBalanceProvider.sol
index f215610c..54efad64 100644
--- a/src/periphery/contracts/misc/WalletBalanceProvider.sol
+++ b/src/contracts/helpers/WalletBalanceProvider.sol
@@ -1,14 +1,14 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.10;
-import {Address} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/Address.sol';
-import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
+import {Address} from '../dependencies/openzeppelin/contracts/Address.sol';
+import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
-import {IPool} from 'aave-v3-core/contracts/interfaces/IPool.sol';
-import {GPv2SafeERC20} from 'aave-v3-core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol';
-import {ReserveConfiguration} from 'aave-v3-core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
-import {DataTypes} from 'aave-v3-core/contracts/protocol/libraries/types/DataTypes.sol';
+import {IPoolAddressesProvider} from '../interfaces/IPoolAddressesProvider.sol';
+import {IPool} from '../interfaces/IPool.sol';
+import {GPv2SafeERC20} from '../dependencies/gnosis/contracts/GPv2SafeERC20.sol';
+import {ReserveConfiguration} from '../protocol/libraries/configuration/ReserveConfiguration.sol';
+import {DataTypes} from '../protocol/libraries/types/DataTypes.sol';
/**
* @title WalletBalanceProvider contract
@@ -93,7 +93,7 @@ contract WalletBalanceProvider {
reservesWithEth[j]
);
- (bool isActive, , , , ) = configuration.getFlags();
+ (bool isActive, , , ) = configuration.getFlags();
if (!isActive) {
balances[j] = 0;
diff --git a/src/periphery/contracts/misc/WrappedTokenGatewayV3.sol b/src/contracts/helpers/WrappedTokenGatewayV3.sol
similarity index 79%
rename from src/periphery/contracts/misc/WrappedTokenGatewayV3.sol
rename to src/contracts/helpers/WrappedTokenGatewayV3.sol
index a120eeab..56725d5e 100644
--- a/src/periphery/contracts/misc/WrappedTokenGatewayV3.sol
+++ b/src/contracts/helpers/WrappedTokenGatewayV3.sol
@@ -1,17 +1,16 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.10;
-import {Ownable} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/Ownable.sol';
-import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
-import {GPv2SafeERC20} from 'aave-v3-core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol';
-import {IWETH} from 'aave-v3-core/contracts/misc/interfaces/IWETH.sol';
-import {IPool} from 'aave-v3-core/contracts/interfaces/IPool.sol';
-import {IAToken} from 'aave-v3-core/contracts/interfaces/IAToken.sol';
-import {ReserveConfiguration} from 'aave-v3-core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
-import {UserConfiguration} from 'aave-v3-core/contracts/protocol/libraries/configuration/UserConfiguration.sol';
-import {DataTypes} from 'aave-v3-core/contracts/protocol/libraries/types/DataTypes.sol';
+import {Ownable} from '../dependencies/openzeppelin/contracts/Ownable.sol';
+import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.sol';
+import {GPv2SafeERC20} from '../dependencies/gnosis/contracts/GPv2SafeERC20.sol';
+import {IWETH} from './interfaces/IWETH.sol';
+import {IPool} from '../interfaces/IPool.sol';
+import {IAToken} from '../interfaces/IAToken.sol';
+import {ReserveConfiguration} from '../protocol/libraries/configuration/ReserveConfiguration.sol';
+import {UserConfiguration} from '../protocol/libraries/configuration/UserConfiguration.sol';
+import {DataTypes} from '../protocol/libraries/types/DataTypes.sol';
import {IWrappedTokenGatewayV3} from './interfaces/IWrappedTokenGatewayV3.sol';
-import {DataTypesHelper} from '../libraries/DataTypesHelper.sol';
/**
* @dev This contract is an upgrade of the WrappedTokenGatewayV3 contract, with immutable pool address.
@@ -71,31 +70,23 @@ contract WrappedTokenGatewayV3 is IWrappedTokenGatewayV3, Ownable {
/**
* @dev repays a borrow on the WETH reserve, for the specified amount (or for the whole amount, if uint256(-1) is specified).
* @param amount the amount to repay, or uint256(-1) if the user wants to repay everything
- * @param rateMode the rate mode to repay
* @param onBehalfOf the address for which msg.sender is repaying
*/
- function repayETH(
- address,
- uint256 amount,
- uint256 rateMode,
- address onBehalfOf
- ) external payable override {
- (uint256 stableDebt, uint256 variableDebt) = DataTypesHelper.getUserCurrentDebt(
- onBehalfOf,
- POOL.getReserveData(address(WETH))
- );
-
- uint256 paybackAmount = DataTypes.InterestRateMode(rateMode) ==
- DataTypes.InterestRateMode.STABLE
- ? stableDebt
- : variableDebt;
+ function repayETH(address, uint256 amount, address onBehalfOf) external payable override {
+ uint256 paybackAmount = IERC20((POOL.getReserveData(address(WETH))).variableDebtTokenAddress)
+ .balanceOf(onBehalfOf);
if (amount < paybackAmount) {
paybackAmount = amount;
}
require(msg.value >= paybackAmount, 'msg.value is less than repayment amount');
WETH.deposit{value: paybackAmount}();
- POOL.repay(address(WETH), paybackAmount, rateMode, onBehalfOf);
+ POOL.repay(
+ address(WETH),
+ paybackAmount,
+ uint256(DataTypes.InterestRateMode.VARIABLE),
+ onBehalfOf
+ );
// refund remaining dust eth
if (msg.value > paybackAmount) _safeTransferETH(msg.sender, msg.value - paybackAmount);
@@ -104,16 +95,16 @@ contract WrappedTokenGatewayV3 is IWrappedTokenGatewayV3, Ownable {
/**
* @dev borrow WETH, unwraps to ETH and send both the ETH and DebtTokens to msg.sender, via `approveDelegation` and onBehalf argument in `Pool.borrow`.
* @param amount the amount of ETH to borrow
- * @param interestRateMode the interest rate mode
* @param referralCode integrators are assigned a referral code and can potentially receive rewards
*/
- function borrowETH(
- address,
- uint256 amount,
- uint256 interestRateMode,
- uint16 referralCode
- ) external override {
- POOL.borrow(address(WETH), amount, interestRateMode, referralCode, msg.sender);
+ function borrowETH(address, uint256 amount, uint16 referralCode) external override {
+ POOL.borrow(
+ address(WETH),
+ amount,
+ uint256(DataTypes.InterestRateMode.VARIABLE),
+ referralCode,
+ msg.sender
+ );
WETH.withdraw(amount);
_safeTransferETH(msg.sender, amount);
}
diff --git a/src/periphery/contracts/misc/interfaces/IEACAggregatorProxy.sol b/src/contracts/helpers/interfaces/IEACAggregatorProxy.sol
similarity index 100%
rename from src/periphery/contracts/misc/interfaces/IEACAggregatorProxy.sol
rename to src/contracts/helpers/interfaces/IEACAggregatorProxy.sol
diff --git a/src/periphery/contracts/misc/interfaces/IERC20DetailedBytes.sol b/src/contracts/helpers/interfaces/IERC20DetailedBytes.sol
similarity index 73%
rename from src/periphery/contracts/misc/interfaces/IERC20DetailedBytes.sol
rename to src/contracts/helpers/interfaces/IERC20DetailedBytes.sol
index 3e213158..0541f0da 100644
--- a/src/periphery/contracts/misc/interfaces/IERC20DetailedBytes.sol
+++ b/src/contracts/helpers/interfaces/IERC20DetailedBytes.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
-import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
+import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
interface IERC20DetailedBytes is IERC20 {
function name() external view returns (bytes32);
diff --git a/src/periphery/contracts/misc/interfaces/IUiIncentiveDataProviderV3.sol b/src/contracts/helpers/interfaces/IUiIncentiveDataProviderV3.sol
similarity index 91%
rename from src/periphery/contracts/misc/interfaces/IUiIncentiveDataProviderV3.sol
rename to src/contracts/helpers/interfaces/IUiIncentiveDataProviderV3.sol
index fb3bb00c..3402953f 100644
--- a/src/periphery/contracts/misc/interfaces/IUiIncentiveDataProviderV3.sol
+++ b/src/contracts/helpers/interfaces/IUiIncentiveDataProviderV3.sol
@@ -1,14 +1,13 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
+import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
interface IUiIncentiveDataProviderV3 {
struct AggregatedReserveIncentiveData {
address underlyingAsset;
IncentiveData aIncentiveData;
IncentiveData vIncentiveData;
- IncentiveData sIncentiveData;
}
struct IncentiveData {
@@ -35,7 +34,6 @@ interface IUiIncentiveDataProviderV3 {
address underlyingAsset;
UserIncentiveData aTokenIncentivesUserData;
UserIncentiveData vTokenIncentivesUserData;
- UserIncentiveData sTokenIncentivesUserData;
}
struct UserIncentiveData {
diff --git a/src/periphery/contracts/misc/interfaces/IUiPoolDataProviderV3.sol b/src/contracts/helpers/interfaces/IUiPoolDataProviderV3.sol
similarity index 69%
rename from src/periphery/contracts/misc/interfaces/IUiPoolDataProviderV3.sol
rename to src/contracts/helpers/interfaces/IUiPoolDataProviderV3.sol
index 42944eb8..3280d75b 100644
--- a/src/periphery/contracts/misc/interfaces/IUiPoolDataProviderV3.sol
+++ b/src/contracts/helpers/interfaces/IUiPoolDataProviderV3.sol
@@ -1,19 +1,10 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
+import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
+import {DataTypes} from '../../protocol/libraries/types/DataTypes.sol';
interface IUiPoolDataProviderV3 {
- struct InterestRates {
- uint256 variableRateSlope1;
- uint256 variableRateSlope2;
- uint256 stableRateSlope1;
- uint256 stableRateSlope2;
- uint256 baseStableBorrowRate;
- uint256 baseVariableBorrowRate;
- uint256 optimalUsageRatio;
- }
-
struct AggregatedReserveData {
address underlyingAsset;
string name;
@@ -25,7 +16,6 @@ interface IUiPoolDataProviderV3 {
uint256 reserveFactor;
bool usageAsCollateralEnabled;
bool borrowingEnabled;
- bool stableBorrowRateEnabled;
bool isActive;
bool isFrozen;
// base data
@@ -33,25 +23,17 @@ interface IUiPoolDataProviderV3 {
uint128 variableBorrowIndex;
uint128 liquidityRate;
uint128 variableBorrowRate;
- uint128 stableBorrowRate;
uint40 lastUpdateTimestamp;
address aTokenAddress;
- address stableDebtTokenAddress;
address variableDebtTokenAddress;
address interestRateStrategyAddress;
//
uint256 availableLiquidity;
- uint256 totalPrincipalStableDebt;
- uint256 averageStableRate;
- uint256 stableDebtLastUpdateTimestamp;
uint256 totalScaledVariableDebt;
uint256 priceInMarketReferenceCurrency;
address priceOracle;
uint256 variableRateSlope1;
uint256 variableRateSlope2;
- uint256 stableRateSlope1;
- uint256 stableRateSlope2;
- uint256 baseStableBorrowRate;
uint256 baseVariableBorrowRate;
uint256 optimalUsageRatio;
// v3 only
@@ -64,15 +46,8 @@ interface IUiPoolDataProviderV3 {
//
uint256 debtCeiling;
uint256 debtCeilingDecimals;
- uint8 eModeCategoryId;
uint256 borrowCap;
uint256 supplyCap;
- // eMode
- uint16 eModeLtv;
- uint16 eModeLiquidationThreshold;
- uint16 eModeLiquidationBonus;
- address eModePriceSource;
- string eModeLabel;
bool borrowableInIsolation;
// v3.1
bool virtualAccActive;
@@ -83,10 +58,7 @@ interface IUiPoolDataProviderV3 {
address underlyingAsset;
uint256 scaledATokenBalance;
bool usageAsCollateralEnabledOnUser;
- uint256 stableBorrowRate;
uint256 scaledVariableDebt;
- uint256 principalStableDebt;
- uint256 stableBorrowLastUpdateTimestamp;
}
struct BaseCurrencyInfo {
@@ -96,6 +68,11 @@ interface IUiPoolDataProviderV3 {
uint8 networkBaseTokenPriceDecimals;
}
+ struct Emode {
+ uint8 id;
+ DataTypes.EModeCategory eMode;
+ }
+
function getReservesList(
IPoolAddressesProvider provider
) external view returns (address[] memory);
@@ -108,4 +85,11 @@ interface IUiPoolDataProviderV3 {
IPoolAddressesProvider provider,
address user
) external view returns (UserReserveData[] memory, uint8);
+
+ /**
+ * @dev Iterates the eModes mapping and returns all eModes found
+ * @notice The method assumes for id gaps <= 2 within the eMode definitions
+ * @return an array of eModes that were found in the eMode mapping
+ */
+ function getEModes(IPoolAddressesProvider provider) external view returns (Emode[] memory);
}
diff --git a/src/core/contracts/misc/interfaces/IWETH.sol b/src/contracts/helpers/interfaces/IWETH.sol
similarity index 100%
rename from src/core/contracts/misc/interfaces/IWETH.sol
rename to src/contracts/helpers/interfaces/IWETH.sol
diff --git a/src/periphery/contracts/misc/interfaces/IWrappedTokenGatewayV3.sol b/src/contracts/helpers/interfaces/IWrappedTokenGatewayV3.sol
similarity index 64%
rename from src/periphery/contracts/misc/interfaces/IWrappedTokenGatewayV3.sol
rename to src/contracts/helpers/interfaces/IWrappedTokenGatewayV3.sol
index 38f4cadb..ae8f5980 100644
--- a/src/periphery/contracts/misc/interfaces/IWrappedTokenGatewayV3.sol
+++ b/src/contracts/helpers/interfaces/IWrappedTokenGatewayV3.sol
@@ -6,19 +6,9 @@ interface IWrappedTokenGatewayV3 {
function withdrawETH(address pool, uint256 amount, address onBehalfOf) external;
- function repayETH(
- address pool,
- uint256 amount,
- uint256 rateMode,
- address onBehalfOf
- ) external payable;
+ function repayETH(address pool, uint256 amount, address onBehalfOf) external payable;
- function borrowETH(
- address pool,
- uint256 amount,
- uint256 interestRateMode,
- uint16 referralCode
- ) external;
+ function borrowETH(address pool, uint256 amount, uint16 referralCode) external;
function withdrawETHWithPermit(
address pool,
diff --git a/src/core/instances/ATokenInstance.sol b/src/contracts/instances/ATokenInstance.sol
similarity index 93%
rename from src/core/instances/ATokenInstance.sol
rename to src/contracts/instances/ATokenInstance.sol
index e778f91e..8e646385 100644
--- a/src/core/instances/ATokenInstance.sol
+++ b/src/contracts/instances/ATokenInstance.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
-import {AToken, IPool, IAaveIncentivesController, IInitializableAToken, Errors, VersionedInitializable} from '../contracts/protocol/tokenization/AToken.sol';
+import {AToken, IPool, IAaveIncentivesController, IInitializableAToken, Errors, VersionedInitializable} from '../protocol/tokenization/AToken.sol';
contract ATokenInstance is AToken {
uint256 public constant ATOKEN_REVISION = 1;
diff --git a/src/core/instances/L2PoolInstance.sol b/src/contracts/instances/L2PoolInstance.sol
similarity index 60%
rename from src/core/instances/L2PoolInstance.sol
rename to src/contracts/instances/L2PoolInstance.sol
index 80bd406f..0c61f19e 100644
--- a/src/core/instances/L2PoolInstance.sol
+++ b/src/contracts/instances/L2PoolInstance.sol
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
-import {L2Pool} from '../contracts/protocol/pool/L2Pool.sol';
-import {IPoolAddressesProvider} from '../contracts/interfaces/IPoolAddressesProvider.sol';
+import {L2Pool} from '../protocol/pool/L2Pool.sol';
+import {IPoolAddressesProvider} from '../interfaces/IPoolAddressesProvider.sol';
import {PoolInstance} from './PoolInstance.sol';
contract L2PoolInstance is L2Pool, PoolInstance {
diff --git a/src/core/instances/PoolConfiguratorInstance.sol b/src/contracts/instances/PoolConfiguratorInstance.sol
similarity index 79%
rename from src/core/instances/PoolConfiguratorInstance.sol
rename to src/contracts/instances/PoolConfiguratorInstance.sol
index 03ae6105..7f7294fe 100644
--- a/src/core/instances/PoolConfiguratorInstance.sol
+++ b/src/contracts/instances/PoolConfiguratorInstance.sol
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
-import {PoolConfigurator, IPoolAddressesProvider, IPool, VersionedInitializable} from 'aave-v3-core/contracts/protocol/pool/PoolConfigurator.sol';
+import {PoolConfigurator, IPoolAddressesProvider, IPool, VersionedInitializable} from '../protocol/pool/PoolConfigurator.sol';
contract PoolConfiguratorInstance is PoolConfigurator {
- uint256 public constant CONFIGURATOR_REVISION = 3;
+ uint256 public constant CONFIGURATOR_REVISION = 4;
/// @inheritdoc VersionedInitializable
function getRevision() internal pure virtual override returns (uint256) {
diff --git a/src/core/instances/PoolInstance.sol b/src/contracts/instances/PoolInstance.sol
similarity index 71%
rename from src/core/instances/PoolInstance.sol
rename to src/contracts/instances/PoolInstance.sol
index 0af51bbe..b032e63e 100644
--- a/src/core/instances/PoolInstance.sol
+++ b/src/contracts/instances/PoolInstance.sol
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
-import {Pool} from '../contracts/protocol/pool/Pool.sol';
-import {IPoolAddressesProvider} from '../contracts/interfaces/IPoolAddressesProvider.sol';
-import {Errors} from '../contracts/protocol/libraries/helpers/Errors.sol';
+import {Pool} from '../protocol/pool/Pool.sol';
+import {IPoolAddressesProvider} from '../interfaces/IPoolAddressesProvider.sol';
+import {Errors} from '../protocol/libraries/helpers/Errors.sol';
contract PoolInstance is Pool {
- uint256 public constant POOL_REVISION = 4;
+ uint256 public constant POOL_REVISION = 5;
constructor(IPoolAddressesProvider provider) Pool(provider) {}
@@ -19,7 +19,6 @@ contract PoolInstance is Pool {
*/
function initialize(IPoolAddressesProvider provider) external virtual override initializer {
require(provider == ADDRESSES_PROVIDER, Errors.INVALID_ADDRESSES_PROVIDER);
- _maxStableRateBorrowSizePercent = 0.25e4;
}
function getRevision() internal pure virtual override returns (uint256) {
diff --git a/src/core/instances/VariableDebtTokenInstance.sol b/src/contracts/instances/VariableDebtTokenInstance.sol
similarity index 91%
rename from src/core/instances/VariableDebtTokenInstance.sol
rename to src/contracts/instances/VariableDebtTokenInstance.sol
index 11ac68e6..b2c3dc89 100644
--- a/src/core/instances/VariableDebtTokenInstance.sol
+++ b/src/contracts/instances/VariableDebtTokenInstance.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
-import {VariableDebtToken, IPool, IInitializableDebtToken, VersionedInitializable, IAaveIncentivesController, Errors} from '../contracts/protocol/tokenization/VariableDebtToken.sol';
+import {VariableDebtToken, IPool, IInitializableDebtToken, VersionedInitializable, IAaveIncentivesController, Errors} from '../protocol/tokenization/VariableDebtToken.sol';
contract VariableDebtTokenInstance is VariableDebtToken {
uint256 public constant DEBT_TOKEN_REVISION = 1;
diff --git a/src/core/contracts/interfaces/IACLManager.sol b/src/contracts/interfaces/IACLManager.sol
similarity index 100%
rename from src/core/contracts/interfaces/IACLManager.sol
rename to src/contracts/interfaces/IACLManager.sol
diff --git a/src/core/contracts/interfaces/IAToken.sol b/src/contracts/interfaces/IAToken.sol
similarity index 100%
rename from src/core/contracts/interfaces/IAToken.sol
rename to src/contracts/interfaces/IAToken.sol
diff --git a/src/core/contracts/interfaces/IAaveIncentivesController.sol b/src/contracts/interfaces/IAaveIncentivesController.sol
similarity index 100%
rename from src/core/contracts/interfaces/IAaveIncentivesController.sol
rename to src/contracts/interfaces/IAaveIncentivesController.sol
diff --git a/src/core/contracts/interfaces/IAaveOracle.sol b/src/contracts/interfaces/IAaveOracle.sol
similarity index 100%
rename from src/core/contracts/interfaces/IAaveOracle.sol
rename to src/contracts/interfaces/IAaveOracle.sol
diff --git a/src/core/contracts/interfaces/ICreditDelegationToken.sol b/src/contracts/interfaces/ICreditDelegationToken.sol
similarity index 100%
rename from src/core/contracts/interfaces/ICreditDelegationToken.sol
rename to src/contracts/interfaces/ICreditDelegationToken.sol
diff --git a/src/core/contracts/interfaces/IDefaultInterestRateStrategyV2.sol b/src/contracts/interfaces/IDefaultInterestRateStrategyV2.sol
similarity index 95%
rename from src/core/contracts/interfaces/IDefaultInterestRateStrategyV2.sol
rename to src/contracts/interfaces/IDefaultInterestRateStrategyV2.sol
index 5b8b0149..938e2d8f 100644
--- a/src/core/contracts/interfaces/IDefaultInterestRateStrategyV2.sol
+++ b/src/contracts/interfaces/IDefaultInterestRateStrategyV2.sol
@@ -10,16 +10,6 @@ import {IPoolAddressesProvider} from './IPoolAddressesProvider.sol';
* @notice Interface of the default interest rate strategy used by the Aave protocol
*/
interface IDefaultInterestRateStrategyV2 is IReserveInterestRateStrategy {
- struct CalcInterestRatesLocalVars {
- uint256 availableLiquidity;
- uint256 totalDebt;
- uint256 currentVariableBorrowRate;
- uint256 currentLiquidityRate;
- uint256 borrowUsageRatio;
- uint256 supplyUsageRatio;
- uint256 availableLiquidityPlusDebt;
- }
-
/**
* @notice Holds the interest rate data for a given reserve
*
diff --git a/src/core/contracts/interfaces/IDelegationToken.sol b/src/contracts/interfaces/IDelegationToken.sol
similarity index 100%
rename from src/core/contracts/interfaces/IDelegationToken.sol
rename to src/contracts/interfaces/IDelegationToken.sol
diff --git a/src/core/contracts/interfaces/IERC20WithPermit.sol b/src/contracts/interfaces/IERC20WithPermit.sol
similarity index 100%
rename from src/core/contracts/interfaces/IERC20WithPermit.sol
rename to src/contracts/interfaces/IERC20WithPermit.sol
diff --git a/src/core/contracts/interfaces/IInitializableAToken.sol b/src/contracts/interfaces/IInitializableAToken.sol
similarity index 100%
rename from src/core/contracts/interfaces/IInitializableAToken.sol
rename to src/contracts/interfaces/IInitializableAToken.sol
diff --git a/src/core/contracts/interfaces/IInitializableDebtToken.sol b/src/contracts/interfaces/IInitializableDebtToken.sol
similarity index 100%
rename from src/core/contracts/interfaces/IInitializableDebtToken.sol
rename to src/contracts/interfaces/IInitializableDebtToken.sol
diff --git a/src/core/contracts/interfaces/IL2Pool.sol b/src/contracts/interfaces/IL2Pool.sol
similarity index 88%
rename from src/core/contracts/interfaces/IL2Pool.sol
rename to src/contracts/interfaces/IL2Pool.sol
index 64f3e2eb..56dee912 100644
--- a/src/core/contracts/interfaces/IL2Pool.sol
+++ b/src/contracts/interfaces/IL2Pool.sol
@@ -92,24 +92,6 @@ interface IL2Pool {
*/
function repayWithATokens(bytes32 args) external returns (uint256);
- /**
- * @notice Calldata efficient wrapper of the swapBorrowRateMode function
- * @param args Arguments for the swapBorrowRateMode function packed in one bytes32
- * 232 bits 8 bits 16 bits
- * | 0-padding | shortenedInterestRateMode | assetId |
- * @dev assetId is the index of the asset in the reservesList.
- */
- function swapBorrowRateMode(bytes32 args) external;
-
- /**
- * @notice Calldata efficient wrapper of the rebalanceStableBorrowRate function
- * @param args Arguments for the rebalanceStableBorrowRate function packed in one bytes32
- * 80 bits 160 bits 16 bits
- * | 0-padding | user address | assetId |
- * @dev assetId is the index of the asset in the reservesList.
- */
- function rebalanceStableBorrowRate(bytes32 args) external;
-
/**
* @notice Calldata efficient wrapper of the setUserUseReserveAsCollateral function
* @param args Arguments for the setUserUseReserveAsCollateral function packed in one bytes32
diff --git a/src/core/contracts/interfaces/IPool.sol b/src/contracts/interfaces/IPool.sol
similarity index 89%
rename from src/core/contracts/interfaces/IPool.sol
rename to src/contracts/interfaces/IPool.sol
index 86becac3..01e1bcaf 100644
--- a/src/core/contracts/interfaces/IPool.sol
+++ b/src/contracts/interfaces/IPool.sol
@@ -67,7 +67,7 @@ interface IPool {
* initiator of the transaction on flashLoan()
* @param onBehalfOf The address that will be getting the debt
* @param amount The amount borrowed out
- * @param interestRateMode The rate mode: 1 for Stable, 2 for Variable
+ * @param interestRateMode The rate mode: 2 for Variable, 1 is deprecated (changed on v3.2.0)
* @param borrowRate The numeric rate at which the user has borrowed, expressed in ray
* @param referralCode The referral code used
*/
@@ -97,18 +97,6 @@ interface IPool {
bool useATokens
);
- /**
- * @dev Emitted on swapBorrowRateMode()
- * @param reserve The address of the underlying asset of the reserve
- * @param user The address of the user swapping his rate mode
- * @param interestRateMode The current interest rate mode of the position being swapped: 1 for Stable, 2 for Variable
- */
- event SwapBorrowRateMode(
- address indexed reserve,
- address indexed user,
- DataTypes.InterestRateMode interestRateMode
- );
-
/**
* @dev Emitted on borrow(), repay() and liquidationCall() when using isolated assets
* @param asset The address of the underlying asset of the reserve
@@ -137,20 +125,14 @@ interface IPool {
*/
event ReserveUsedAsCollateralDisabled(address indexed reserve, address indexed user);
- /**
- * @dev Emitted on rebalanceStableBorrowRate()
- * @param reserve The address of the underlying asset of the reserve
- * @param user The address of the user for which the rebalance has been executed
- */
- event RebalanceStableBorrowRate(address indexed reserve, address indexed user);
-
/**
* @dev Emitted on flashLoan()
* @param target The address of the flash loan receiver contract
* @param initiator The address initiating the flash loan
* @param asset The address of the asset being flash borrowed
* @param amount The amount flash borrowed
- * @param interestRateMode The flashloan mode: 0 for regular flashloan, 1 for Stable debt, 2 for Variable debt
+ * @param interestRateMode The flashloan mode: 0 for regular flashloan,
+ * 1 for Stable (Deprecated on v3.2.0), 2 for Variable
* @param premium The fee flash borrowed
* @param referralCode The referral code used
*/
@@ -189,7 +171,7 @@ interface IPool {
* @dev Emitted when the state of a reserve is updated.
* @param reserve The address of the underlying asset of the reserve
* @param liquidityRate The next liquidity rate
- * @param stableBorrowRate The next stable borrow rate
+ * @param stableBorrowRate The next stable borrow rate @note deprecated on v3.2.0
* @param variableBorrowRate The next variable borrow rate
* @param liquidityIndex The next liquidity index
* @param variableBorrowIndex The next variable borrow index
@@ -288,13 +270,12 @@ interface IPool {
/**
* @notice Allows users to borrow a specific `amount` of the reserve underlying asset, provided that the borrower
- * already supplied enough collateral, or he was given enough allowance by a credit delegator on the
- * corresponding debt token (StableDebtToken or VariableDebtToken)
+ * already supplied enough collateral, or he was given enough allowance by a credit delegator on the VariableDebtToken
* - E.g. User borrows 100 USDC passing as `onBehalfOf` his own address, receiving the 100 USDC in his wallet
- * and 100 stable/variable debt tokens, depending on the `interestRateMode`
+ * and 100 variable debt tokens
* @param asset The address of the underlying asset to borrow
* @param amount The amount to be borrowed
- * @param interestRateMode The interest rate mode at which the user wants to borrow: 1 for Stable, 2 for Variable
+ * @param interestRateMode 2 for Variable, 1 is deprecated on v3.2.0
* @param referralCode The code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
* @param onBehalfOf The address of the user who will receive the debt. Should be the address of the borrower itself
@@ -311,11 +292,11 @@ interface IPool {
/**
* @notice Repays a borrowed `amount` on a specific reserve, burning the equivalent debt tokens owned
- * - E.g. User repays 100 USDC, burning 100 variable/stable debt tokens of the `onBehalfOf` address
+ * - E.g. User repays 100 USDC, burning 100 variable debt tokens of the `onBehalfOf` address
* @param asset The address of the borrowed underlying asset previously borrowed
* @param amount The amount to repay
* - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `debtMode`
- * @param interestRateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable
+ * @param interestRateMode 2 for Variable, 1 is deprecated on v3.2.0
* @param onBehalfOf The address of the user who will get his debt reduced/removed. Should be the address of the
* user calling the function if he wants to reduce/remove his own debt, or the address of any other
* other borrower whose debt should be removed
@@ -334,7 +315,7 @@ interface IPool {
* @param asset The address of the borrowed underlying asset previously borrowed
* @param amount The amount to repay
* - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `debtMode`
- * @param interestRateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable
+ * @param interestRateMode 2 for Variable, 1 is deprecated on v3.2.0
* @param onBehalfOf Address of the user who will get his debt reduced/removed. Should be the address of the
* user calling the function if he wants to reduce/remove his own debt, or the address of any other
* other borrower whose debt should be removed
@@ -358,13 +339,13 @@ interface IPool {
/**
* @notice Repays a borrowed `amount` on a specific reserve using the reserve aTokens, burning the
* equivalent debt tokens
- * - E.g. User repays 100 USDC using 100 aUSDC, burning 100 variable/stable debt tokens
+ * - E.g. User repays 100 USDC using 100 aUSDC, burning 100 variable debt tokens
* @dev Passing uint256.max as amount will clean up any residual aToken dust balance, if the user aToken
* balance is not enough to cover the whole debt
* @param asset The address of the borrowed underlying asset previously borrowed
* @param amount The amount to repay
* - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `debtMode`
- * @param interestRateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable
+ * @param interestRateMode DEPRECATED in v3.2.0
* @return The final amount repaid
*/
function repayWithATokens(
@@ -373,32 +354,6 @@ interface IPool {
uint256 interestRateMode
) external returns (uint256);
- /**
- * @notice Allows a borrower to swap his debt between stable and variable mode, or vice versa
- * @param asset The address of the underlying asset borrowed
- * @param interestRateMode The current interest rate mode of the position being swapped: 1 for Stable, 2 for Variable
- */
- function swapBorrowRateMode(address asset, uint256 interestRateMode) external;
-
- /**
- * @notice Permissionless method which allows anyone to swap a users stable debt to variable debt
- * @dev Introduced in favor of stable rate deprecation
- * @param asset The address of the underlying asset borrowed
- * @param user The address of the user whose debt will be swapped from stable to variable
- */
- function swapToVariable(address asset, address user) external;
-
- /**
- * @notice Rebalances the stable interest rate of a user to the current stable rate defined on the reserve.
- * - Users can be rebalanced if the following conditions are satisfied:
- * 1. Usage ratio is above 95%
- * 2. the current supply APY is below REBALANCE_UP_THRESHOLD * maxVariableBorrowRate, which means that too
- * much has been borrowed at a stable rate and suppliers are not earning enough
- * @param asset The address of the underlying asset borrowed
- * @param user The address of the user to be rebalanced
- */
- function rebalanceStableBorrowRate(address asset, address user) external;
-
/**
* @notice Allows suppliers to enable/disable a specific supplied asset as collateral
* @param asset The address of the underlying asset supplied
@@ -435,9 +390,9 @@ interface IPool {
* @param amounts The amounts of the assets being flash-borrowed
* @param interestRateModes Types of the debt to open if the flash loan is not returned:
* 0 -> Don't open any debt, just revert if funds can't be transferred from the receiver
- * 1 -> Open debt at stable rate for the value of the amount flash-borrowed to the `onBehalfOf` address
+ * 1 -> Deprecated on v3.2.0
* 2 -> Open debt at variable rate for the value of the amount flash-borrowed to the `onBehalfOf` address
- * @param onBehalfOf The address that will receive the debt in the case of using on `modes` 1 or 2
+ * @param onBehalfOf The address that will receive the debt in the case of using 2 on `modes`
* @param params Variadic packed params to pass to the receiver as extra information
* @param referralCode The code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
@@ -502,14 +457,12 @@ interface IPool {
* @dev Only callable by the PoolConfigurator contract
* @param asset The address of the underlying asset of the reserve
* @param aTokenAddress The address of the aToken that will be assigned to the reserve
- * @param stableDebtAddress The address of the StableDebtToken that will be assigned to the reserve
* @param variableDebtAddress The address of the VariableDebtToken that will be assigned to the reserve
* @param interestRateStrategyAddress The address of the interest rate strategy contract
*/
function initReserve(
address asset,
address aTokenAddress,
- address stableDebtAddress,
address variableDebtAddress,
address interestRateStrategyAddress
) external;
@@ -517,6 +470,7 @@ interface IPool {
/**
* @notice Drop a reserve
* @dev Only callable by the PoolConfigurator contract
+ * @dev Does not reset eMode flags, which must be considered when reusing the same reserve id for a different reserve.
* @param asset The address of the underlying asset of the reserve
*/
function dropReserve(address asset) external;
@@ -689,20 +643,70 @@ interface IPool {
) external;
/**
- * @notice Configures a new category for the eMode.
+ * @notice Configures a new or alters an existing collateral configuration of an eMode.
* @dev In eMode, the protocol allows very high borrowing power to borrow assets of the same category.
* The category 0 is reserved as it's the default for volatile assets
* @param id The id of the category
* @param config The configuration of the category
*/
- function configureEModeCategory(uint8 id, DataTypes.EModeCategory memory config) external;
+ function configureEModeCategory(
+ uint8 id,
+ DataTypes.EModeCategoryBaseConfiguration memory config
+ ) external;
+
+ /**
+ * @notice Replaces the current eMode collateralBitmap.
+ * @param id The id of the category
+ * @param collateralBitmap The collateralBitmap of the category
+ */
+ function configureEModeCategoryCollateralBitmap(uint8 id, uint128 collateralBitmap) external;
+
+ /**
+ * @notice Replaces the current eMode borrowableBitmap.
+ * @param id The id of the category
+ * @param borrowableBitmap The borrowableBitmap of the category
+ */
+ function configureEModeCategoryBorrowableBitmap(uint8 id, uint128 borrowableBitmap) external;
/**
* @notice Returns the data of an eMode category
+ * @dev DEPRECATED use independent getters instead
* @param id The id of the category
* @return The configuration data of the category
*/
- function getEModeCategoryData(uint8 id) external view returns (DataTypes.EModeCategory memory);
+ function getEModeCategoryData(
+ uint8 id
+ ) external view returns (DataTypes.EModeCategoryLegacy memory);
+
+ /**
+ * @notice Returns the label of an eMode category
+ * @param id The id of the category
+ * @return The label of the category
+ */
+ function getEModeCategoryLabel(uint8 id) external view returns (string memory);
+
+ /**
+ * @notice Returns the collateral config of an eMode category
+ * @param id The id of the category
+ * @return The ltv,lt,lb of the category
+ */
+ function getEModeCategoryCollateralConfig(
+ uint8 id
+ ) external view returns (DataTypes.CollateralConfig memory);
+
+ /**
+ * @notice Returns the collateralBitmap of an eMode category
+ * @param id The id of the category
+ * @return The collateralBitmap of the category
+ */
+ function getEModeCategoryCollateralBitmap(uint8 id) external view returns (uint128);
+
+ /**
+ * @notice Returns the borrowableBitmap of an eMode category
+ * @param id The id of the category
+ * @return The borrowableBitmap of the category
+ */
+ function getEModeCategoryBorrowableBitmap(uint8 id) external view returns (uint128);
/**
* @notice Allows a user to use the protocol in eMode
@@ -740,12 +744,6 @@ interface IPool {
**/
function getLiquidationGracePeriod(address asset) external returns (uint40);
- /**
- * @notice Returns the percentage of available liquidity that can be borrowed at once at stable rate
- * @return The percentage of available liquidity to borrow, expressed in bps
- */
- function MAX_STABLE_RATE_BORROW_SIZE_PERCENT() external view returns (uint256);
-
/**
* @notice Returns the total fee on flash loans
* @return The total fee on flashloans
diff --git a/src/core/contracts/interfaces/IPoolAddressesProvider.sol b/src/contracts/interfaces/IPoolAddressesProvider.sol
similarity index 100%
rename from src/core/contracts/interfaces/IPoolAddressesProvider.sol
rename to src/contracts/interfaces/IPoolAddressesProvider.sol
diff --git a/src/core/contracts/interfaces/IPoolAddressesProviderRegistry.sol b/src/contracts/interfaces/IPoolAddressesProviderRegistry.sol
similarity index 100%
rename from src/core/contracts/interfaces/IPoolAddressesProviderRegistry.sol
rename to src/contracts/interfaces/IPoolAddressesProviderRegistry.sol
diff --git a/src/core/contracts/interfaces/IPoolConfigurator.sol b/src/contracts/interfaces/IPoolConfigurator.sol
similarity index 89%
rename from src/core/contracts/interfaces/IPoolConfigurator.sol
rename to src/contracts/interfaces/IPoolConfigurator.sol
index 6ba397e5..977d316e 100644
--- a/src/core/contracts/interfaces/IPoolConfigurator.sol
+++ b/src/contracts/interfaces/IPoolConfigurator.sol
@@ -14,7 +14,7 @@ interface IPoolConfigurator {
* @dev Emitted when a reserve is initialized.
* @param asset The address of the underlying asset of the reserve
* @param aToken The address of the associated aToken contract
- * @param stableDebtToken The address of the associated stable rate debt token
+ * @param stableDebtToken, DEPRECATED in v3.2.0
* @param variableDebtToken The address of the associated variable rate debt token
* @param interestRateStrategyAddress The address of the interest rate strategy for the reserve
*/
@@ -61,13 +61,6 @@ interface IPoolConfigurator {
uint256 liquidationBonus
);
- /**
- * @dev Emitted when stable rate borrowing is enabled or disabled on a reserve
- * @param asset The address of the underlying asset of the reserve
- * @param enabled True if stable rate borrowing is enabled, false otherwise
- */
- event ReserveStableRateBorrowing(address indexed asset, bool enabled);
-
/**
* @dev Emitted when a reserve is activated or deactivated
* @param asset The address of the underlying asset of the reserve
@@ -157,20 +150,28 @@ interface IPoolConfigurator {
);
/**
- * @dev Emitted when the category of an asset in eMode is changed.
+ * @dev Emitted when an collateral configuration of an asset in an eMode is changed.
+ * @param asset The address of the underlying asset of the reserve
+ * @param categoryId The eMode category
+ * @param collateral True if the asset is enabled as collateral in the eMode, false otherwise.
+ */
+ event AssetCollateralInEModeChanged(address indexed asset, uint8 categoryId, bool collateral);
+
+ /**
+ * @dev Emitted when the borrowable configuration of an asset in an eMode changed.
* @param asset The address of the underlying asset of the reserve
- * @param oldCategoryId The old eMode asset category
- * @param newCategoryId The new eMode asset category
+ * @param categoryId The eMode category
+ * @param borrowable True if the asset is enabled as borrowable in the eMode, false otherwise.
*/
- event EModeAssetCategoryChanged(address indexed asset, uint8 oldCategoryId, uint8 newCategoryId);
+ event AssetBorrowableInEModeChanged(address indexed asset, uint8 categoryId, bool borrowable);
/**
- * @dev Emitted when a new eMode category is added.
+ * @dev Emitted when a new eMode category is added or an existing category is altered.
* @param categoryId The new eMode category id
* @param ltv The ltv for the asset category in eMode
* @param liquidationThreshold The liquidationThreshold for the asset category in eMode
* @param liquidationBonus The liquidationBonus for the asset category in eMode
- * @param oracle The optional address of the price oracle specific for this category
+ * @param oracle DEPRECATED in v3.2.0
* @param label A human readable identifier for the category
*/
event EModeCategoryAdded(
@@ -213,18 +214,6 @@ interface IPoolConfigurator {
address indexed implementation
);
- /**
- * @dev Emitted when the implementation of a stable debt token is upgraded.
- * @param asset The address of the underlying asset of the reserve
- * @param proxy The stable debt token proxy address
- * @param implementation The new aToken implementation
- */
- event StableDebtTokenUpgraded(
- address indexed asset,
- address indexed proxy,
- address indexed implementation
- );
-
/**
* @dev Emitted when the implementation of a variable debt token is upgraded.
* @param asset The address of the underlying asset of the reserve
@@ -301,14 +290,6 @@ interface IPoolConfigurator {
*/
function updateAToken(ConfiguratorInputTypes.UpdateATokenInput calldata input) external;
- /**
- * @notice Updates the stable debt token implementation for the reserve.
- * @param input The stableDebtToken update parameters
- */
- function updateStableDebtToken(
- ConfiguratorInputTypes.UpdateDebtTokenInput calldata input
- ) external;
-
/**
* @notice Updates the variable debt token implementation for the asset.
* @param input The variableDebtToken update parameters
@@ -319,7 +300,6 @@ interface IPoolConfigurator {
/**
* @notice Configures borrowing on a reserve.
- * @dev Can only be disabled (set to false) if stable borrowing is disabled
* @param asset The address of the underlying asset of the reserve
* @param enabled True if borrowing needs to be enabled, false otherwise
*/
@@ -341,14 +321,6 @@ interface IPoolConfigurator {
uint256 liquidationBonus
) external;
- /**
- * @notice Enable or disable stable rate borrowing on a reserve.
- * @dev Can only be enabled (set to true) if borrowing is enabled
- * @param asset The address of the underlying asset of the reserve
- * @param enabled True if stable rate borrowing needs to be enabled, false otherwise
- */
- function setReserveStableRateBorrowing(address asset, bool enabled) external;
-
/**
* @notice Enable or disable flashloans on a reserve
* @param asset The address of the underlying asset of the reserve
@@ -486,23 +458,28 @@ interface IPoolConfigurator {
function setUnbackedMintCap(address asset, uint256 newUnbackedMintCap) external;
/**
- * @notice Assign an efficiency mode (eMode) category to asset.
+ * @notice Enables/disables an asset to be borrowable in a selected eMode.
+ * - eMode.borrowable always has less priority then reserve.borrowable
* @param asset The address of the underlying asset of the reserve
- * @param newCategoryId The new category id of the asset
+ * @param categoryId The eMode categoryId
+ * @param borrowable True if the asset should be borrowable in the given eMode category, false otherwise.
*/
- function setAssetEModeCategory(address asset, uint8 newCategoryId) external;
+ function setAssetBorrowableInEMode(address asset, uint8 categoryId, bool borrowable) external;
/**
- * @notice Adds a new efficiency mode (eMode) category.
- * @dev If zero is provided as oracle address, the default asset oracles will be used to compute the overall debt and
- * overcollateralization of the users using this category.
- * @dev The new ltv and liquidation threshold must be greater than the base
- * ltvs and liquidation thresholds of all assets within the eMode category
+ * @notice Enables/disables an asset to be collateral in a selected eMode.
+ * @param asset The address of the underlying asset of the reserve
+ * @param categoryId The eMode categoryId
+ * @param collateral True if the asset should be collateral in the given eMode category, false otherwise.
+ */
+ function setAssetCollateralInEMode(address asset, uint8 categoryId, bool collateral) external;
+
+ /**
+ * @notice Adds a new efficiency mode (eMode) category or alters a existing one.
* @param categoryId The id of the category to be configured
* @param ltv The ltv associated with the category
* @param liquidationThreshold The liquidation threshold associated with the category
* @param liquidationBonus The liquidation bonus associated with the category
- * @param oracle The oracle associated with the category
* @param label A label identifying the category
*/
function setEModeCategory(
@@ -510,7 +487,6 @@ interface IPoolConfigurator {
uint16 ltv,
uint16 liquidationThreshold,
uint16 liquidationBonus,
- address oracle,
string calldata label
) external;
diff --git a/src/core/contracts/interfaces/IPoolDataProvider.sol b/src/contracts/interfaces/IPoolDataProvider.sol
similarity index 96%
rename from src/core/contracts/interfaces/IPoolDataProvider.sol
rename to src/contracts/interfaces/IPoolDataProvider.sol
index 2ec458b9..a9df8903 100644
--- a/src/core/contracts/interfaces/IPoolDataProvider.sol
+++ b/src/contracts/interfaces/IPoolDataProvider.sol
@@ -66,13 +66,6 @@ interface IPoolDataProvider {
bool isFrozen
);
- /**
- * @notice Returns the efficiency mode category of the reserve
- * @param asset The address of the underlying asset of the reserve
- * @return The eMode id of the reserve
- */
- function getReserveEModeCategory(address asset) external view returns (uint256);
-
/**
* @notice Returns the caps parameters of the reserve
* @param asset The address of the underlying asset of the reserve
@@ -211,7 +204,7 @@ interface IPoolDataProvider {
* @notice Returns the token addresses of the reserve
* @param asset The address of the underlying asset of the reserve
* @return aTokenAddress The AToken address of the reserve
- * @return stableDebtTokenAddress The StableDebtToken address of the reserve
+ * @return stableDebtTokenAddress DEPRECATED in v3.2.0
* @return variableDebtTokenAddress The VariableDebtToken address of the reserve
*/
function getReserveTokensAddresses(
diff --git a/src/core/contracts/interfaces/IPriceOracle.sol b/src/contracts/interfaces/IPriceOracle.sol
similarity index 100%
rename from src/core/contracts/interfaces/IPriceOracle.sol
rename to src/contracts/interfaces/IPriceOracle.sol
diff --git a/src/core/contracts/interfaces/IPriceOracleGetter.sol b/src/contracts/interfaces/IPriceOracleGetter.sol
similarity index 100%
rename from src/core/contracts/interfaces/IPriceOracleGetter.sol
rename to src/contracts/interfaces/IPriceOracleGetter.sol
diff --git a/src/core/contracts/interfaces/IPriceOracleSentinel.sol b/src/contracts/interfaces/IPriceOracleSentinel.sol
similarity index 100%
rename from src/core/contracts/interfaces/IPriceOracleSentinel.sol
rename to src/contracts/interfaces/IPriceOracleSentinel.sol
diff --git a/src/core/contracts/interfaces/IReserveInterestRateStrategy.sol b/src/contracts/interfaces/IReserveInterestRateStrategy.sol
similarity index 89%
rename from src/core/contracts/interfaces/IReserveInterestRateStrategy.sol
rename to src/contracts/interfaces/IReserveInterestRateStrategy.sol
index cdd81565..e953cce5 100644
--- a/src/core/contracts/interfaces/IReserveInterestRateStrategy.sol
+++ b/src/contracts/interfaces/IReserveInterestRateStrategy.sol
@@ -21,10 +21,9 @@ interface IReserveInterestRateStrategy {
* @notice Calculates the interest rates depending on the reserve's state and configurations
* @param params The parameters needed to calculate interest rates
* @return liquidityRate The liquidity rate expressed in ray
- * @return stableBorrowRate The stable borrow rate expressed in ray
* @return variableBorrowRate The variable borrow rate expressed in ray
*/
function calculateInterestRates(
DataTypes.CalculateInterestRatesParams memory params
- ) external view returns (uint256, uint256, uint256);
+ ) external view returns (uint256, uint256);
}
diff --git a/src/core/contracts/interfaces/IScaledBalanceToken.sol b/src/contracts/interfaces/IScaledBalanceToken.sol
similarity index 100%
rename from src/core/contracts/interfaces/IScaledBalanceToken.sol
rename to src/contracts/interfaces/IScaledBalanceToken.sol
diff --git a/src/core/contracts/interfaces/ISequencerOracle.sol b/src/contracts/interfaces/ISequencerOracle.sol
similarity index 100%
rename from src/core/contracts/interfaces/ISequencerOracle.sol
rename to src/contracts/interfaces/ISequencerOracle.sol
diff --git a/src/core/contracts/interfaces/IVariableDebtToken.sol b/src/contracts/interfaces/IVariableDebtToken.sol
similarity index 100%
rename from src/core/contracts/interfaces/IVariableDebtToken.sol
rename to src/contracts/interfaces/IVariableDebtToken.sol
diff --git a/src/core/contracts/misc/AaveOracle.sol b/src/contracts/misc/AaveOracle.sol
similarity index 100%
rename from src/core/contracts/misc/AaveOracle.sol
rename to src/contracts/misc/AaveOracle.sol
diff --git a/src/core/contracts/protocol/pool/DefaultReserveInterestRateStrategyV2.sol b/src/contracts/misc/DefaultReserveInterestRateStrategyV2.sol
similarity index 73%
rename from src/core/contracts/protocol/pool/DefaultReserveInterestRateStrategyV2.sol
rename to src/contracts/misc/DefaultReserveInterestRateStrategyV2.sol
index f90cfe91..3552cb77 100644
--- a/src/core/contracts/protocol/pool/DefaultReserveInterestRateStrategyV2.sol
+++ b/src/contracts/misc/DefaultReserveInterestRateStrategyV2.sol
@@ -1,14 +1,14 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
-import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
-import {WadRayMath} from '../libraries/math/WadRayMath.sol';
-import {PercentageMath} from '../libraries/math/PercentageMath.sol';
-import {DataTypes} from '../libraries/types/DataTypes.sol';
-import {Errors} from '../libraries/helpers/Errors.sol';
-import {IDefaultInterestRateStrategyV2} from '../../interfaces/IDefaultInterestRateStrategyV2.sol';
-import {IReserveInterestRateStrategy} from '../../interfaces/IReserveInterestRateStrategy.sol';
-import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
+import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.sol';
+import {WadRayMath} from '../protocol/libraries/math/WadRayMath.sol';
+import {PercentageMath} from '../protocol/libraries/math/PercentageMath.sol';
+import {DataTypes} from '../protocol/libraries/types/DataTypes.sol';
+import {Errors} from '../protocol/libraries/helpers/Errors.sol';
+import {IDefaultInterestRateStrategyV2} from '../interfaces/IDefaultInterestRateStrategyV2.sol';
+import {IReserveInterestRateStrategy} from '../interfaces/IReserveInterestRateStrategy.sol';
+import {IPoolAddressesProvider} from '../interfaces/IPoolAddressesProvider.sol';
/**
* @title DefaultReserveInterestRateStrategyV2 contract
@@ -22,6 +22,15 @@ contract DefaultReserveInterestRateStrategyV2 is IDefaultInterestRateStrategyV2
using WadRayMath for uint256;
using PercentageMath for uint256;
+ struct CalcInterestRatesLocalVars {
+ uint256 availableLiquidity;
+ uint256 currentVariableBorrowRate;
+ uint256 currentLiquidityRate;
+ uint256 borrowUsageRatio;
+ uint256 supplyUsageRatio;
+ uint256 availableLiquidityPlusDebt;
+ }
+
/// @inheritdoc IDefaultInterestRateStrategyV2
IPoolAddressesProvider public immutable ADDRESSES_PROVIDER;
@@ -115,35 +124,33 @@ contract DefaultReserveInterestRateStrategyV2 is IDefaultInterestRateStrategyV2
/// @inheritdoc IReserveInterestRateStrategy
function calculateInterestRates(
DataTypes.CalculateInterestRatesParams memory params
- ) external view virtual override returns (uint256, uint256, uint256) {
+ ) external view virtual override returns (uint256, uint256) {
InterestRateDataRay memory rateData = _rayifyRateData(_interestRateData[params.reserve]);
// @note This is a short circuit to allow mintable assets (ex. GHO), which by definition cannot be supplied
// and thus do not use virtual underlying balances.
if (!params.usingVirtualBalance) {
- return (0, 0, rateData.baseVariableBorrowRate);
+ return (0, rateData.baseVariableBorrowRate);
}
CalcInterestRatesLocalVars memory vars;
- vars.totalDebt = params.totalStableDebt + params.totalVariableDebt;
-
vars.currentLiquidityRate = 0;
vars.currentVariableBorrowRate = rateData.baseVariableBorrowRate;
- if (vars.totalDebt != 0) {
+ if (params.totalDebt != 0) {
vars.availableLiquidity =
params.virtualUnderlyingBalance +
params.liquidityAdded -
params.liquidityTaken;
- vars.availableLiquidityPlusDebt = vars.availableLiquidity + vars.totalDebt;
- vars.borrowUsageRatio = vars.totalDebt.rayDiv(vars.availableLiquidityPlusDebt);
- vars.supplyUsageRatio = vars.totalDebt.rayDiv(
+ vars.availableLiquidityPlusDebt = vars.availableLiquidity + params.totalDebt;
+ vars.borrowUsageRatio = params.totalDebt.rayDiv(vars.availableLiquidityPlusDebt);
+ vars.supplyUsageRatio = params.totalDebt.rayDiv(
vars.availableLiquidityPlusDebt + params.unbacked
);
} else {
- return (0, 0, vars.currentVariableBorrowRate);
+ return (0, vars.currentVariableBorrowRate);
}
if (vars.borrowUsageRatio > rateData.optimalUsageRatio) {
@@ -161,44 +168,12 @@ contract DefaultReserveInterestRateStrategyV2 is IDefaultInterestRateStrategyV2
.rayDiv(rateData.optimalUsageRatio);
}
- vars.currentLiquidityRate = _getOverallBorrowRate(
- params.totalStableDebt,
- params.totalVariableDebt,
- vars.currentVariableBorrowRate,
- params.averageStableBorrowRate
- ).rayMul(vars.supplyUsageRatio).percentMul(
- PercentageMath.PERCENTAGE_FACTOR - params.reserveFactor
- );
-
- return (vars.currentLiquidityRate, 0, vars.currentVariableBorrowRate);
- }
-
- /**
- * @dev Calculates the overall borrow rate as the weighted average between the total variable debt and total stable
- * debt
- * @param totalStableDebt The total borrowed from the reserve at a stable rate
- * @param totalVariableDebt The total borrowed from the reserve at a variable rate
- * @param currentVariableBorrowRate The current variable borrow rate of the reserve
- * @param currentAverageStableBorrowRate The current weighted average of all the stable rate loans
- * @return The weighted averaged borrow rate
- */
- function _getOverallBorrowRate(
- uint256 totalStableDebt,
- uint256 totalVariableDebt,
- uint256 currentVariableBorrowRate,
- uint256 currentAverageStableBorrowRate
- ) internal pure returns (uint256) {
- uint256 totalDebt = totalStableDebt + totalVariableDebt;
-
- uint256 weightedVariableRate = totalVariableDebt.wadToRay().rayMul(currentVariableBorrowRate);
-
- uint256 weightedStableRate = totalStableDebt.wadToRay().rayMul(currentAverageStableBorrowRate);
-
- uint256 overallBorrowRate = (weightedVariableRate + weightedStableRate).rayDiv(
- totalDebt.wadToRay()
- );
+ vars.currentLiquidityRate = vars
+ .currentVariableBorrowRate
+ .rayMul(vars.supplyUsageRatio)
+ .percentMul(PercentageMath.PERCENTAGE_FACTOR - params.reserveFactor);
- return overallBorrowRate;
+ return (vars.currentLiquidityRate, vars.currentVariableBorrowRate);
}
/**
diff --git a/src/core/contracts/protocol/configuration/PriceOracleSentinel.sol b/src/contracts/misc/PriceOracleSentinel.sol
similarity index 89%
rename from src/core/contracts/protocol/configuration/PriceOracleSentinel.sol
rename to src/contracts/misc/PriceOracleSentinel.sol
index 7947d2e6..29ffe1cb 100644
--- a/src/core/contracts/protocol/configuration/PriceOracleSentinel.sol
+++ b/src/contracts/misc/PriceOracleSentinel.sol
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.10;
-import {Errors} from '../libraries/helpers/Errors.sol';
-import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
-import {IPriceOracleSentinel} from '../../interfaces/IPriceOracleSentinel.sol';
-import {ISequencerOracle} from '../../interfaces/ISequencerOracle.sol';
-import {IACLManager} from '../../interfaces/IACLManager.sol';
+import {Errors} from '../protocol/libraries/helpers/Errors.sol';
+import {IPoolAddressesProvider} from '../interfaces/IPoolAddressesProvider.sol';
+import {IPriceOracleSentinel} from '../interfaces/IPriceOracleSentinel.sol';
+import {ISequencerOracle} from '../interfaces/ISequencerOracle.sol';
+import {IACLManager} from '../interfaces/IACLManager.sol';
/**
* @title PriceOracleSentinel
diff --git a/src/core/contracts/protocol/libraries/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol b/src/contracts/misc/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol
similarity index 95%
rename from src/core/contracts/protocol/libraries/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol
rename to src/contracts/misc/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol
index 06d2f827..252b4a4b 100644
--- a/src/core/contracts/protocol/libraries/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol
+++ b/src/contracts/misc/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
-import {BaseUpgradeabilityProxy} from '../../../dependencies/openzeppelin/upgradeability/BaseUpgradeabilityProxy.sol';
+import {BaseUpgradeabilityProxy} from '../../dependencies/openzeppelin/upgradeability/BaseUpgradeabilityProxy.sol';
/**
* @title BaseImmutableAdminUpgradeabilityProxy
diff --git a/src/core/contracts/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol b/src/contracts/misc/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol
similarity index 79%
rename from src/core/contracts/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol
rename to src/contracts/misc/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol
index 0deceb5b..6913a19d 100644
--- a/src/core/contracts/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol
+++ b/src/contracts/misc/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
-import {InitializableUpgradeabilityProxy} from '../../../dependencies/openzeppelin/upgradeability/InitializableUpgradeabilityProxy.sol';
-import {Proxy} from '../../../dependencies/openzeppelin/upgradeability/Proxy.sol';
+import {InitializableUpgradeabilityProxy} from '../../dependencies/openzeppelin/upgradeability/InitializableUpgradeabilityProxy.sol';
+import {Proxy} from '../../dependencies/openzeppelin/upgradeability/Proxy.sol';
import {BaseImmutableAdminUpgradeabilityProxy} from './BaseImmutableAdminUpgradeabilityProxy.sol';
/**
diff --git a/src/core/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol b/src/contracts/misc/aave-upgradeability/VersionedInitializable.sol
similarity index 100%
rename from src/core/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol
rename to src/contracts/misc/aave-upgradeability/VersionedInitializable.sol
diff --git a/src/core/contracts/flashloan/base/FlashLoanReceiverBase.sol b/src/contracts/misc/flashloan/base/FlashLoanReceiverBase.sol
similarity index 79%
rename from src/core/contracts/flashloan/base/FlashLoanReceiverBase.sol
rename to src/contracts/misc/flashloan/base/FlashLoanReceiverBase.sol
index cd43c2e1..55fbe6d2 100644
--- a/src/core/contracts/flashloan/base/FlashLoanReceiverBase.sol
+++ b/src/contracts/misc/flashloan/base/FlashLoanReceiverBase.sol
@@ -2,8 +2,8 @@
pragma solidity ^0.8.10;
import {IFlashLoanReceiver} from '../interfaces/IFlashLoanReceiver.sol';
-import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
-import {IPool} from '../../interfaces/IPool.sol';
+import {IPoolAddressesProvider} from '../../../interfaces/IPoolAddressesProvider.sol';
+import {IPool} from '../../../interfaces/IPool.sol';
/**
* @title FlashLoanReceiverBase
diff --git a/src/core/contracts/flashloan/base/FlashLoanSimpleReceiverBase.sol b/src/contracts/misc/flashloan/base/FlashLoanSimpleReceiverBase.sol
similarity index 80%
rename from src/core/contracts/flashloan/base/FlashLoanSimpleReceiverBase.sol
rename to src/contracts/misc/flashloan/base/FlashLoanSimpleReceiverBase.sol
index 25af62b2..2980a0cc 100644
--- a/src/core/contracts/flashloan/base/FlashLoanSimpleReceiverBase.sol
+++ b/src/contracts/misc/flashloan/base/FlashLoanSimpleReceiverBase.sol
@@ -2,8 +2,8 @@
pragma solidity ^0.8.10;
import {IFlashLoanSimpleReceiver} from '../interfaces/IFlashLoanSimpleReceiver.sol';
-import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
-import {IPool} from '../../interfaces/IPool.sol';
+import {IPoolAddressesProvider} from '../../../interfaces/IPoolAddressesProvider.sol';
+import {IPool} from '../../../interfaces/IPool.sol';
/**
* @title FlashLoanSimpleReceiverBase
diff --git a/src/core/contracts/flashloan/interfaces/IFlashLoanReceiver.sol b/src/contracts/misc/flashloan/interfaces/IFlashLoanReceiver.sol
similarity index 90%
rename from src/core/contracts/flashloan/interfaces/IFlashLoanReceiver.sol
rename to src/contracts/misc/flashloan/interfaces/IFlashLoanReceiver.sol
index fae79a9f..a3a55684 100644
--- a/src/core/contracts/flashloan/interfaces/IFlashLoanReceiver.sol
+++ b/src/contracts/misc/flashloan/interfaces/IFlashLoanReceiver.sol
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
-import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
-import {IPool} from '../../interfaces/IPool.sol';
+import {IPoolAddressesProvider} from '../../../interfaces/IPoolAddressesProvider.sol';
+import {IPool} from '../../../interfaces/IPool.sol';
/**
* @title IFlashLoanReceiver
diff --git a/src/core/contracts/flashloan/interfaces/IFlashLoanSimpleReceiver.sol b/src/contracts/misc/flashloan/interfaces/IFlashLoanSimpleReceiver.sol
similarity index 89%
rename from src/core/contracts/flashloan/interfaces/IFlashLoanSimpleReceiver.sol
rename to src/contracts/misc/flashloan/interfaces/IFlashLoanSimpleReceiver.sol
index 05c45739..bff21ae4 100644
--- a/src/core/contracts/flashloan/interfaces/IFlashLoanSimpleReceiver.sol
+++ b/src/contracts/misc/flashloan/interfaces/IFlashLoanSimpleReceiver.sol
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
-import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
-import {IPool} from '../../interfaces/IPool.sol';
+import {IPoolAddressesProvider} from '../../../interfaces/IPoolAddressesProvider.sol';
+import {IPool} from '../../../interfaces/IPool.sol';
/**
* @title IFlashLoanSimpleReceiver
diff --git a/src/periphery/contracts/mocks/ATokenMock.sol b/src/contracts/mocks/ATokenMock.sol
similarity index 100%
rename from src/periphery/contracts/mocks/ATokenMock.sol
rename to src/contracts/mocks/ATokenMock.sol
diff --git a/src/periphery/contracts/mocks/MockBadTransferStrategy.sol b/src/contracts/mocks/MockBadTransferStrategy.sol
similarity index 82%
rename from src/periphery/contracts/mocks/MockBadTransferStrategy.sol
rename to src/contracts/mocks/MockBadTransferStrategy.sol
index 2f62c89d..696b3396 100644
--- a/src/periphery/contracts/mocks/MockBadTransferStrategy.sol
+++ b/src/contracts/mocks/MockBadTransferStrategy.sol
@@ -3,8 +3,8 @@ pragma solidity ^0.8.10;
import {ITransferStrategyBase} from '../rewards/interfaces/ITransferStrategyBase.sol';
import {TransferStrategyBase} from '../rewards/transfer-strategies/TransferStrategyBase.sol';
-import {GPv2SafeERC20} from 'aave-v3-core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol';
-import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
+import {GPv2SafeERC20} from '../dependencies/gnosis/contracts/GPv2SafeERC20.sol';
+import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.sol';
/**
* @title MockBadTransferStrategy
diff --git a/src/periphery/contracts/mocks/WETH9Mock.sol b/src/contracts/mocks/WETH9Mock.sol
similarity index 72%
rename from src/periphery/contracts/mocks/WETH9Mock.sol
rename to src/contracts/mocks/WETH9Mock.sol
index 1bc1bc48..2372ffeb 100644
--- a/src/periphery/contracts/mocks/WETH9Mock.sol
+++ b/src/contracts/mocks/WETH9Mock.sol
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
-import {WETH9} from 'aave-v3-core/contracts/dependencies/weth/WETH9.sol';
-import {Ownable} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/Ownable.sol';
+import {WETH9} from '../dependencies/weth/WETH9.sol';
+import {Ownable} from '../dependencies/openzeppelin/contracts/Ownable.sol';
contract WETH9Mock is WETH9, Ownable {
constructor(string memory mockName, string memory mockSymbol, address owner) {
diff --git a/src/core/contracts/mocks/flashloan/MockFlashLoanReceiver.sol b/src/contracts/mocks/flashloan/MockFlashLoanReceiver.sol
similarity index 96%
rename from src/core/contracts/mocks/flashloan/MockFlashLoanReceiver.sol
rename to src/contracts/mocks/flashloan/MockFlashLoanReceiver.sol
index 516b4b38..f8877274 100644
--- a/src/core/contracts/mocks/flashloan/MockFlashLoanReceiver.sol
+++ b/src/contracts/mocks/flashloan/MockFlashLoanReceiver.sol
@@ -4,7 +4,7 @@ pragma solidity ^0.8.10;
import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
import {GPv2SafeERC20} from '../../dependencies/gnosis/contracts/GPv2SafeERC20.sol';
import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
-import {FlashLoanReceiverBase} from '../../flashloan/base/FlashLoanReceiverBase.sol';
+import {FlashLoanReceiverBase} from '../../misc/flashloan/base/FlashLoanReceiverBase.sol';
import {MintableERC20} from '../tokens/MintableERC20.sol';
contract MockFlashLoanReceiver is FlashLoanReceiverBase {
diff --git a/src/core/contracts/mocks/flashloan/MockSimpleFlashLoanReceiver.sol b/src/contracts/mocks/flashloan/MockSimpleFlashLoanReceiver.sol
similarity index 95%
rename from src/core/contracts/mocks/flashloan/MockSimpleFlashLoanReceiver.sol
rename to src/contracts/mocks/flashloan/MockSimpleFlashLoanReceiver.sol
index 1edd24a2..b3be47bc 100644
--- a/src/core/contracts/mocks/flashloan/MockSimpleFlashLoanReceiver.sol
+++ b/src/contracts/mocks/flashloan/MockSimpleFlashLoanReceiver.sol
@@ -6,7 +6,7 @@ import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
import {GPv2SafeERC20} from '../../dependencies/gnosis/contracts/GPv2SafeERC20.sol';
import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol';
import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
-import {FlashLoanSimpleReceiverBase} from '../../flashloan/base/FlashLoanSimpleReceiverBase.sol';
+import {FlashLoanSimpleReceiverBase} from '../../misc/flashloan/base/FlashLoanSimpleReceiverBase.sol';
import {MintableERC20} from '../tokens/MintableERC20.sol';
contract MockFlashLoanSimpleReceiver is FlashLoanSimpleReceiverBase {
diff --git a/src/core/contracts/mocks/helpers/MockIncentivesController.sol b/src/contracts/mocks/helpers/MockIncentivesController.sol
similarity index 100%
rename from src/core/contracts/mocks/helpers/MockIncentivesController.sol
rename to src/contracts/mocks/helpers/MockIncentivesController.sol
diff --git a/src/core/contracts/mocks/helpers/MockL2Pool.sol b/src/contracts/mocks/helpers/MockL2Pool.sol
similarity index 68%
rename from src/core/contracts/mocks/helpers/MockL2Pool.sol
rename to src/contracts/mocks/helpers/MockL2Pool.sol
index c37a7f70..9035cddd 100644
--- a/src/core/contracts/mocks/helpers/MockL2Pool.sol
+++ b/src/contracts/mocks/helpers/MockL2Pool.sol
@@ -2,8 +2,8 @@
pragma solidity ^0.8.10;
import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
-import {L2PoolInstance, PoolInstance} from '../../../instances/L2PoolInstance.sol';
-import {VersionedInitializable} from '../../protocol/libraries/aave-upgradeability/VersionedInitializable.sol';
+import {L2PoolInstance, PoolInstance} from '../../instances/L2PoolInstance.sol';
+import {VersionedInitializable} from '../../misc/aave-upgradeability/VersionedInitializable.sol';
contract MockL2Pool is L2PoolInstance {
function getRevision()
diff --git a/src/core/contracts/mocks/helpers/MockPeripheryContract.sol b/src/contracts/mocks/helpers/MockPeripheryContract.sol
similarity index 100%
rename from src/core/contracts/mocks/helpers/MockPeripheryContract.sol
rename to src/contracts/mocks/helpers/MockPeripheryContract.sol
diff --git a/src/core/contracts/mocks/helpers/MockPool.sol b/src/contracts/mocks/helpers/MockPool.sol
similarity index 92%
rename from src/core/contracts/mocks/helpers/MockPool.sol
rename to src/contracts/mocks/helpers/MockPool.sol
index c66b83a6..7a27bf14 100644
--- a/src/core/contracts/mocks/helpers/MockPool.sol
+++ b/src/contracts/mocks/helpers/MockPool.sol
@@ -3,7 +3,7 @@ pragma solidity ^0.8.10;
import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
-import {PoolInstance} from '../../../instances/PoolInstance.sol';
+import {PoolInstance} from '../../instances/PoolInstance.sol';
contract MockPoolInherited is PoolInstance {
uint16 internal _maxNumberOfReserves = 128;
diff --git a/src/core/contracts/mocks/helpers/MockReserveConfiguration.sol b/src/contracts/mocks/helpers/MockReserveConfiguration.sol
similarity index 84%
rename from src/core/contracts/mocks/helpers/MockReserveConfiguration.sol
rename to src/contracts/mocks/helpers/MockReserveConfiguration.sol
index cce1cc9f..c5ef954c 100644
--- a/src/core/contracts/mocks/helpers/MockReserveConfiguration.sol
+++ b/src/contracts/mocks/helpers/MockReserveConfiguration.sol
@@ -69,16 +69,6 @@ contract MockReserveConfiguration {
return configuration.getBorrowingEnabled();
}
- function setStableRateBorrowingEnabled(bool enabled) external {
- DataTypes.ReserveConfigurationMap memory config = configuration;
- config.setStableRateBorrowingEnabled(enabled);
- configuration = config;
- }
-
- function getStableRateBorrowingEnabled() external view returns (bool) {
- return configuration.getStableRateBorrowingEnabled();
- }
-
function setReserveFactor(uint256 reserveFactor) external {
DataTypes.ReserveConfigurationMap memory config = configuration;
config.setReserveFactor(reserveFactor);
@@ -99,16 +89,6 @@ contract MockReserveConfiguration {
return configuration.getBorrowCap();
}
- function getEModeCategory() external view returns (uint256) {
- return configuration.getEModeCategory();
- }
-
- function setEModeCategory(uint256 categoryId) external {
- DataTypes.ReserveConfigurationMap memory config = configuration;
- config.setEModeCategory(categoryId);
- configuration = config;
- }
-
function setFlashLoanEnabled(bool enabled) external {
DataTypes.ReserveConfigurationMap memory config = configuration;
config.setFlashLoanEnabled(enabled);
@@ -149,15 +129,11 @@ contract MockReserveConfiguration {
return configuration.getUnbackedMintCap();
}
- function getFlags() external view returns (bool, bool, bool, bool, bool) {
+ function getFlags() external view returns (bool, bool, bool, bool) {
return configuration.getFlags();
}
- function getParams()
- external
- view
- returns (uint256, uint256, uint256, uint256, uint256, uint256)
- {
+ function getParams() external view returns (uint256, uint256, uint256, uint256, uint256) {
return configuration.getParams();
}
diff --git a/src/core/contracts/mocks/oracle/CLAggregators/MockAggregator.sol b/src/contracts/mocks/oracle/CLAggregators/MockAggregator.sol
similarity index 100%
rename from src/core/contracts/mocks/oracle/CLAggregators/MockAggregator.sol
rename to src/contracts/mocks/oracle/CLAggregators/MockAggregator.sol
diff --git a/src/core/contracts/mocks/oracle/PriceOracle.sol b/src/contracts/mocks/oracle/PriceOracle.sol
similarity index 100%
rename from src/core/contracts/mocks/oracle/PriceOracle.sol
rename to src/contracts/mocks/oracle/PriceOracle.sol
diff --git a/src/core/contracts/mocks/oracle/SequencerOracle.sol b/src/contracts/mocks/oracle/SequencerOracle.sol
similarity index 100%
rename from src/core/contracts/mocks/oracle/SequencerOracle.sol
rename to src/contracts/mocks/oracle/SequencerOracle.sol
diff --git a/src/periphery/contracts/mocks/swap/MockParaSwapAugustus.sol b/src/contracts/mocks/swap/MockParaSwapAugustus.sol
similarity index 91%
rename from src/periphery/contracts/mocks/swap/MockParaSwapAugustus.sol
rename to src/contracts/mocks/swap/MockParaSwapAugustus.sol
index cf41670b..5970c3b7 100644
--- a/src/periphery/contracts/mocks/swap/MockParaSwapAugustus.sol
+++ b/src/contracts/mocks/swap/MockParaSwapAugustus.sol
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
-import {IParaSwapAugustus} from '../../adapters/paraswap/interfaces/IParaSwapAugustus.sol';
+import {IParaSwapAugustus} from '../../extensions/paraswap-adapters/interfaces/IParaSwapAugustus.sol';
import {MockParaSwapTokenTransferProxy} from './MockParaSwapTokenTransferProxy.sol';
-import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
-import {MintableERC20} from 'aave-v3-core/contracts/mocks/tokens/MintableERC20.sol';
+import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
+import {MintableERC20} from '../tokens/MintableERC20.sol';
contract MockParaSwapAugustus is IParaSwapAugustus {
MockParaSwapTokenTransferProxy immutable TOKEN_TRANSFER_PROXY;
diff --git a/src/periphery/contracts/mocks/swap/MockParaSwapAugustusRegistry.sol b/src/contracts/mocks/swap/MockParaSwapAugustusRegistry.sol
similarity index 74%
rename from src/periphery/contracts/mocks/swap/MockParaSwapAugustusRegistry.sol
rename to src/contracts/mocks/swap/MockParaSwapAugustusRegistry.sol
index 5e34d659..82fa93f8 100644
--- a/src/periphery/contracts/mocks/swap/MockParaSwapAugustusRegistry.sol
+++ b/src/contracts/mocks/swap/MockParaSwapAugustusRegistry.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
-import {IParaSwapAugustusRegistry} from '../../adapters/paraswap/interfaces/IParaSwapAugustusRegistry.sol';
+import {IParaSwapAugustusRegistry} from '../../extensions/paraswap-adapters/interfaces/IParaSwapAugustusRegistry.sol';
contract MockParaSwapAugustusRegistry is IParaSwapAugustusRegistry {
address immutable AUGUSTUS;
diff --git a/src/periphery/contracts/mocks/swap/MockParaSwapFeeClaimer.sol b/src/contracts/mocks/swap/MockParaSwapFeeClaimer.sol
similarity index 88%
rename from src/periphery/contracts/mocks/swap/MockParaSwapFeeClaimer.sol
rename to src/contracts/mocks/swap/MockParaSwapFeeClaimer.sol
index efec5e9d..80f41d19 100644
--- a/src/periphery/contracts/mocks/swap/MockParaSwapFeeClaimer.sol
+++ b/src/contracts/mocks/swap/MockParaSwapFeeClaimer.sol
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
-import {IFeeClaimer} from '../../adapters/paraswap/interfaces/IFeeClaimer.sol';
+import {IFeeClaimer} from '../../extensions/paraswap-adapters/interfaces/IFeeClaimer.sol';
import {MockParaSwapTokenTransferProxy} from './MockParaSwapTokenTransferProxy.sol';
-import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
-import {MintableERC20} from 'aave-v3-core/contracts/mocks/tokens/MintableERC20.sol';
+import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
+import {MintableERC20} from '../tokens/MintableERC20.sol';
contract MockParaSwapFeeClaimer is IFeeClaimer {
MockParaSwapTokenTransferProxy immutable TOKEN_TRANSFER_PROXY;
diff --git a/src/periphery/contracts/mocks/swap/MockParaSwapTokenTransferProxy.sol b/src/contracts/mocks/swap/MockParaSwapTokenTransferProxy.sol
similarity index 60%
rename from src/periphery/contracts/mocks/swap/MockParaSwapTokenTransferProxy.sol
rename to src/contracts/mocks/swap/MockParaSwapTokenTransferProxy.sol
index 711012e8..b36e6a44 100644
--- a/src/periphery/contracts/mocks/swap/MockParaSwapTokenTransferProxy.sol
+++ b/src/contracts/mocks/swap/MockParaSwapTokenTransferProxy.sol
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
-import {Ownable} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/Ownable.sol';
-import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
+import {Ownable} from '../../dependencies/openzeppelin/contracts/Ownable.sol';
+import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
contract MockParaSwapTokenTransferProxy is Ownable {
function transferFrom(
diff --git a/src/periphery/contracts/mocks/testnet-helpers/Faucet.sol b/src/contracts/mocks/testnet-helpers/Faucet.sol
similarity index 95%
rename from src/periphery/contracts/mocks/testnet-helpers/Faucet.sol
rename to src/contracts/mocks/testnet-helpers/Faucet.sol
index 539aee46..47a2a3f6 100644
--- a/src/periphery/contracts/mocks/testnet-helpers/Faucet.sol
+++ b/src/contracts/mocks/testnet-helpers/Faucet.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
-import {Ownable} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/Ownable.sol';
+import {Ownable} from '../../dependencies/openzeppelin/contracts/Ownable.sol';
import {TestnetERC20} from './TestnetERC20.sol';
import {IFaucet} from './IFaucet.sol';
diff --git a/src/periphery/contracts/mocks/testnet-helpers/IFaucet.sol b/src/contracts/mocks/testnet-helpers/IFaucet.sol
similarity index 100%
rename from src/periphery/contracts/mocks/testnet-helpers/IFaucet.sol
rename to src/contracts/mocks/testnet-helpers/IFaucet.sol
diff --git a/src/periphery/contracts/mocks/testnet-helpers/TestnetERC20.sol b/src/contracts/mocks/testnet-helpers/TestnetERC20.sol
similarity index 90%
rename from src/periphery/contracts/mocks/testnet-helpers/TestnetERC20.sol
rename to src/contracts/mocks/testnet-helpers/TestnetERC20.sol
index 58e4ddf2..efe94186 100644
--- a/src/periphery/contracts/mocks/testnet-helpers/TestnetERC20.sol
+++ b/src/contracts/mocks/testnet-helpers/TestnetERC20.sol
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
-import {Ownable} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/Ownable.sol';
-import {ERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/ERC20.sol';
-import {IERC20WithPermit} from 'aave-v3-core/contracts/interfaces/IERC20WithPermit.sol';
+import {Ownable} from '../../dependencies/openzeppelin/contracts/Ownable.sol';
+import {ERC20} from '../../dependencies/openzeppelin/contracts/ERC20.sol';
+import {IERC20WithPermit} from '../../interfaces/IERC20WithPermit.sol';
/**
* @title TestnetERC20
diff --git a/src/core/contracts/mocks/tests/FlashloanAttacker.sol b/src/contracts/mocks/tests/FlashloanAttacker.sol
similarity index 95%
rename from src/core/contracts/mocks/tests/FlashloanAttacker.sol
rename to src/contracts/mocks/tests/FlashloanAttacker.sol
index 63d09b1b..9f32fbd9 100644
--- a/src/core/contracts/mocks/tests/FlashloanAttacker.sol
+++ b/src/contracts/mocks/tests/FlashloanAttacker.sol
@@ -6,7 +6,7 @@ import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
import {GPv2SafeERC20} from '../../dependencies/gnosis/contracts/GPv2SafeERC20.sol';
import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol';
import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
-import {FlashLoanSimpleReceiverBase} from '../../flashloan/base/FlashLoanSimpleReceiverBase.sol';
+import {FlashLoanSimpleReceiverBase} from '../../misc/flashloan/base/FlashLoanSimpleReceiverBase.sol';
import {MintableERC20} from '../tokens/MintableERC20.sol';
import {IPool} from '../../interfaces/IPool.sol';
import {DataTypes} from '../../protocol/libraries/types/DataTypes.sol';
diff --git a/src/core/contracts/mocks/tests/MathUtilsWrapper.sol b/src/contracts/mocks/tests/MathUtilsWrapper.sol
similarity index 100%
rename from src/core/contracts/mocks/tests/MathUtilsWrapper.sol
rename to src/contracts/mocks/tests/MathUtilsWrapper.sol
diff --git a/src/core/contracts/mocks/tests/MockReserveInterestRateStrategy.sol b/src/contracts/mocks/tests/MockReserveInterestRateStrategy.sol
similarity index 69%
rename from src/core/contracts/mocks/tests/MockReserveInterestRateStrategy.sol
rename to src/contracts/mocks/tests/MockReserveInterestRateStrategy.sol
index 082d7651..d0df1d3d 100644
--- a/src/core/contracts/mocks/tests/MockReserveInterestRateStrategy.sol
+++ b/src/contracts/mocks/tests/MockReserveInterestRateStrategy.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
-import {DefaultReserveInterestRateStrategyV2} from '../../protocol/pool/DefaultReserveInterestRateStrategyV2.sol';
+import {DefaultReserveInterestRateStrategyV2} from '../../misc/DefaultReserveInterestRateStrategyV2.sol';
import {DataTypes} from '../../protocol/libraries/types/DataTypes.sol';
contract MockReserveInterestRateStrategy is DefaultReserveInterestRateStrategyV2 {
@@ -20,12 +20,7 @@ contract MockReserveInterestRateStrategy is DefaultReserveInterestRateStrategyV2
function calculateInterestRates(
DataTypes.CalculateInterestRatesParams memory
- )
- public
- view
- override
- returns (uint256 liquidityRate, uint256 stableBorrowRate, uint256 variableBorrowRate)
- {
- return (_liquidityRate, 0, _variableBorrowRate);
+ ) public view override returns (uint256 liquidityRate, uint256 variableBorrowRate) {
+ return (_liquidityRate, _variableBorrowRate);
}
}
diff --git a/src/core/contracts/mocks/tests/PercentageMathWrapper.sol b/src/contracts/mocks/tests/PercentageMathWrapper.sol
similarity index 100%
rename from src/core/contracts/mocks/tests/PercentageMathWrapper.sol
rename to src/contracts/mocks/tests/PercentageMathWrapper.sol
diff --git a/src/core/contracts/mocks/tests/WadRayMathWrapper.sol b/src/contracts/mocks/tests/WadRayMathWrapper.sol
similarity index 100%
rename from src/core/contracts/mocks/tests/WadRayMathWrapper.sol
rename to src/contracts/mocks/tests/WadRayMathWrapper.sol
diff --git a/src/core/contracts/mocks/tokens/MintableDelegationERC20.sol b/src/contracts/mocks/tokens/MintableDelegationERC20.sol
similarity index 100%
rename from src/core/contracts/mocks/tokens/MintableDelegationERC20.sol
rename to src/contracts/mocks/tokens/MintableDelegationERC20.sol
diff --git a/src/core/contracts/mocks/tokens/MintableERC20.sol b/src/contracts/mocks/tokens/MintableERC20.sol
similarity index 100%
rename from src/core/contracts/mocks/tokens/MintableERC20.sol
rename to src/contracts/mocks/tokens/MintableERC20.sol
diff --git a/src/core/contracts/mocks/tokens/MockATokenRepayment.sol b/src/contracts/mocks/tokens/MockATokenRepayment.sol
similarity index 88%
rename from src/core/contracts/mocks/tokens/MockATokenRepayment.sol
rename to src/contracts/mocks/tokens/MockATokenRepayment.sol
index 4e2c0dd2..c0f77de5 100644
--- a/src/core/contracts/mocks/tokens/MockATokenRepayment.sol
+++ b/src/contracts/mocks/tokens/MockATokenRepayment.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
-import {ATokenInstance} from '../../../instances/ATokenInstance.sol';
+import {ATokenInstance} from '../../instances/ATokenInstance.sol';
import {IPool} from '../../interfaces/IPool.sol';
contract MockATokenRepayment is ATokenInstance {
diff --git a/src/contracts/mocks/tokens/MockDebtTokens.sol b/src/contracts/mocks/tokens/MockDebtTokens.sol
new file mode 100644
index 00000000..a75db430
--- /dev/null
+++ b/src/contracts/mocks/tokens/MockDebtTokens.sol
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: MIT
+pragma solidity ^0.8.10;
+
+import {VariableDebtTokenInstance} from '../../instances/VariableDebtTokenInstance.sol';
+import {IPool} from '../../interfaces/IPool.sol';
+
+contract MockVariableDebtToken is VariableDebtTokenInstance {
+ constructor(IPool pool) VariableDebtTokenInstance(pool) {}
+
+ function getRevision() internal pure override returns (uint256) {
+ return 0x2;
+ }
+}
diff --git a/src/core/contracts/mocks/tokens/MockScaledToken.sol b/src/contracts/mocks/tokens/MockScaledToken.sol
similarity index 85%
rename from src/core/contracts/mocks/tokens/MockScaledToken.sol
rename to src/contracts/mocks/tokens/MockScaledToken.sol
index 854f4356..f3a26e2e 100644
--- a/src/core/contracts/mocks/tokens/MockScaledToken.sol
+++ b/src/contracts/mocks/tokens/MockScaledToken.sol
@@ -1,7 +1,8 @@
+// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
-import 'aave-v3-core/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol';
-import 'aave-v3-core/contracts/protocol/libraries/math/WadRayMath.sol';
+import '../../protocol/tokenization/base/ScaledBalanceTokenBase.sol';
+import '../../protocol/libraries/math/WadRayMath.sol';
contract MockScaledToken is ScaledBalanceTokenBase {
using WadRayMath for uint256;
diff --git a/src/core/contracts/mocks/tokens/WETH9Mocked.sol b/src/contracts/mocks/tokens/WETH9Mocked.sol
similarity index 100%
rename from src/core/contracts/mocks/tokens/WETH9Mocked.sol
rename to src/contracts/mocks/tokens/WETH9Mocked.sol
diff --git a/src/core/contracts/mocks/upgradeability/MockAToken.sol b/src/contracts/mocks/upgradeability/MockAToken.sol
similarity index 80%
rename from src/core/contracts/mocks/upgradeability/MockAToken.sol
rename to src/contracts/mocks/upgradeability/MockAToken.sol
index bcdc8c1c..14bbf1a8 100644
--- a/src/core/contracts/mocks/upgradeability/MockAToken.sol
+++ b/src/contracts/mocks/upgradeability/MockAToken.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
-import {ATokenInstance} from '../../../instances/ATokenInstance.sol';
+import {ATokenInstance} from '../../instances/ATokenInstance.sol';
import {IPool} from '../../interfaces/IPool.sol';
contract MockAToken is ATokenInstance {
diff --git a/src/core/contracts/mocks/upgradeability/MockInitializableImplementation.sol b/src/contracts/mocks/upgradeability/MockInitializableImplementation.sol
similarity index 96%
rename from src/core/contracts/mocks/upgradeability/MockInitializableImplementation.sol
rename to src/contracts/mocks/upgradeability/MockInitializableImplementation.sol
index 9f63a598..ed48f44b 100644
--- a/src/core/contracts/mocks/upgradeability/MockInitializableImplementation.sol
+++ b/src/contracts/mocks/upgradeability/MockInitializableImplementation.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
-import {VersionedInitializable} from '../../protocol/libraries/aave-upgradeability/VersionedInitializable.sol';
+import {VersionedInitializable} from '../../misc/aave-upgradeability/VersionedInitializable.sol';
import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
contract MockInitializableImple is VersionedInitializable {
diff --git a/src/core/contracts/mocks/upgradeability/MockVariableDebtToken.sol b/src/contracts/mocks/upgradeability/MockVariableDebtToken.sol
similarity index 77%
rename from src/core/contracts/mocks/upgradeability/MockVariableDebtToken.sol
rename to src/contracts/mocks/upgradeability/MockVariableDebtToken.sol
index 211821f5..a75db430 100644
--- a/src/core/contracts/mocks/upgradeability/MockVariableDebtToken.sol
+++ b/src/contracts/mocks/upgradeability/MockVariableDebtToken.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
-import {VariableDebtTokenInstance} from '../../../instances/VariableDebtTokenInstance.sol';
+import {VariableDebtTokenInstance} from '../../instances/VariableDebtTokenInstance.sol';
import {IPool} from '../../interfaces/IPool.sol';
contract MockVariableDebtToken is VariableDebtTokenInstance {
diff --git a/src/core/contracts/protocol/configuration/ACLManager.sol b/src/contracts/protocol/configuration/ACLManager.sol
similarity index 100%
rename from src/core/contracts/protocol/configuration/ACLManager.sol
rename to src/contracts/protocol/configuration/ACLManager.sol
diff --git a/src/core/contracts/protocol/configuration/PoolAddressesProvider.sol b/src/contracts/protocol/configuration/PoolAddressesProvider.sol
similarity index 98%
rename from src/core/contracts/protocol/configuration/PoolAddressesProvider.sol
rename to src/contracts/protocol/configuration/PoolAddressesProvider.sol
index 06fa9333..009f4e5c 100644
--- a/src/core/contracts/protocol/configuration/PoolAddressesProvider.sol
+++ b/src/contracts/protocol/configuration/PoolAddressesProvider.sol
@@ -3,7 +3,7 @@ pragma solidity ^0.8.10;
import {Ownable} from '../../dependencies/openzeppelin/contracts/Ownable.sol';
import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
-import {InitializableImmutableAdminUpgradeabilityProxy} from '../libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol';
+import {InitializableImmutableAdminUpgradeabilityProxy} from '../../misc/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol';
/**
* @title PoolAddressesProvider
diff --git a/src/core/contracts/protocol/configuration/PoolAddressesProviderRegistry.sol b/src/contracts/protocol/configuration/PoolAddressesProviderRegistry.sol
similarity index 100%
rename from src/core/contracts/protocol/configuration/PoolAddressesProviderRegistry.sol
rename to src/contracts/protocol/configuration/PoolAddressesProviderRegistry.sol
diff --git a/src/contracts/protocol/libraries/configuration/EModeConfiguration.sol b/src/contracts/protocol/libraries/configuration/EModeConfiguration.sol
new file mode 100644
index 00000000..3bb69ef0
--- /dev/null
+++ b/src/contracts/protocol/libraries/configuration/EModeConfiguration.sol
@@ -0,0 +1,53 @@
+// SPDX-License-Identifier: MIT
+pragma solidity ^0.8.0;
+
+import {Errors} from '../helpers/Errors.sol';
+import {DataTypes} from '../types/DataTypes.sol';
+import {ReserveConfiguration} from './ReserveConfiguration.sol';
+
+/**
+ * @title EModeConfiguration library
+ * @author BGD Labs
+ * @notice Implements the bitmap logic to handle the eMode configuration
+ */
+library EModeConfiguration {
+ /**
+ * @notice Sets a bit in a given bitmap that represents the reserve index range
+ * @dev The supplied bitmap is supposed to be a uint128 in which each bit represents a reserve
+ * @param bitmap The bitmap
+ * @param reserveIndex The index of the reserve in the bitmap
+ * @param enabled True if the reserveIndex should be enabled on the bitmap, false otherwise
+ * @return The altered bitmap
+ */
+ function setReserveBitmapBit(
+ uint128 bitmap,
+ uint256 reserveIndex,
+ bool enabled
+ ) internal pure returns (uint128) {
+ unchecked {
+ require(reserveIndex < ReserveConfiguration.MAX_RESERVES_COUNT, Errors.INVALID_RESERVE_INDEX);
+ uint128 bit = uint128(1 << reserveIndex);
+ if (enabled) {
+ return bitmap | bit;
+ } else {
+ return bitmap & ~bit;
+ }
+ }
+ }
+
+ /**
+ * @notice Validates if a reserveIndex is flagged as enabled on a given bitmap
+ * @param bitmap The bitmap
+ * @param reserveIndex The index of the reserve in the bitmap
+ * @return True if the reserveindex is flagged true
+ */
+ function isReserveEnabledOnBitmap(
+ uint128 bitmap,
+ uint256 reserveIndex
+ ) internal pure returns (bool) {
+ unchecked {
+ require(reserveIndex < ReserveConfiguration.MAX_RESERVES_COUNT, Errors.INVALID_RESERVE_INDEX);
+ return (bitmap >> reserveIndex) & 1 != 0;
+ }
+ }
+}
diff --git a/src/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol b/src/contracts/protocol/libraries/configuration/ReserveConfiguration.sol
similarity index 89%
rename from src/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol
rename to src/contracts/protocol/libraries/configuration/ReserveConfiguration.sol
index 0408f3ce..43987f47 100644
--- a/src/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol
+++ b/src/contracts/protocol/libraries/configuration/ReserveConfiguration.sol
@@ -17,7 +17,6 @@ library ReserveConfiguration {
uint256 internal constant ACTIVE_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFF; // prettier-ignore
uint256 internal constant FROZEN_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDFFFFFFFFFFFFFF; // prettier-ignore
uint256 internal constant BORROWING_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFFFFFFFFFFF; // prettier-ignore
- uint256 internal constant STABLE_BORROWING_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFFFFF; // prettier-ignore
uint256 internal constant PAUSED_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFF; // prettier-ignore
uint256 internal constant BORROWABLE_IN_ISOLATION_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDFFFFFFFFFFFFFFF; // prettier-ignore
uint256 internal constant SILOED_BORROWING_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFFFFFFFFFFFF; // prettier-ignore
@@ -26,7 +25,7 @@ library ReserveConfiguration {
uint256 internal constant BORROW_CAP_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000FFFFFFFFFFFFFFFFFFFF; // prettier-ignore
uint256 internal constant SUPPLY_CAP_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFF000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF; // prettier-ignore
uint256 internal constant LIQUIDATION_PROTOCOL_FEE_MASK = 0xFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; // prettier-ignore
- uint256 internal constant EMODE_CATEGORY_MASK = 0xFFFFFFFFFFFFFFFFFFFF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; // prettier-ignore
+ //@notice there is an unoccupied hole of 8 bits from 168 to 176 left from pre 3.2 eModeCategory
uint256 internal constant UNBACKED_MINT_CAP_MASK = 0xFFFFFFFFFFF000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; // prettier-ignore
uint256 internal constant DEBT_CEILING_MASK = 0xF0000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; // prettier-ignore
uint256 internal constant VIRTUAL_ACC_ACTIVE_MASK = 0xEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; // prettier-ignore
@@ -38,7 +37,6 @@ library ReserveConfiguration {
uint256 internal constant IS_ACTIVE_START_BIT_POSITION = 56;
uint256 internal constant IS_FROZEN_START_BIT_POSITION = 57;
uint256 internal constant BORROWING_ENABLED_START_BIT_POSITION = 58;
- uint256 internal constant STABLE_BORROWING_ENABLED_START_BIT_POSITION = 59;
uint256 internal constant IS_PAUSED_START_BIT_POSITION = 60;
uint256 internal constant BORROWABLE_IN_ISOLATION_START_BIT_POSITION = 61;
uint256 internal constant SILOED_BORROWING_START_BIT_POSITION = 62;
@@ -47,7 +45,7 @@ library ReserveConfiguration {
uint256 internal constant BORROW_CAP_START_BIT_POSITION = 80;
uint256 internal constant SUPPLY_CAP_START_BIT_POSITION = 116;
uint256 internal constant LIQUIDATION_PROTOCOL_FEE_START_BIT_POSITION = 152;
- uint256 internal constant EMODE_CATEGORY_START_BIT_POSITION = 168;
+ //@notice there is an unoccupied hole of 8 bits from 168 to 176 left from pre 3.2 eModeCategory
uint256 internal constant UNBACKED_MINT_CAP_START_BIT_POSITION = 176;
uint256 internal constant DEBT_CEILING_START_BIT_POSITION = 212;
uint256 internal constant VIRTUAL_ACC_START_BIT_POSITION = 252;
@@ -60,7 +58,6 @@ library ReserveConfiguration {
uint256 internal constant MAX_VALID_BORROW_CAP = 68719476735;
uint256 internal constant MAX_VALID_SUPPLY_CAP = 68719476735;
uint256 internal constant MAX_VALID_LIQUIDATION_PROTOCOL_FEE = 65535;
- uint256 internal constant MAX_VALID_EMODE_CATEGORY = 255;
uint256 internal constant MAX_VALID_UNBACKED_MINT_CAP = 68719476735;
uint256 internal constant MAX_VALID_DEBT_CEILING = 1099511627775;
@@ -311,31 +308,6 @@ library ReserveConfiguration {
return (self.data & ~BORROWING_MASK) != 0;
}
- /**
- * @notice Enables or disables stable rate borrowing on the reserve
- * @param self The reserve configuration
- * @param enabled True if the stable rate borrowing needs to be enabled, false otherwise
- */
- function setStableRateBorrowingEnabled(
- DataTypes.ReserveConfigurationMap memory self,
- bool enabled
- ) internal pure {
- self.data =
- (self.data & STABLE_BORROWING_MASK) |
- (uint256(enabled ? 1 : 0) << STABLE_BORROWING_ENABLED_START_BIT_POSITION);
- }
-
- /**
- * @notice Gets the stable rate borrowing state of the reserve
- * @param self The reserve configuration
- * @return The stable rate borrowing state
- */
- function getStableRateBorrowingEnabled(
- DataTypes.ReserveConfigurationMap memory self
- ) internal pure returns (bool) {
- return (self.data & ~STABLE_BORROWING_MASK) != 0;
- }
-
/**
* @notice Sets the reserve factor of the reserve
* @param self The reserve configuration
@@ -496,31 +468,6 @@ library ReserveConfiguration {
return (self.data & ~UNBACKED_MINT_CAP_MASK) >> UNBACKED_MINT_CAP_START_BIT_POSITION;
}
- /**
- * @notice Sets the eMode asset category
- * @param self The reserve configuration
- * @param category The asset category when the user selects the eMode
- */
- function setEModeCategory(
- DataTypes.ReserveConfigurationMap memory self,
- uint256 category
- ) internal pure {
- require(category <= MAX_VALID_EMODE_CATEGORY, Errors.INVALID_EMODE_CATEGORY);
-
- self.data = (self.data & EMODE_CATEGORY_MASK) | (category << EMODE_CATEGORY_START_BIT_POSITION);
- }
-
- /**
- * @dev Gets the eMode asset category
- * @param self The reserve configuration
- * @return The eMode category for the asset
- */
- function getEModeCategory(
- DataTypes.ReserveConfigurationMap memory self
- ) internal pure returns (uint256) {
- return (self.data & ~EMODE_CATEGORY_MASK) >> EMODE_CATEGORY_START_BIT_POSITION;
- }
-
/**
* @notice Sets the flashloanable flag for the reserve
* @param self The reserve configuration
@@ -579,19 +526,17 @@ library ReserveConfiguration {
* @return The state flag representing active
* @return The state flag representing frozen
* @return The state flag representing borrowing enabled
- * @return The state flag representing stableRateBorrowing enabled
* @return The state flag representing paused
*/
function getFlags(
DataTypes.ReserveConfigurationMap memory self
- ) internal pure returns (bool, bool, bool, bool, bool) {
+ ) internal pure returns (bool, bool, bool, bool) {
uint256 dataLocal = self.data;
return (
(dataLocal & ~ACTIVE_MASK) != 0,
(dataLocal & ~FROZEN_MASK) != 0,
(dataLocal & ~BORROWING_MASK) != 0,
- (dataLocal & ~STABLE_BORROWING_MASK) != 0,
(dataLocal & ~PAUSED_MASK) != 0
);
}
@@ -604,11 +549,10 @@ library ReserveConfiguration {
* @return The state param representing liquidation bonus
* @return The state param representing reserve decimals
* @return The state param representing reserve factor
- * @return The state param representing eMode category
*/
function getParams(
DataTypes.ReserveConfigurationMap memory self
- ) internal pure returns (uint256, uint256, uint256, uint256, uint256, uint256) {
+ ) internal pure returns (uint256, uint256, uint256, uint256, uint256) {
uint256 dataLocal = self.data;
return (
@@ -616,8 +560,7 @@ library ReserveConfiguration {
(dataLocal & ~LIQUIDATION_THRESHOLD_MASK) >> LIQUIDATION_THRESHOLD_START_BIT_POSITION,
(dataLocal & ~LIQUIDATION_BONUS_MASK) >> LIQUIDATION_BONUS_START_BIT_POSITION,
(dataLocal & ~DECIMALS_MASK) >> RESERVE_DECIMALS_START_BIT_POSITION,
- (dataLocal & ~RESERVE_FACTOR_MASK) >> RESERVE_FACTOR_START_BIT_POSITION,
- (dataLocal & ~EMODE_CATEGORY_MASK) >> EMODE_CATEGORY_START_BIT_POSITION
+ (dataLocal & ~RESERVE_FACTOR_MASK) >> RESERVE_FACTOR_START_BIT_POSITION
);
}
diff --git a/src/core/contracts/protocol/libraries/configuration/UserConfiguration.sol b/src/contracts/protocol/libraries/configuration/UserConfiguration.sol
similarity index 100%
rename from src/core/contracts/protocol/libraries/configuration/UserConfiguration.sol
rename to src/contracts/protocol/libraries/configuration/UserConfiguration.sol
diff --git a/src/core/contracts/protocol/libraries/helpers/Errors.sol b/src/contracts/protocol/libraries/helpers/Errors.sol
similarity index 93%
rename from src/core/contracts/protocol/libraries/helpers/Errors.sol
rename to src/contracts/protocol/libraries/helpers/Errors.sol
index 36b75308..d3f564cb 100644
--- a/src/core/contracts/protocol/libraries/helpers/Errors.sol
+++ b/src/contracts/protocol/libraries/helpers/Errors.sol
@@ -37,17 +37,14 @@ library Errors {
string public constant RESERVE_FROZEN = '28'; // 'Action cannot be performed because the reserve is frozen'
string public constant RESERVE_PAUSED = '29'; // 'Action cannot be performed because the reserve is paused'
string public constant BORROWING_NOT_ENABLED = '30'; // 'Borrowing is not enabled'
- string public constant STABLE_BORROWING_NOT_ENABLED = '31'; // 'Stable borrowing is not enabled'
string public constant NOT_ENOUGH_AVAILABLE_USER_BALANCE = '32'; // 'User cannot withdraw more than the available balance'
string public constant INVALID_INTEREST_RATE_MODE_SELECTED = '33'; // 'Invalid interest rate mode selected'
string public constant COLLATERAL_BALANCE_IS_ZERO = '34'; // 'The collateral balance is 0'
string public constant HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD = '35'; // 'Health factor is lesser than the liquidation threshold'
string public constant COLLATERAL_CANNOT_COVER_NEW_BORROW = '36'; // 'There is not enough collateral to cover a new borrow'
string public constant COLLATERAL_SAME_AS_BORROWING_CURRENCY = '37'; // 'Collateral is (mostly) the same currency that is being borrowed'
- string public constant AMOUNT_BIGGER_THAN_MAX_LOAN_SIZE_STABLE = '38'; // 'The requested amount is greater than the max loan size in stable rate mode'
string public constant NO_DEBT_OF_SELECTED_TYPE = '39'; // 'For repayment of a specific type of debt, the user needs to have debt that type'
string public constant NO_EXPLICIT_AMOUNT_TO_REPAY_ON_BEHALF = '40'; // 'To repay on behalf of a user an explicit amount to repay is needed'
- string public constant NO_OUTSTANDING_STABLE_DEBT = '41'; // 'User does not have outstanding stable rate debt on this reserve'
string public constant NO_OUTSTANDING_VARIABLE_DEBT = '42'; // 'User does not have outstanding variable rate debt on this reserve'
string public constant UNDERLYING_BALANCE_ZERO = '43'; // 'The underlying balance needs to be greater than 0'
string public constant INTEREST_RATE_REBALANCE_CONDITIONS_NOT_MET = '44'; // 'Interest rate rebalance conditions were not met'
@@ -60,7 +57,6 @@ library Errors {
string public constant UNBACKED_MINT_CAP_EXCEEDED = '52'; // 'Unbacked mint cap is exceeded'
string public constant DEBT_CEILING_EXCEEDED = '53'; // 'Debt ceiling is exceeded'
string public constant UNDERLYING_CLAIMABLE_RIGHTS_NOT_ZERO = '54'; // 'Claimable rights over underlying not zero (aToken supply or accruedToTreasury)'
- string public constant STABLE_DEBT_NOT_ZERO = '55'; // 'Stable debt supply is not zero'
string public constant VARIABLE_DEBT_SUPPLY_NOT_ZERO = '56'; // 'Variable debt supply is not zero'
string public constant LTV_VALIDATION_FAILED = '57'; // 'Ltv validation failed'
string public constant INCONSISTENT_EMODE_CATEGORY = '58'; // 'Inconsistent eMode category'
@@ -89,11 +85,9 @@ library Errors {
string public constant DEBT_CEILING_NOT_ZERO = '81'; // 'Debt ceiling is not zero'
string public constant ASSET_NOT_LISTED = '82'; // 'Asset is not listed'
string public constant INVALID_OPTIMAL_USAGE_RATIO = '83'; // 'Invalid optimal usage ratio'
- string public constant INVALID_OPTIMAL_STABLE_TO_TOTAL_DEBT_RATIO = '84'; // 'Invalid optimal stable to total debt ratio'
string public constant UNDERLYING_CANNOT_BE_RESCUED = '85'; // 'The underlying asset cannot be rescued'
string public constant ADDRESSES_PROVIDER_ALREADY_ADDED = '86'; // 'Reserve has already been added to reserve list'
string public constant POOL_ADDRESSES_DO_NOT_MATCH = '87'; // 'The token implementation pool address and the pool address provided by the initializing pool do not match'
- string public constant STABLE_BORROWING_ENABLED = '88'; // 'Stable borrowing is enabled'
string public constant SILOED_BORROWING_VIOLATION = '89'; // 'User is trying to borrow multiple assets including a siloed one'
string public constant RESERVE_DEBT_NOT_ZERO = '90'; // the total debt of the reserve needs to be 0
string public constant FLASHLOAN_DISABLED = '91'; // FlashLoaning for this asset is disabled
@@ -105,4 +99,5 @@ library Errors {
string public constant LIQUIDATION_GRACE_SENTINEL_CHECK_FAILED = '97'; // 'Liquidation grace sentinel validation failed'
string public constant INVALID_GRACE_PERIOD = '98'; // Grace period above a valid range
string public constant INVALID_FREEZE_STATE = '99'; // Reserve is already in the passed freeze state
+ string public constant NOT_BORROWABLE_IN_EMODE = '100'; // Asset not borrowable in eMode
}
diff --git a/src/core/contracts/protocol/libraries/logic/BorrowLogic.sol b/src/contracts/protocol/libraries/logic/BorrowLogic.sol
similarity index 57%
rename from src/core/contracts/protocol/libraries/logic/BorrowLogic.sol
rename to src/contracts/protocol/libraries/logic/BorrowLogic.sol
index cdcf0101..c4ed26ed 100644
--- a/src/core/contracts/protocol/libraries/logic/BorrowLogic.sol
+++ b/src/contracts/protocol/libraries/logic/BorrowLogic.sol
@@ -4,12 +4,10 @@ pragma solidity ^0.8.10;
import {GPv2SafeERC20} from '../../../dependencies/gnosis/contracts/GPv2SafeERC20.sol';
import {SafeCast} from '../../../dependencies/openzeppelin/contracts/SafeCast.sol';
import {IERC20} from '../../../dependencies/openzeppelin/contracts/IERC20.sol';
-import {IStableDebtToken} from '../../../interfaces/IStableDebtToken.sol';
import {IVariableDebtToken} from '../../../interfaces/IVariableDebtToken.sol';
import {IAToken} from '../../../interfaces/IAToken.sol';
import {UserConfiguration} from '../configuration/UserConfiguration.sol';
import {ReserveConfiguration} from '../configuration/ReserveConfiguration.sol';
-import {Helpers} from '../helpers/Helpers.sol';
import {DataTypes} from '../types/DataTypes.sol';
import {ValidationLogic} from './ValidationLogic.sol';
import {ReserveLogic} from './ReserveLogic.sol';
@@ -45,12 +43,6 @@ library BorrowLogic {
uint256 amount,
bool useATokens
);
- event RebalanceStableBorrowRate(address indexed reserve, address indexed user);
- event SwapBorrowRateMode(
- address indexed reserve,
- address indexed user,
- DataTypes.InterestRateMode interestRateMode
- );
event IsolationModeTotalDebtUpdated(address indexed asset, uint256 totalDebt);
event ReserveUsedAsCollateralDisabled(address indexed reserve, address indexed user);
@@ -94,7 +86,6 @@ library BorrowLogic {
userAddress: params.onBehalfOf,
amount: params.amount,
interestRateMode: params.interestRateMode,
- maxStableLoanPercent: params.maxStableRateBorrowSizePercent,
reservesCount: params.reservesCount,
oracle: params.oracle,
userEModeCategory: params.userEModeCategory,
@@ -105,27 +96,11 @@ library BorrowLogic {
})
);
- uint256 currentStableRate = 0;
bool isFirstBorrowing = false;
- if (params.interestRateMode == DataTypes.InterestRateMode.STABLE) {
- currentStableRate = reserve.currentStableBorrowRate;
-
- (
- isFirstBorrowing,
- reserveCache.nextTotalStableDebt,
- reserveCache.nextAvgStableBorrowRate
- ) = IStableDebtToken(reserveCache.stableDebtTokenAddress).mint(
- params.user,
- params.onBehalfOf,
- params.amount,
- currentStableRate
- );
- } else {
- (isFirstBorrowing, reserveCache.nextScaledVariableDebt) = IVariableDebtToken(
- reserveCache.variableDebtTokenAddress
- ).mint(params.user, params.onBehalfOf, params.amount, reserveCache.nextVariableBorrowIndex);
- }
+ (isFirstBorrowing, reserveCache.nextScaledVariableDebt) = IVariableDebtToken(
+ reserveCache.variableDebtTokenAddress
+ ).mint(params.user, params.onBehalfOf, params.amount, reserveCache.nextVariableBorrowIndex);
if (isFirstBorrowing) {
userConfig.setBorrowing(reserve.id, true);
@@ -159,10 +134,8 @@ library BorrowLogic {
params.user,
params.onBehalfOf,
params.amount,
- params.interestRateMode,
- params.interestRateMode == DataTypes.InterestRateMode.STABLE
- ? currentStableRate
- : reserve.currentVariableBorrowRate,
+ DataTypes.InterestRateMode.VARIABLE,
+ reserve.currentVariableBorrowRate,
params.referralCode
);
}
@@ -188,9 +161,8 @@ library BorrowLogic {
DataTypes.ReserveCache memory reserveCache = reserve.cache();
reserve.updateState(reserveCache);
- (uint256 stableDebt, uint256 variableDebt) = Helpers.getUserCurrentDebt(
- params.onBehalfOf,
- reserveCache
+ uint256 variableDebt = IERC20(reserveCache.variableDebtTokenAddress).balanceOf(
+ params.onBehalfOf
);
ValidationLogic.validateRepay(
@@ -198,13 +170,10 @@ library BorrowLogic {
params.amount,
params.interestRateMode,
params.onBehalfOf,
- stableDebt,
variableDebt
);
- uint256 paybackAmount = params.interestRateMode == DataTypes.InterestRateMode.STABLE
- ? stableDebt
- : variableDebt;
+ uint256 paybackAmount = variableDebt;
// Allows a user to repay with aTokens without leaving dust from interest.
if (params.useATokens && params.amount == type(uint256).max) {
@@ -215,15 +184,8 @@ library BorrowLogic {
paybackAmount = params.amount;
}
- if (params.interestRateMode == DataTypes.InterestRateMode.STABLE) {
- (reserveCache.nextTotalStableDebt, reserveCache.nextAvgStableBorrowRate) = IStableDebtToken(
- reserveCache.stableDebtTokenAddress
- ).burn(params.onBehalfOf, paybackAmount);
- } else {
- reserveCache.nextScaledVariableDebt = IVariableDebtToken(
- reserveCache.variableDebtTokenAddress
- ).burn(params.onBehalfOf, paybackAmount, reserveCache.nextVariableBorrowIndex);
- }
+ reserveCache.nextScaledVariableDebt = IVariableDebtToken(reserveCache.variableDebtTokenAddress)
+ .burn(params.onBehalfOf, paybackAmount, reserveCache.nextVariableBorrowIndex);
reserve.updateInterestRatesAndVirtualBalance(
reserveCache,
@@ -232,7 +194,7 @@ library BorrowLogic {
0
);
- if (stableDebt + variableDebt - paybackAmount == 0) {
+ if (variableDebt - paybackAmount == 0) {
userConfig.setBorrowing(reserve.id, false);
}
@@ -269,90 +231,4 @@ library BorrowLogic {
return paybackAmount;
}
-
- /**
- * @notice Implements the rebalance stable borrow rate feature. In case of liquidity crunches on the protocol, stable
- * rate borrows might need to be rebalanced to bring back equilibrium between the borrow and supply APYs.
- * @dev The rules that define if a position can be rebalanced are implemented in `ValidationLogic.validateRebalanceStableBorrowRate()`
- * @dev Emits the `RebalanceStableBorrowRate()` event
- * @param reserve The state of the reserve of the asset being repaid
- * @param asset The asset of the position being rebalanced
- * @param user The user being rebalanced
- */
- function executeRebalanceStableBorrowRate(
- DataTypes.ReserveData storage reserve,
- address asset,
- address user
- ) external {
- DataTypes.ReserveCache memory reserveCache = reserve.cache();
- reserve.updateState(reserveCache);
-
- ValidationLogic.validateRebalanceStableBorrowRate(reserve, reserveCache, asset);
-
- IStableDebtToken stableDebtToken = IStableDebtToken(reserveCache.stableDebtTokenAddress);
- uint256 stableDebt = IERC20(address(stableDebtToken)).balanceOf(user);
-
- stableDebtToken.burn(user, stableDebt);
-
- (, reserveCache.nextTotalStableDebt, reserveCache.nextAvgStableBorrowRate) = stableDebtToken
- .mint(user, user, stableDebt, reserve.currentStableBorrowRate);
-
- reserve.updateInterestRatesAndVirtualBalance(reserveCache, asset, 0, 0);
-
- emit RebalanceStableBorrowRate(asset, user);
- }
-
- /**
- * @notice Implements the swap borrow rate feature. Borrowers can swap from variable to stable positions at any time.
- * @dev Emits the `Swap()` event
- * @param reserve The of the reserve of the asset being repaid
- * @param userConfig The user configuration mapping that tracks the supplied/borrowed assets
- * @param asset The asset of the position being swapped
- * @param user The user whose debt position is being swapped
- * @param interestRateMode The current interest rate mode of the position being swapped
- */
- function executeSwapBorrowRateMode(
- DataTypes.ReserveData storage reserve,
- DataTypes.UserConfigurationMap storage userConfig,
- address asset,
- address user,
- DataTypes.InterestRateMode interestRateMode
- ) external {
- DataTypes.ReserveCache memory reserveCache = reserve.cache();
-
- reserve.updateState(reserveCache);
-
- (uint256 stableDebt, uint256 variableDebt) = Helpers.getUserCurrentDebt(user, reserveCache);
-
- ValidationLogic.validateSwapRateMode(
- reserve,
- reserveCache,
- userConfig,
- stableDebt,
- variableDebt,
- interestRateMode
- );
-
- if (interestRateMode == DataTypes.InterestRateMode.STABLE) {
- (reserveCache.nextTotalStableDebt, reserveCache.nextAvgStableBorrowRate) = IStableDebtToken(
- reserveCache.stableDebtTokenAddress
- ).burn(user, stableDebt);
-
- (, reserveCache.nextScaledVariableDebt) = IVariableDebtToken(
- reserveCache.variableDebtTokenAddress
- ).mint(user, user, stableDebt, reserveCache.nextVariableBorrowIndex);
- } else {
- reserveCache.nextScaledVariableDebt = IVariableDebtToken(
- reserveCache.variableDebtTokenAddress
- ).burn(user, variableDebt, reserveCache.nextVariableBorrowIndex);
-
- (, reserveCache.nextTotalStableDebt, reserveCache.nextAvgStableBorrowRate) = IStableDebtToken(
- reserveCache.stableDebtTokenAddress
- ).mint(user, user, variableDebt, reserve.currentStableBorrowRate);
- }
-
- reserve.updateInterestRatesAndVirtualBalance(reserveCache, asset, 0, 0);
-
- emit SwapBorrowRateMode(asset, user, interestRateMode);
- }
}
diff --git a/src/core/contracts/protocol/libraries/logic/BridgeLogic.sol b/src/contracts/protocol/libraries/logic/BridgeLogic.sol
similarity index 100%
rename from src/core/contracts/protocol/libraries/logic/BridgeLogic.sol
rename to src/contracts/protocol/libraries/logic/BridgeLogic.sol
diff --git a/src/core/contracts/protocol/libraries/logic/CalldataLogic.sol b/src/contracts/protocol/libraries/logic/CalldataLogic.sol
similarity index 81%
rename from src/core/contracts/protocol/libraries/logic/CalldataLogic.sol
rename to src/contracts/protocol/libraries/logic/CalldataLogic.sol
index 505a2541..742cbcbf 100644
--- a/src/core/contracts/protocol/libraries/logic/CalldataLogic.sol
+++ b/src/contracts/protocol/libraries/logic/CalldataLogic.sol
@@ -86,7 +86,7 @@ library CalldataLogic {
* @param args The packed borrow params
* @return The address of the underlying reserve
* @return The amount to borrow
- * @return The interestRateMode, 1 for stable or 2 for variable debt
+ * @return The interestRateMode, 2 for variable debt, 1 is deprecated (changed on v3.2.0)
* @return The referralCode
*/
function decodeBorrowParams(
@@ -114,7 +114,7 @@ library CalldataLogic {
* @param args The packed repay params
* @return The address of the underlying reserve
* @return The amount to repay
- * @return The interestRateMode, 1 for stable or 2 for variable debt
+ * @return The interestRateMode, 2 for variable debt, 1 is deprecated (changed on v3.2.0)
*/
function decodeRepayParams(
mapping(uint256 => address) storage reservesList,
@@ -143,7 +143,7 @@ library CalldataLogic {
* @param args The packed repay with permit params
* @return The address of the underlying reserve
* @return The amount to repay
- * @return The interestRateMode, 1 for stable or 2 for variable debt
+ * @return The interestRateMode, 2 for variable debt, 1 is deprecated (changed on v3.2.0)
* @return The deadline of the permit
* @return The V value of the permit signature
*/
@@ -167,48 +167,6 @@ library CalldataLogic {
return (asset, amount, interestRateMode, deadline, permitV);
}
- /**
- * @notice Decodes compressed swap borrow rate mode params to standard params
- * @param reservesList The addresses of all the active reserves
- * @param args The packed swap borrow rate mode params
- * @return The address of the underlying reserve
- * @return The interest rate mode, 1 for stable 2 for variable debt
- */
- function decodeSwapBorrowRateModeParams(
- mapping(uint256 => address) storage reservesList,
- bytes32 args
- ) internal view returns (address, uint256) {
- uint16 assetId;
- uint256 interestRateMode;
-
- assembly {
- assetId := and(args, 0xFFFF)
- interestRateMode := and(shr(16, args), 0xFF)
- }
-
- return (reservesList[assetId], interestRateMode);
- }
-
- /**
- * @notice Decodes compressed rebalance stable borrow rate params to standard params
- * @param reservesList The addresses of all the active reserves
- * @param args The packed rabalance stable borrow rate params
- * @return The address of the underlying reserve
- * @return The address of the user to rebalance
- */
- function decodeRebalanceStableBorrowRateParams(
- mapping(uint256 => address) storage reservesList,
- bytes32 args
- ) internal view returns (address, address) {
- uint16 assetId;
- address user;
- assembly {
- assetId := and(args, 0xFFFF)
- user := and(shr(16, args), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
- }
- return (reservesList[assetId], user);
- }
-
/**
* @notice Decodes compressed set user use reserve as collateral params to standard params
* @param reservesList The addresses of all the active reserves
diff --git a/src/core/contracts/protocol/libraries/logic/ConfiguratorLogic.sol b/src/contracts/protocol/libraries/logic/ConfiguratorLogic.sol
similarity index 77%
rename from src/core/contracts/protocol/libraries/logic/ConfiguratorLogic.sol
rename to src/contracts/protocol/libraries/logic/ConfiguratorLogic.sol
index 01580d9e..c6b08dcc 100644
--- a/src/core/contracts/protocol/libraries/logic/ConfiguratorLogic.sol
+++ b/src/contracts/protocol/libraries/logic/ConfiguratorLogic.sol
@@ -4,7 +4,7 @@ pragma solidity ^0.8.10;
import {IPool} from '../../../interfaces/IPool.sol';
import {IInitializableAToken} from '../../../interfaces/IInitializableAToken.sol';
import {IInitializableDebtToken} from '../../../interfaces/IInitializableDebtToken.sol';
-import {InitializableImmutableAdminUpgradeabilityProxy} from '../aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol';
+import {InitializableImmutableAdminUpgradeabilityProxy} from '../../../misc/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol';
import {IReserveInterestRateStrategy} from '../../../interfaces/IReserveInterestRateStrategy.sol';
import {ReserveConfiguration} from '../configuration/ReserveConfiguration.sol';
import {DataTypes} from '../types/DataTypes.sol';
@@ -33,11 +33,6 @@ library ConfiguratorLogic {
address indexed proxy,
address indexed implementation
);
- event StableDebtTokenUpgraded(
- address indexed asset,
- address indexed proxy,
- address indexed implementation
- );
event VariableDebtTokenUpgraded(
address indexed asset,
address indexed proxy,
@@ -45,7 +40,7 @@ library ConfiguratorLogic {
);
/**
- * @notice Initialize a reserve by creating and initializing aToken, stable debt token and variable debt token
+ * @notice Initialize a reserve by creating and initializing aToken and variable debt token
* @dev Emits the `ReserveInitialized` event
* @param pool The Pool in which the reserve will be initialized
* @param input The needed parameters for the initialization
@@ -73,20 +68,6 @@ library ConfiguratorLogic {
)
);
- address stableDebtTokenProxyAddress = _initTokenWithProxy(
- input.stableDebtTokenImpl,
- abi.encodeWithSelector(
- IInitializableDebtToken.initialize.selector,
- pool,
- input.underlyingAsset,
- input.incentivesController,
- underlyingAssetDecimals,
- input.stableDebtTokenName,
- input.stableDebtTokenSymbol,
- input.params
- )
- );
-
address variableDebtTokenProxyAddress = _initTokenWithProxy(
input.variableDebtTokenImpl,
abi.encodeWithSelector(
@@ -104,7 +85,6 @@ library ConfiguratorLogic {
pool.initReserve(
input.underlyingAsset,
aTokenProxyAddress,
- stableDebtTokenProxyAddress,
variableDebtTokenProxyAddress,
input.interestRateStrategyAddress
);
@@ -128,7 +108,7 @@ library ConfiguratorLogic {
emit ReserveInitialized(
input.underlyingAsset,
aTokenProxyAddress,
- stableDebtTokenProxyAddress,
+ address(0),
variableDebtTokenProxyAddress,
input.interestRateStrategyAddress
);
@@ -146,7 +126,7 @@ library ConfiguratorLogic {
) external {
DataTypes.ReserveDataLegacy memory reserveData = cachedPool.getReserveData(input.asset);
- (, , , uint256 decimals, , ) = cachedPool.getConfiguration(input.asset).getParams();
+ (, , , uint256 decimals, ) = cachedPool.getConfiguration(input.asset).getParams();
bytes memory encodedCall = abi.encodeWithSelector(
IInitializableAToken.initialize.selector,
@@ -165,44 +145,6 @@ library ConfiguratorLogic {
emit ATokenUpgraded(input.asset, reserveData.aTokenAddress, input.implementation);
}
- /**
- * @notice Updates the stable debt token implementation and initializes it
- * @dev Emits the `StableDebtTokenUpgraded` event
- * @param cachedPool The Pool containing the reserve with the stable debt token
- * @param input The parameters needed for the initialize call
- */
- function executeUpdateStableDebtToken(
- IPool cachedPool,
- ConfiguratorInputTypes.UpdateDebtTokenInput calldata input
- ) external {
- DataTypes.ReserveDataLegacy memory reserveData = cachedPool.getReserveData(input.asset);
-
- (, , , uint256 decimals, , ) = cachedPool.getConfiguration(input.asset).getParams();
-
- bytes memory encodedCall = abi.encodeWithSelector(
- IInitializableDebtToken.initialize.selector,
- cachedPool,
- input.asset,
- input.incentivesController,
- decimals,
- input.name,
- input.symbol,
- input.params
- );
-
- _upgradeTokenImplementation(
- reserveData.stableDebtTokenAddress,
- input.implementation,
- encodedCall
- );
-
- emit StableDebtTokenUpgraded(
- input.asset,
- reserveData.stableDebtTokenAddress,
- input.implementation
- );
- }
-
/**
* @notice Updates the variable debt token implementation and initializes it
* @dev Emits the `VariableDebtTokenUpgraded` event
@@ -215,7 +157,7 @@ library ConfiguratorLogic {
) external {
DataTypes.ReserveDataLegacy memory reserveData = cachedPool.getReserveData(input.asset);
- (, , , uint256 decimals, , ) = cachedPool.getConfiguration(input.asset).getParams();
+ (, , , uint256 decimals, ) = cachedPool.getConfiguration(input.asset).getParams();
bytes memory encodedCall = abi.encodeWithSelector(
IInitializableDebtToken.initialize.selector,
diff --git a/src/core/contracts/protocol/libraries/logic/EModeLogic.sol b/src/contracts/protocol/libraries/logic/EModeLogic.sol
similarity index 60%
rename from src/core/contracts/protocol/libraries/logic/EModeLogic.sol
rename to src/contracts/protocol/libraries/logic/EModeLogic.sol
index b61e440c..647fc7e7 100644
--- a/src/core/contracts/protocol/libraries/logic/EModeLogic.sol
+++ b/src/contracts/protocol/libraries/logic/EModeLogic.sol
@@ -46,66 +46,27 @@ library EModeLogic {
DataTypes.UserConfigurationMap storage userConfig,
DataTypes.ExecuteSetUserEModeParams memory params
) external {
+ if (usersEModeCategory[msg.sender] == params.categoryId) return;
+
ValidationLogic.validateSetUserEMode(
- reservesData,
- reservesList,
eModeCategories,
userConfig,
params.reservesCount,
params.categoryId
);
- uint8 prevCategoryId = usersEModeCategory[msg.sender];
usersEModeCategory[msg.sender] = params.categoryId;
- if (prevCategoryId != 0) {
- ValidationLogic.validateHealthFactor(
- reservesData,
- reservesList,
- eModeCategories,
- userConfig,
- msg.sender,
- params.categoryId,
- params.reservesCount,
- params.oracle
- );
- }
+ ValidationLogic.validateHealthFactor(
+ reservesData,
+ reservesList,
+ eModeCategories,
+ userConfig,
+ msg.sender,
+ params.categoryId,
+ params.reservesCount,
+ params.oracle
+ );
emit UserEModeSet(msg.sender, params.categoryId);
}
-
- /**
- * @notice Gets the eMode configuration and calculates the eMode asset price if a custom oracle is configured
- * @dev The eMode asset price returned is 0 if no oracle is specified
- * @param category The user eMode category
- * @param oracle The price oracle
- * @return The eMode ltv
- * @return The eMode liquidation threshold
- * @return The eMode asset price
- */
- function getEModeConfiguration(
- DataTypes.EModeCategory storage category,
- IPriceOracleGetter oracle
- ) internal view returns (uint256, uint256, uint256) {
- uint256 eModeAssetPrice = 0;
- address eModePriceSource = category.priceSource;
-
- if (eModePriceSource != address(0)) {
- eModeAssetPrice = oracle.getAssetPrice(eModePriceSource);
- }
-
- return (category.ltv, category.liquidationThreshold, eModeAssetPrice);
- }
-
- /**
- * @notice Checks if eMode is active for a user and if yes, if the asset belongs to the eMode category chosen
- * @param eModeUserCategory The user eMode category
- * @param eModeAssetCategory The asset eMode category
- * @return True if eMode is active and the asset belongs to the eMode category chosen by the user, false otherwise
- */
- function isInEModeCategory(
- uint256 eModeUserCategory,
- uint256 eModeAssetCategory
- ) internal pure returns (bool) {
- return (eModeUserCategory != 0 && eModeAssetCategory == eModeUserCategory);
- }
}
diff --git a/src/core/contracts/protocol/libraries/logic/FlashLoanLogic.sol b/src/contracts/protocol/libraries/logic/FlashLoanLogic.sol
similarity index 88%
rename from src/core/contracts/protocol/libraries/logic/FlashLoanLogic.sol
rename to src/contracts/protocol/libraries/logic/FlashLoanLogic.sol
index f6edf532..31ffb288 100644
--- a/src/core/contracts/protocol/libraries/logic/FlashLoanLogic.sol
+++ b/src/contracts/protocol/libraries/logic/FlashLoanLogic.sol
@@ -6,8 +6,8 @@ import {SafeCast} from '../../../dependencies/openzeppelin/contracts/SafeCast.so
import {IERC20} from '../../../dependencies/openzeppelin/contracts/IERC20.sol';
import {IAToken} from '../../../interfaces/IAToken.sol';
import {IPool} from '../../../interfaces/IPool.sol';
-import {IFlashLoanReceiver} from '../../../flashloan/interfaces/IFlashLoanReceiver.sol';
-import {IFlashLoanSimpleReceiver} from '../../../flashloan/interfaces/IFlashLoanSimpleReceiver.sol';
+import {IFlashLoanReceiver} from '../../../misc/flashloan/interfaces/IFlashLoanReceiver.sol';
+import {IFlashLoanSimpleReceiver} from '../../../misc/flashloan/interfaces/IFlashLoanSimpleReceiver.sol';
import {IPoolAddressesProvider} from '../../../interfaces/IPoolAddressesProvider.sol';
import {ReserveConfiguration} from '../configuration/ReserveConfiguration.sol';
import {Errors} from '../helpers/Errors.sol';
@@ -46,7 +46,6 @@ library FlashLoanLogic {
// Helper struct for internal variables used in the `executeFlashLoan` function
struct FlashLoanLocalVars {
IFlashLoanReceiver receiver;
- uint256 i;
address currentAsset;
uint256 currentAmount;
uint256[] totalPremiums;
@@ -89,20 +88,18 @@ library FlashLoanLogic {
? (0, 0)
: (params.flashLoanPremiumTotal, params.flashLoanPremiumToProtocol);
- for (vars.i = 0; vars.i < params.assets.length; vars.i++) {
- vars.currentAmount = params.amounts[vars.i];
- vars.totalPremiums[vars.i] = DataTypes.InterestRateMode(params.interestRateModes[vars.i]) ==
+ for (uint256 i = 0; i < params.assets.length; i++) {
+ vars.currentAmount = params.amounts[i];
+ vars.totalPremiums[i] = DataTypes.InterestRateMode(params.interestRateModes[i]) ==
DataTypes.InterestRateMode.NONE
? vars.currentAmount.percentMul(vars.flashloanPremiumTotal)
: 0;
- if (reservesData[params.assets[vars.i]].configuration.getIsVirtualAccActive()) {
- reservesData[params.assets[vars.i]].virtualUnderlyingBalance -= vars
- .currentAmount
- .toUint128();
+ if (reservesData[params.assets[i]].configuration.getIsVirtualAccActive()) {
+ reservesData[params.assets[i]].virtualUnderlyingBalance -= vars.currentAmount.toUint128();
}
- IAToken(reservesData[params.assets[vars.i]].aTokenAddress).transferUnderlyingTo(
+ IAToken(reservesData[params.assets[i]].aTokenAddress).transferUnderlyingTo(
params.receiverAddress,
vars.currentAmount
);
@@ -119,13 +116,12 @@ library FlashLoanLogic {
Errors.INVALID_FLASHLOAN_EXECUTOR_RETURN
);
- for (vars.i = 0; vars.i < params.assets.length; vars.i++) {
- vars.currentAsset = params.assets[vars.i];
- vars.currentAmount = params.amounts[vars.i];
+ for (uint256 i = 0; i < params.assets.length; i++) {
+ vars.currentAsset = params.assets[i];
+ vars.currentAmount = params.amounts[i];
if (
- DataTypes.InterestRateMode(params.interestRateModes[vars.i]) ==
- DataTypes.InterestRateMode.NONE
+ DataTypes.InterestRateMode(params.interestRateModes[i]) == DataTypes.InterestRateMode.NONE
) {
_handleFlashLoanRepayment(
reservesData[vars.currentAsset],
@@ -133,7 +129,7 @@ library FlashLoanLogic {
asset: vars.currentAsset,
receiverAddress: params.receiverAddress,
amount: vars.currentAmount,
- totalPremium: vars.totalPremiums[vars.i],
+ totalPremium: vars.totalPremiums[i],
flashLoanPremiumToProtocol: vars.flashloanPremiumToProtocol,
referralCode: params.referralCode
})
@@ -151,11 +147,9 @@ library FlashLoanLogic {
user: msg.sender,
onBehalfOf: params.onBehalfOf,
amount: vars.currentAmount,
- interestRateMode: DataTypes.InterestRateMode(params.interestRateModes[vars.i]),
+ interestRateMode: DataTypes.InterestRateMode(params.interestRateModes[i]),
referralCode: params.referralCode,
releaseUnderlying: false,
- maxStableRateBorrowSizePercent: IPool(params.pool)
- .MAX_STABLE_RATE_BORROW_SIZE_PERCENT(),
reservesCount: IPool(params.pool).getReservesCount(),
oracle: IPoolAddressesProvider(params.addressesProvider).getPriceOracle(),
userEModeCategory: IPool(params.pool).getUserEMode(params.onBehalfOf).toUint8(),
@@ -169,7 +163,7 @@ library FlashLoanLogic {
msg.sender,
vars.currentAsset,
vars.currentAmount,
- DataTypes.InterestRateMode(params.interestRateModes[vars.i]),
+ DataTypes.InterestRateMode(params.interestRateModes[i]),
0,
params.referralCode
);
@@ -275,7 +269,7 @@ library FlashLoanLogic {
msg.sender,
params.asset,
params.amount,
- DataTypes.InterestRateMode(0),
+ DataTypes.InterestRateMode.NONE,
params.totalPremium,
params.referralCode
);
diff --git a/src/core/contracts/protocol/libraries/logic/GenericLogic.sol b/src/contracts/protocol/libraries/logic/GenericLogic.sol
similarity index 87%
rename from src/core/contracts/protocol/libraries/logic/GenericLogic.sol
rename to src/contracts/protocol/libraries/logic/GenericLogic.sol
index 3342316e..cd5b83c6 100644
--- a/src/core/contracts/protocol/libraries/logic/GenericLogic.sol
+++ b/src/contracts/protocol/libraries/logic/GenericLogic.sol
@@ -6,6 +6,7 @@ import {IScaledBalanceToken} from '../../../interfaces/IScaledBalanceToken.sol';
import {IPriceOracleGetter} from '../../../interfaces/IPriceOracleGetter.sol';
import {ReserveConfiguration} from '../configuration/ReserveConfiguration.sol';
import {UserConfiguration} from '../configuration/UserConfiguration.sol';
+import {EModeConfiguration} from '../configuration/EModeConfiguration.sol';
import {PercentageMath} from '../math/PercentageMath.sol';
import {WadRayMath} from '../math/WadRayMath.sol';
import {DataTypes} from '../types/DataTypes.sol';
@@ -37,10 +38,8 @@ library GenericLogic {
uint256 totalDebtInBaseCurrency;
uint256 avgLtv;
uint256 avgLiquidationThreshold;
- uint256 eModeAssetPrice;
uint256 eModeLtv;
uint256 eModeLiqThreshold;
- uint256 eModeAssetCategory;
address currentReserveAddress;
bool hasZeroLtvCollateral;
bool isInEModeCategory;
@@ -74,11 +73,8 @@ library GenericLogic {
CalculateUserAccountDataVars memory vars;
if (params.userEModeCategory != 0) {
- (vars.eModeLtv, vars.eModeLiqThreshold, vars.eModeAssetPrice) = EModeLogic
- .getEModeConfiguration(
- eModeCategories[params.userEModeCategory],
- IPriceOracleGetter(params.oracle)
- );
+ vars.eModeLtv = eModeCategories[params.userEModeCategory].ltv;
+ vars.eModeLiqThreshold = eModeCategories[params.userEModeCategory].liquidationThreshold;
}
while (vars.i < params.reservesCount) {
@@ -100,23 +96,15 @@ library GenericLogic {
DataTypes.ReserveData storage currentReserve = reservesData[vars.currentReserveAddress];
- (
- vars.ltv,
- vars.liquidationThreshold,
- ,
- vars.decimals,
- ,
- vars.eModeAssetCategory
- ) = currentReserve.configuration.getParams();
+ (vars.ltv, vars.liquidationThreshold, , vars.decimals, ) = currentReserve
+ .configuration
+ .getParams();
unchecked {
vars.assetUnit = 10 ** vars.decimals;
}
- vars.assetPrice = vars.eModeAssetPrice != 0 &&
- params.userEModeCategory == vars.eModeAssetCategory
- ? vars.eModeAssetPrice
- : IPriceOracleGetter(params.oracle).getAssetPrice(vars.currentReserveAddress);
+ vars.assetPrice = IPriceOracleGetter(params.oracle).getAssetPrice(vars.currentReserveAddress);
if (vars.liquidationThreshold != 0 && params.userConfig.isUsingAsCollateral(vars.i)) {
vars.userBalanceInBaseCurrency = _getUserBalanceInBaseCurrency(
@@ -128,10 +116,12 @@ library GenericLogic {
vars.totalCollateralInBaseCurrency += vars.userBalanceInBaseCurrency;
- vars.isInEModeCategory = EModeLogic.isInEModeCategory(
- params.userEModeCategory,
- vars.eModeAssetCategory
- );
+ vars.isInEModeCategory =
+ params.userEModeCategory != 0 &&
+ EModeConfiguration.isReserveEnabledOnBitmap(
+ eModeCategories[params.userEModeCategory].collateralBitmap,
+ vars.i
+ );
if (vars.ltv != 0) {
vars.avgLtv +=
@@ -199,7 +189,7 @@ library GenericLogic {
) internal pure returns (uint256) {
uint256 availableBorrowsInBaseCurrency = totalCollateralInBaseCurrency.percentMul(ltv);
- if (availableBorrowsInBaseCurrency < totalDebtInBaseCurrency) {
+ if (availableBorrowsInBaseCurrency <= totalDebtInBaseCurrency) {
return 0;
}
@@ -209,7 +199,7 @@ library GenericLogic {
/**
* @notice Calculates total debt of the user in the based currency used to normalize the values of the assets
- * @dev This fetches the `balanceOf` of the stable and variable debt tokens for the user. For gas reasons, the
+ * @dev This fetches the `balanceOf` of the variable debt token for the user. For gas reasons, the
* variable debt balance is calculated by fetching `scaledBalancesOf` normalized debt, which is cheaper than
* fetching `balanceOf`
* @param user The address of the user
@@ -228,14 +218,11 @@ library GenericLogic {
uint256 userTotalDebt = IScaledBalanceToken(reserve.variableDebtTokenAddress).scaledBalanceOf(
user
);
- if (userTotalDebt != 0) {
- userTotalDebt = userTotalDebt.rayMul(reserve.getNormalizedDebt());
+ if (userTotalDebt == 0) {
+ return 0;
}
- userTotalDebt = userTotalDebt + IERC20(reserve.stableDebtTokenAddress).balanceOf(user);
-
- userTotalDebt = assetPrice * userTotalDebt;
-
+ userTotalDebt = userTotalDebt.rayMul(reserve.getNormalizedDebt()) * assetPrice;
unchecked {
return userTotalDebt / assetUnit;
}
diff --git a/src/core/contracts/protocol/libraries/logic/IsolationModeLogic.sol b/src/contracts/protocol/libraries/logic/IsolationModeLogic.sol
similarity index 100%
rename from src/core/contracts/protocol/libraries/logic/IsolationModeLogic.sol
rename to src/contracts/protocol/libraries/logic/IsolationModeLogic.sol
diff --git a/src/core/contracts/protocol/libraries/logic/LiquidationLogic.sol b/src/contracts/protocol/libraries/logic/LiquidationLogic.sol
similarity index 81%
rename from src/core/contracts/protocol/libraries/logic/LiquidationLogic.sol
rename to src/contracts/protocol/libraries/logic/LiquidationLogic.sol
index 158cd46f..8f4c35f6 100644
--- a/src/core/contracts/protocol/libraries/logic/LiquidationLogic.sol
+++ b/src/contracts/protocol/libraries/logic/LiquidationLogic.sol
@@ -5,7 +5,6 @@ import {IERC20} from '../../../dependencies/openzeppelin/contracts//IERC20.sol';
import {GPv2SafeERC20} from '../../../dependencies/gnosis/contracts/GPv2SafeERC20.sol';
import {PercentageMath} from '../../libraries/math/PercentageMath.sol';
import {WadRayMath} from '../../libraries/math/WadRayMath.sol';
-import {Helpers} from '../../libraries/helpers/Helpers.sol';
import {DataTypes} from '../../libraries/types/DataTypes.sol';
import {ReserveLogic} from './ReserveLogic.sol';
import {ValidationLogic} from './ValidationLogic.sol';
@@ -14,8 +13,8 @@ import {IsolationModeLogic} from './IsolationModeLogic.sol';
import {EModeLogic} from './EModeLogic.sol';
import {UserConfiguration} from '../../libraries/configuration/UserConfiguration.sol';
import {ReserveConfiguration} from '../../libraries/configuration/ReserveConfiguration.sol';
+import {EModeConfiguration} from '../../libraries/configuration/EModeConfiguration.sol';
import {IAToken} from '../../../interfaces/IAToken.sol';
-import {IStableDebtToken} from '../../../interfaces/IStableDebtToken.sol';
import {IVariableDebtToken} from '../../../interfaces/IVariableDebtToken.sol';
import {IPriceOracleGetter} from '../../../interfaces/IPriceOracleGetter.sol';
@@ -69,15 +68,12 @@ library LiquidationLogic {
struct LiquidationCallLocalVars {
uint256 userCollateralBalance;
- uint256 userVariableDebt;
uint256 userTotalDebt;
uint256 actualDebtToLiquidate;
uint256 actualCollateralToLiquidate;
uint256 liquidationBonus;
uint256 healthFactor;
uint256 liquidationProtocolFeeAmount;
- address collateralPriceSource;
- address debtPriceSource;
IAToken collateralAToken;
DataTypes.ReserveCache debtReserveCache;
}
@@ -121,7 +117,7 @@ library LiquidationLogic {
})
);
- (vars.userVariableDebt, vars.userTotalDebt, vars.actualDebtToLiquidate) = _calculateDebt(
+ (vars.userTotalDebt, vars.actualDebtToLiquidate) = _calculateDebt(
vars.debtReserveCache,
params,
vars.healthFactor
@@ -139,12 +135,18 @@ library LiquidationLogic {
})
);
- (
- vars.collateralAToken,
- vars.collateralPriceSource,
- vars.debtPriceSource,
- vars.liquidationBonus
- ) = _getConfigurationData(eModeCategories, collateralReserve, params);
+ vars.collateralAToken = IAToken(collateralReserve.aTokenAddress);
+ if (
+ params.userEModeCategory != 0 &&
+ EModeConfiguration.isReserveEnabledOnBitmap(
+ eModeCategories[params.userEModeCategory].collateralBitmap,
+ collateralReserve.id
+ )
+ ) {
+ vars.liquidationBonus = eModeCategories[params.userEModeCategory].liquidationBonus;
+ } else {
+ vars.liquidationBonus = collateralReserve.configuration.getLiquidationBonus();
+ }
vars.userCollateralBalance = vars.collateralAToken.balanceOf(params.user);
@@ -155,8 +157,8 @@ library LiquidationLogic {
) = _calculateAvailableCollateralToLiquidate(
collateralReserve,
vars.debtReserveCache,
- vars.collateralPriceSource,
- vars.debtPriceSource,
+ params.collateralAsset,
+ params.debtAsset,
vars.actualDebtToLiquidate,
vars.userCollateralBalance,
vars.liquidationBonus,
@@ -325,29 +327,9 @@ library LiquidationLogic {
DataTypes.ExecuteLiquidationCallParams memory params,
LiquidationCallLocalVars memory vars
) internal {
- if (vars.userVariableDebt >= vars.actualDebtToLiquidate) {
- vars.debtReserveCache.nextScaledVariableDebt = IVariableDebtToken(
- vars.debtReserveCache.variableDebtTokenAddress
- ).burn(
- params.user,
- vars.actualDebtToLiquidate,
- vars.debtReserveCache.nextVariableBorrowIndex
- );
- } else {
- // If the user doesn't have variable debt, no need to try to burn variable debt tokens
- if (vars.userVariableDebt != 0) {
- vars.debtReserveCache.nextScaledVariableDebt = IVariableDebtToken(
- vars.debtReserveCache.variableDebtTokenAddress
- ).burn(params.user, vars.userVariableDebt, vars.debtReserveCache.nextVariableBorrowIndex);
- }
- (
- vars.debtReserveCache.nextTotalStableDebt,
- vars.debtReserveCache.nextAvgStableBorrowRate
- ) = IStableDebtToken(vars.debtReserveCache.stableDebtTokenAddress).burn(
- params.user,
- vars.actualDebtToLiquidate - vars.userVariableDebt
- );
- }
+ vars.debtReserveCache.nextScaledVariableDebt = IVariableDebtToken(
+ vars.debtReserveCache.variableDebtTokenAddress
+ ).burn(params.user, vars.actualDebtToLiquidate, vars.debtReserveCache.nextVariableBorrowIndex);
}
/**
@@ -357,7 +339,6 @@ library LiquidationLogic {
* @param debtReserveCache The reserve cache data object of the debt reserve
* @param params The additional parameters needed to execute the liquidation function
* @param healthFactor The health factor of the position
- * @return The variable debt of the user
* @return The total debt of the user
* @return The actual debt to liquidate as a function of the closeFactor
*/
@@ -365,71 +346,22 @@ library LiquidationLogic {
DataTypes.ReserveCache memory debtReserveCache,
DataTypes.ExecuteLiquidationCallParams memory params,
uint256 healthFactor
- ) internal view returns (uint256, uint256, uint256) {
- (uint256 userStableDebt, uint256 userVariableDebt) = Helpers.getUserCurrentDebt(
- params.user,
- debtReserveCache
+ ) internal view returns (uint256, uint256) {
+ uint256 userVariableDebt = IERC20(debtReserveCache.variableDebtTokenAddress).balanceOf(
+ params.user
);
- uint256 userTotalDebt = userStableDebt + userVariableDebt;
-
uint256 closeFactor = healthFactor > CLOSE_FACTOR_HF_THRESHOLD
? DEFAULT_LIQUIDATION_CLOSE_FACTOR
: MAX_LIQUIDATION_CLOSE_FACTOR;
- uint256 maxLiquidatableDebt = userTotalDebt.percentMul(closeFactor);
+ uint256 maxLiquidatableDebt = userVariableDebt.percentMul(closeFactor);
uint256 actualDebtToLiquidate = params.debtToCover > maxLiquidatableDebt
? maxLiquidatableDebt
: params.debtToCover;
- return (userVariableDebt, userTotalDebt, actualDebtToLiquidate);
- }
-
- /**
- * @notice Returns the configuration data for the debt and the collateral reserves.
- * @param eModeCategories The configuration of all the efficiency mode categories
- * @param collateralReserve The data of the collateral reserve
- * @param params The additional parameters needed to execute the liquidation function
- * @return The collateral aToken
- * @return The address to use as price source for the collateral
- * @return The address to use as price source for the debt
- * @return The liquidation bonus to apply to the collateral
- */
- function _getConfigurationData(
- mapping(uint8 => DataTypes.EModeCategory) storage eModeCategories,
- DataTypes.ReserveData storage collateralReserve,
- DataTypes.ExecuteLiquidationCallParams memory params
- ) internal view returns (IAToken, address, address, uint256) {
- IAToken collateralAToken = IAToken(collateralReserve.aTokenAddress);
- uint256 liquidationBonus = collateralReserve.configuration.getLiquidationBonus();
-
- address collateralPriceSource = params.collateralAsset;
- address debtPriceSource = params.debtAsset;
-
- if (params.userEModeCategory != 0) {
- address eModePriceSource = eModeCategories[params.userEModeCategory].priceSource;
-
- if (
- EModeLogic.isInEModeCategory(
- params.userEModeCategory,
- collateralReserve.configuration.getEModeCategory()
- )
- ) {
- liquidationBonus = eModeCategories[params.userEModeCategory].liquidationBonus;
-
- if (eModePriceSource != address(0)) {
- collateralPriceSource = eModePriceSource;
- }
- }
-
- // when in eMode, debt will always be in the same eMode category, can skip matching category check
- if (eModePriceSource != address(0)) {
- debtPriceSource = eModePriceSource;
- }
- }
-
- return (collateralAToken, collateralPriceSource, debtPriceSource, liquidationBonus);
+ return (userVariableDebt, actualDebtToLiquidate);
}
struct AvailableCollateralToLiquidateLocalVars {
diff --git a/src/core/contracts/protocol/libraries/logic/PoolLogic.sol b/src/contracts/protocol/libraries/logic/PoolLogic.sol
similarity index 99%
rename from src/core/contracts/protocol/libraries/logic/PoolLogic.sol
rename to src/contracts/protocol/libraries/logic/PoolLogic.sol
index 92138fe8..1558fe55 100644
--- a/src/core/contracts/protocol/libraries/logic/PoolLogic.sol
+++ b/src/contracts/protocol/libraries/logic/PoolLogic.sol
@@ -43,7 +43,6 @@ library PoolLogic {
require(Address.isContract(params.asset), Errors.NOT_CONTRACT);
reservesData[params.asset].init(
params.aTokenAddress,
- params.stableDebtAddress,
params.variableDebtAddress,
params.interestRateStrategyAddress
);
diff --git a/src/core/contracts/protocol/libraries/logic/ReserveLogic.sol b/src/contracts/protocol/libraries/logic/ReserveLogic.sol
similarity index 74%
rename from src/core/contracts/protocol/libraries/logic/ReserveLogic.sol
rename to src/contracts/protocol/libraries/logic/ReserveLogic.sol
index dedcfb61..dd5c637d 100644
--- a/src/core/contracts/protocol/libraries/logic/ReserveLogic.sol
+++ b/src/contracts/protocol/libraries/logic/ReserveLogic.sol
@@ -3,7 +3,6 @@ pragma solidity ^0.8.10;
import {IERC20} from '../../../dependencies/openzeppelin/contracts/IERC20.sol';
import {GPv2SafeERC20} from '../../../dependencies/gnosis/contracts/GPv2SafeERC20.sol';
-import {IStableDebtToken} from '../../../interfaces/IStableDebtToken.sol';
import {IVariableDebtToken} from '../../../interfaces/IVariableDebtToken.sol';
import {IReserveInterestRateStrategy} from '../../../interfaces/IReserveInterestRateStrategy.sol';
import {ReserveConfiguration} from '../configuration/ReserveConfiguration.sol';
@@ -133,14 +132,12 @@ library ReserveLogic {
* @notice Initializes a reserve.
* @param reserve The reserve object
* @param aTokenAddress The address of the overlying atoken contract
- * @param stableDebtTokenAddress The address of the overlying stable debt token contract
* @param variableDebtTokenAddress The address of the overlying variable debt token contract
* @param interestRateStrategyAddress The address of the interest rate strategy contract
*/
function init(
DataTypes.ReserveData storage reserve,
address aTokenAddress,
- address stableDebtTokenAddress,
address variableDebtTokenAddress,
address interestRateStrategyAddress
) internal {
@@ -149,20 +146,12 @@ library ReserveLogic {
reserve.liquidityIndex = uint128(WadRayMath.RAY);
reserve.variableBorrowIndex = uint128(WadRayMath.RAY);
reserve.aTokenAddress = aTokenAddress;
- reserve.stableDebtTokenAddress = stableDebtTokenAddress;
reserve.variableDebtTokenAddress = variableDebtTokenAddress;
reserve.interestRateStrategyAddress = interestRateStrategyAddress;
}
- struct UpdateInterestRatesAndVirtualBalanceLocalVars {
- uint256 nextLiquidityRate;
- uint256 nextStableRate;
- uint256 nextVariableRate;
- uint256 totalVariableDebt;
- }
-
/**
- * @notice Updates the reserve current stable borrow rate, the current variable borrow rate and the current liquidity rate.
+ * @notice Updates the reserve current variable borrow rate and the current liquidity rate.
* @param reserve The reserve reserve to be updated
* @param reserveCache The caching layer for the reserve data
* @param reserveAddress The address of the reserve to be updated
@@ -176,34 +165,27 @@ library ReserveLogic {
uint256 liquidityAdded,
uint256 liquidityTaken
) internal {
- UpdateInterestRatesAndVirtualBalanceLocalVars memory vars;
-
- vars.totalVariableDebt = reserveCache.nextScaledVariableDebt.rayMul(
+ uint256 totalVariableDebt = reserveCache.nextScaledVariableDebt.rayMul(
reserveCache.nextVariableBorrowIndex
);
- (
- vars.nextLiquidityRate,
- vars.nextStableRate,
- vars.nextVariableRate
- ) = IReserveInterestRateStrategy(reserve.interestRateStrategyAddress).calculateInterestRates(
- DataTypes.CalculateInterestRatesParams({
- unbacked: reserve.unbacked,
- liquidityAdded: liquidityAdded,
- liquidityTaken: liquidityTaken,
- totalStableDebt: reserveCache.nextTotalStableDebt,
- totalVariableDebt: vars.totalVariableDebt,
- averageStableBorrowRate: reserveCache.nextAvgStableBorrowRate,
- reserveFactor: reserveCache.reserveFactor,
- reserve: reserveAddress,
- usingVirtualBalance: reserve.configuration.getIsVirtualAccActive(),
- virtualUnderlyingBalance: reserve.virtualUnderlyingBalance
- })
- );
+ (uint256 nextLiquidityRate, uint256 nextVariableRate) = IReserveInterestRateStrategy(
+ reserve.interestRateStrategyAddress
+ ).calculateInterestRates(
+ DataTypes.CalculateInterestRatesParams({
+ unbacked: reserve.unbacked,
+ liquidityAdded: liquidityAdded,
+ liquidityTaken: liquidityTaken,
+ totalDebt: totalVariableDebt,
+ reserveFactor: reserveCache.reserveFactor,
+ reserve: reserveAddress,
+ usingVirtualBalance: reserve.configuration.getIsVirtualAccActive(),
+ virtualUnderlyingBalance: reserve.virtualUnderlyingBalance
+ })
+ );
- reserve.currentLiquidityRate = vars.nextLiquidityRate.toUint128();
- reserve.currentStableBorrowRate = vars.nextStableRate.toUint128();
- reserve.currentVariableBorrowRate = vars.nextVariableRate.toUint128();
+ reserve.currentLiquidityRate = nextLiquidityRate.toUint128();
+ reserve.currentVariableBorrowRate = nextVariableRate.toUint128();
// Only affect virtual balance if the reserve uses it
if (reserve.configuration.getIsVirtualAccActive()) {
@@ -217,23 +199,14 @@ library ReserveLogic {
emit ReserveDataUpdated(
reserveAddress,
- vars.nextLiquidityRate,
- vars.nextStableRate,
- vars.nextVariableRate,
+ nextLiquidityRate,
+ 0,
+ nextVariableRate,
reserveCache.nextLiquidityIndex,
reserveCache.nextVariableBorrowIndex
);
}
- struct AccrueToTreasuryLocalVars {
- uint256 prevTotalStableDebt;
- uint256 prevTotalVariableDebt;
- uint256 currTotalVariableDebt;
- uint256 cumulatedStableInterest;
- uint256 totalDebtAccrued;
- uint256 amountToMint;
- }
-
/**
* @notice Mints part of the repaid interest to the reserve treasury as a function of the reserve factor for the
* specific asset.
@@ -244,47 +217,27 @@ library ReserveLogic {
DataTypes.ReserveData storage reserve,
DataTypes.ReserveCache memory reserveCache
) internal {
- AccrueToTreasuryLocalVars memory vars;
-
if (reserveCache.reserveFactor == 0) {
return;
}
//calculate the total variable debt at moment of the last interaction
- vars.prevTotalVariableDebt = reserveCache.currScaledVariableDebt.rayMul(
+ uint256 prevTotalVariableDebt = reserveCache.currScaledVariableDebt.rayMul(
reserveCache.currVariableBorrowIndex
);
//calculate the new total variable debt after accumulation of the interest on the index
- vars.currTotalVariableDebt = reserveCache.currScaledVariableDebt.rayMul(
+ uint256 currTotalVariableDebt = reserveCache.currScaledVariableDebt.rayMul(
reserveCache.nextVariableBorrowIndex
);
- //calculate the stable debt until the last timestamp update
- vars.cumulatedStableInterest = MathUtils.calculateCompoundedInterest(
- reserveCache.currAvgStableBorrowRate,
- reserveCache.stableDebtLastUpdateTimestamp,
- reserveCache.reserveLastUpdateTimestamp
- );
+ //debt accrued is the sum of the current debt minus the sum of the debt at the last update
+ uint256 totalDebtAccrued = currTotalVariableDebt - prevTotalVariableDebt;
- vars.prevTotalStableDebt = reserveCache.currPrincipalStableDebt.rayMul(
- vars.cumulatedStableInterest
- );
+ uint256 amountToMint = totalDebtAccrued.percentMul(reserveCache.reserveFactor);
- //debt accrued is the sum of the current debt minus the sum of the debt at the last update
- vars.totalDebtAccrued =
- vars.currTotalVariableDebt +
- reserveCache.currTotalStableDebt -
- vars.prevTotalVariableDebt -
- vars.prevTotalStableDebt;
-
- vars.amountToMint = vars.totalDebtAccrued.percentMul(reserveCache.reserveFactor);
-
- if (vars.amountToMint != 0) {
- reserve.accruedToTreasury += vars
- .amountToMint
- .rayDiv(reserveCache.nextLiquidityIndex)
- .toUint128();
+ if (amountToMint != 0) {
+ reserve.accruedToTreasury += amountToMint.rayDiv(reserveCache.nextLiquidityIndex).toUint128();
}
}
@@ -347,7 +300,6 @@ library ReserveLogic {
reserveCache.currVariableBorrowRate = reserve.currentVariableBorrowRate;
reserveCache.aTokenAddress = reserve.aTokenAddress;
- reserveCache.stableDebtTokenAddress = reserve.stableDebtTokenAddress;
reserveCache.variableDebtTokenAddress = reserve.variableDebtTokenAddress;
reserveCache.reserveLastUpdateTimestamp = reserve.lastUpdateTimestamp;
@@ -356,18 +308,6 @@ library ReserveLogic {
reserveCache.variableDebtTokenAddress
).scaledTotalSupply();
- (
- reserveCache.currPrincipalStableDebt,
- reserveCache.currTotalStableDebt,
- reserveCache.currAvgStableBorrowRate,
- reserveCache.stableDebtLastUpdateTimestamp
- ) = IStableDebtToken(reserveCache.stableDebtTokenAddress).getSupplyData();
-
- // by default the actions are considered as not affecting the debt balances.
- // if the action involves mint/burn of debt, the cache needs to be updated
- reserveCache.nextTotalStableDebt = reserveCache.currTotalStableDebt;
- reserveCache.nextAvgStableBorrowRate = reserveCache.currAvgStableBorrowRate;
-
return reserveCache;
}
}
diff --git a/src/core/contracts/protocol/libraries/logic/SupplyLogic.sol b/src/contracts/protocol/libraries/logic/SupplyLogic.sol
similarity index 100%
rename from src/core/contracts/protocol/libraries/logic/SupplyLogic.sol
rename to src/contracts/protocol/libraries/logic/SupplyLogic.sol
diff --git a/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol b/src/contracts/protocol/libraries/logic/ValidationLogic.sol
similarity index 74%
rename from src/core/contracts/protocol/libraries/logic/ValidationLogic.sol
rename to src/contracts/protocol/libraries/logic/ValidationLogic.sol
index 79c734c0..e08a30e8 100644
--- a/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol
+++ b/src/contracts/protocol/libraries/logic/ValidationLogic.sol
@@ -5,6 +5,7 @@ import {IERC20} from '../../../dependencies/openzeppelin/contracts/IERC20.sol';
import {Address} from '../../../dependencies/openzeppelin/contracts/Address.sol';
import {GPv2SafeERC20} from '../../../dependencies/gnosis/contracts/GPv2SafeERC20.sol';
import {IReserveInterestRateStrategy} from '../../../interfaces/IReserveInterestRateStrategy.sol';
+import {IScaledBalanceToken} from '../../../interfaces/IScaledBalanceToken.sol';
import {IPriceOracleGetter} from '../../../interfaces/IPriceOracleGetter.sol';
import {IAToken} from '../../../interfaces/IAToken.sol';
import {IPriceOracleSentinel} from '../../../interfaces/IPriceOracleSentinel.sol';
@@ -12,6 +13,7 @@ import {IPoolAddressesProvider} from '../../../interfaces/IPoolAddressesProvider
import {IAccessControl} from '../../../dependencies/openzeppelin/contracts/IAccessControl.sol';
import {ReserveConfiguration} from '../configuration/ReserveConfiguration.sol';
import {UserConfiguration} from '../configuration/UserConfiguration.sol';
+import {EModeConfiguration} from '../configuration/EModeConfiguration.sol';
import {Errors} from '../helpers/Errors.sol';
import {WadRayMath} from '../math/WadRayMath.sol';
import {PercentageMath} from '../math/PercentageMath.sol';
@@ -69,9 +71,7 @@ library ValidationLogic {
) internal view {
require(amount != 0, Errors.INVALID_AMOUNT);
- (bool isActive, bool isFrozen, , , bool isPaused) = reserveCache
- .reserveConfiguration
- .getFlags();
+ (bool isActive, bool isFrozen, , bool isPaused) = reserveCache.reserveConfiguration.getFlags();
require(isActive, Errors.RESERVE_INACTIVE);
require(!isPaused, Errors.RESERVE_PAUSED);
require(!isFrozen, Errors.RESERVE_FROZEN);
@@ -101,7 +101,7 @@ library ValidationLogic {
require(amount != 0, Errors.INVALID_AMOUNT);
require(amount <= userBalance, Errors.NOT_ENOUGH_AVAILABLE_USER_BALANCE);
- (bool isActive, , , , bool isPaused) = reserveCache.reserveConfiguration.getFlags();
+ (bool isActive, , , bool isPaused) = reserveCache.reserveConfiguration.getFlags();
require(isActive, Errors.RESERVE_INACTIVE);
require(!isPaused, Errors.RESERVE_PAUSED);
}
@@ -119,13 +119,11 @@ library ValidationLogic {
uint256 borrowCap;
uint256 amountInBaseCurrency;
uint256 assetUnit;
- address eModePriceSource;
address siloedBorrowingAddress;
bool isActive;
bool isFrozen;
bool isPaused;
bool borrowingEnabled;
- bool stableRateBorrowingEnabled;
bool siloedBorrowingEnabled;
}
@@ -146,13 +144,10 @@ library ValidationLogic {
ValidateBorrowLocalVars memory vars;
- (
- vars.isActive,
- vars.isFrozen,
- vars.borrowingEnabled,
- vars.stableRateBorrowingEnabled,
- vars.isPaused
- ) = params.reserveCache.reserveConfiguration.getFlags();
+ (vars.isActive, vars.isFrozen, vars.borrowingEnabled, vars.isPaused) = params
+ .reserveCache
+ .reserveConfiguration
+ .getFlags();
require(vars.isActive, Errors.RESERVE_INACTIVE);
require(!vars.isPaused, Errors.RESERVE_PAUSED);
@@ -172,8 +167,7 @@ library ValidationLogic {
//validate interest rate mode
require(
- params.interestRateMode == DataTypes.InterestRateMode.VARIABLE ||
- params.interestRateMode == DataTypes.InterestRateMode.STABLE,
+ params.interestRateMode == DataTypes.InterestRateMode.VARIABLE,
Errors.INVALID_INTEREST_RATE_MODE_SELECTED
);
@@ -188,10 +182,7 @@ library ValidationLogic {
params.reserveCache.nextVariableBorrowIndex
);
- vars.totalDebt =
- params.reserveCache.currTotalStableDebt +
- vars.totalSupplyVariableDebt +
- params.amount;
+ vars.totalDebt = vars.totalSupplyVariableDebt + params.amount;
unchecked {
require(vars.totalDebt <= vars.borrowCap * vars.assetUnit, Errors.BORROW_CAP_EXCEEDED);
@@ -218,10 +209,12 @@ library ValidationLogic {
if (params.userEModeCategory != 0) {
require(
- params.reserveCache.reserveConfiguration.getEModeCategory() == params.userEModeCategory,
- Errors.INCONSISTENT_EMODE_CATEGORY
+ EModeConfiguration.isReserveEnabledOnBitmap(
+ eModeCategories[params.userEModeCategory].borrowableBitmap,
+ reservesData[params.asset].id
+ ),
+ Errors.NOT_BORROWABLE_IN_EMODE
);
- vars.eModePriceSource = eModeCategories[params.userEModeCategory].priceSource;
}
(
@@ -253,9 +246,7 @@ library ValidationLogic {
);
vars.amountInBaseCurrency =
- IPriceOracleGetter(params.oracle).getAssetPrice(
- vars.eModePriceSource != address(0) ? vars.eModePriceSource : params.asset
- ) *
+ IPriceOracleGetter(params.oracle).getAssetPrice(params.asset) *
params.amount;
unchecked {
vars.amountInBaseCurrency /= vars.assetUnit;
@@ -270,35 +261,6 @@ library ValidationLogic {
Errors.COLLATERAL_CANNOT_COVER_NEW_BORROW
);
- /**
- * Following conditions need to be met if the user is borrowing at a stable rate:
- * 1. Reserve must be enabled for stable rate borrowing
- * 2. Users cannot borrow from the reserve if their collateral is (mostly) the same currency
- * they are borrowing, to prevent abuses.
- * 3. Users will be able to borrow only a portion of the total available liquidity
- */
-
- if (params.interestRateMode == DataTypes.InterestRateMode.STABLE) {
- //check if the borrow mode is stable and if stable rate borrowing is enabled on this reserve
-
- require(vars.stableRateBorrowingEnabled, Errors.STABLE_BORROWING_NOT_ENABLED);
-
- require(
- !params.userConfig.isUsingAsCollateral(reservesData[params.asset].id) ||
- params.reserveCache.reserveConfiguration.getLtv() == 0 ||
- params.amount > IERC20(params.reserveCache.aTokenAddress).balanceOf(params.userAddress),
- Errors.COLLATERAL_SAME_AS_BORROWING_CURRENCY
- );
-
- vars.availableLiquidity = reservesData[params.asset].virtualUnderlyingBalance;
-
- //calculate the max available loan size in stable rate mode as a percentage of the
- //available liquidity
- uint256 maxLoanSizeStable = vars.availableLiquidity.percentMul(params.maxStableLoanPercent);
-
- require(params.amount <= maxLoanSizeStable, Errors.AMOUNT_BIGGER_THAN_MAX_LOAN_SIZE_STABLE);
- }
-
if (params.userConfig.isBorrowingAny()) {
(vars.siloedBorrowingEnabled, vars.siloedBorrowingAddress) = params
.userConfig
@@ -319,125 +281,31 @@ library ValidationLogic {
* @notice Validates a repay action.
* @param reserveCache The cached data of the reserve
* @param amountSent The amount sent for the repayment. Can be an actual value or uint(-1)
- * @param interestRateMode The interest rate mode of the debt being repaid
* @param onBehalfOf The address of the user msg.sender is repaying for
- * @param stableDebt The borrow balance of the user
- * @param variableDebt The borrow balance of the user
+ * @param debt The borrow balance of the user
*/
function validateRepay(
DataTypes.ReserveCache memory reserveCache,
uint256 amountSent,
DataTypes.InterestRateMode interestRateMode,
address onBehalfOf,
- uint256 stableDebt,
- uint256 variableDebt
+ uint256 debt
) internal view {
require(amountSent != 0, Errors.INVALID_AMOUNT);
+ require(
+ interestRateMode == DataTypes.InterestRateMode.VARIABLE,
+ Errors.INVALID_INTEREST_RATE_MODE_SELECTED
+ );
require(
amountSent != type(uint256).max || msg.sender == onBehalfOf,
Errors.NO_EXPLICIT_AMOUNT_TO_REPAY_ON_BEHALF
);
- (bool isActive, , , , bool isPaused) = reserveCache.reserveConfiguration.getFlags();
+ (bool isActive, , , bool isPaused) = reserveCache.reserveConfiguration.getFlags();
require(isActive, Errors.RESERVE_INACTIVE);
require(!isPaused, Errors.RESERVE_PAUSED);
- require(
- (stableDebt != 0 && interestRateMode == DataTypes.InterestRateMode.STABLE) ||
- (variableDebt != 0 && interestRateMode == DataTypes.InterestRateMode.VARIABLE),
- Errors.NO_DEBT_OF_SELECTED_TYPE
- );
- }
-
- /**
- * @notice Validates a swap of borrow rate mode.
- * @param reserve The reserve state on which the user is swapping the rate
- * @param reserveCache The cached data of the reserve
- * @param userConfig The user reserves configuration
- * @param stableDebt The stable debt of the user
- * @param variableDebt The variable debt of the user
- * @param currentRateMode The rate mode of the debt being swapped
- */
- function validateSwapRateMode(
- DataTypes.ReserveData storage reserve,
- DataTypes.ReserveCache memory reserveCache,
- DataTypes.UserConfigurationMap storage userConfig,
- uint256 stableDebt,
- uint256 variableDebt,
- DataTypes.InterestRateMode currentRateMode
- ) internal view {
- (bool isActive, , , bool stableRateEnabled, bool isPaused) = reserveCache
- .reserveConfiguration
- .getFlags();
- require(isActive, Errors.RESERVE_INACTIVE);
- require(!isPaused, Errors.RESERVE_PAUSED);
-
- if (currentRateMode == DataTypes.InterestRateMode.STABLE) {
- require(stableDebt != 0, Errors.NO_OUTSTANDING_STABLE_DEBT);
- } else if (currentRateMode == DataTypes.InterestRateMode.VARIABLE) {
- require(variableDebt != 0, Errors.NO_OUTSTANDING_VARIABLE_DEBT);
- /**
- * user wants to swap to stable, before swapping we need to ensure that
- * 1. stable borrow rate is enabled on the reserve
- * 2. user is not trying to abuse the reserve by supplying
- * more collateral than he is borrowing, artificially lowering
- * the interest rate, borrowing at variable, and switching to stable
- */
- require(stableRateEnabled, Errors.STABLE_BORROWING_NOT_ENABLED);
-
- require(
- !userConfig.isUsingAsCollateral(reserve.id) ||
- reserveCache.reserveConfiguration.getLtv() == 0 ||
- stableDebt + variableDebt > IERC20(reserveCache.aTokenAddress).balanceOf(msg.sender),
- Errors.COLLATERAL_SAME_AS_BORROWING_CURRENCY
- );
- } else {
- revert(Errors.INVALID_INTEREST_RATE_MODE_SELECTED);
- }
- }
-
- /**
- * @notice Validates a stable borrow rate rebalance action.
- * @dev Rebalancing is accepted when depositors are earning <= 90% of their earnings in pure supply/demand market (variable rate only)
- * For this to be the case, there has to be quite large stable debt with an interest rate below the current variable rate.
- * @param reserve The reserve state on which the user is getting rebalanced
- * @param reserveCache The cached state of the reserve
- * @param reserveAddress The address of the reserve
- */
- function validateRebalanceStableBorrowRate(
- DataTypes.ReserveData storage reserve,
- DataTypes.ReserveCache memory reserveCache,
- address reserveAddress
- ) internal view {
- (bool isActive, , , , bool isPaused) = reserveCache.reserveConfiguration.getFlags();
- require(isActive, Errors.RESERVE_INACTIVE);
- require(!isPaused, Errors.RESERVE_PAUSED);
-
- uint256 totalDebt = IERC20(reserveCache.stableDebtTokenAddress).totalSupply() +
- IERC20(reserveCache.variableDebtTokenAddress).totalSupply();
-
- (uint256 liquidityRateVariableDebtOnly, , ) = IReserveInterestRateStrategy(
- reserve.interestRateStrategyAddress
- ).calculateInterestRates(
- DataTypes.CalculateInterestRatesParams({
- unbacked: reserve.unbacked,
- liquidityAdded: 0,
- liquidityTaken: 0,
- totalStableDebt: 0,
- totalVariableDebt: totalDebt,
- averageStableBorrowRate: 0,
- reserveFactor: reserveCache.reserveFactor,
- reserve: reserveAddress,
- usingVirtualBalance: reserve.configuration.getIsVirtualAccActive(),
- virtualUnderlyingBalance: reserve.virtualUnderlyingBalance
- })
- );
-
- require(
- reserveCache.currLiquidityRate <=
- liquidityRateVariableDebtOnly.percentMul(REBALANCE_UP_LIQUIDITY_RATE_THRESHOLD),
- Errors.INTEREST_RATE_REBALANCE_CONDITIONS_NOT_MET
- );
+ require(debt != 0, Errors.NO_DEBT_OF_SELECTED_TYPE);
}
/**
@@ -451,7 +319,7 @@ library ValidationLogic {
) internal pure {
require(userBalance != 0, Errors.UNDERLYING_BALANCE_ZERO);
- (bool isActive, , , , bool isPaused) = reserveCache.reserveConfiguration.getFlags();
+ (bool isActive, , , bool isPaused) = reserveCache.reserveConfiguration.getFlags();
require(isActive, Errors.RESERVE_INACTIVE);
require(!isPaused, Errors.RESERVE_PAUSED);
}
@@ -518,11 +386,11 @@ library ValidationLogic {
) internal view {
ValidateLiquidationCallLocalVars memory vars;
- (vars.collateralReserveActive, , , , vars.collateralReservePaused) = collateralReserve
+ (vars.collateralReserveActive, , , vars.collateralReservePaused) = collateralReserve
.configuration
.getFlags();
- (vars.principalReserveActive, , , , vars.principalReservePaused) = params
+ (vars.principalReserveActive, , , vars.principalReservePaused) = params
.debtReserveCache
.reserveConfiguration
.getFlags();
@@ -663,7 +531,6 @@ library ValidationLogic {
) internal view {
require(asset != address(0), Errors.ZERO_ADDRESS_NOT_VALID);
require(reserve.id != 0 || reservesList[0] == asset, Errors.ASSET_NOT_LISTED);
- require(IERC20(reserve.stableDebtTokenAddress).totalSupply() == 0, Errors.STABLE_DEBT_NOT_ZERO);
require(
IERC20(reserve.variableDebtTokenAddress).totalSupply() == 0,
Errors.VARIABLE_DEBT_SUPPLY_NOT_ZERO
@@ -676,24 +543,21 @@ library ValidationLogic {
/**
* @notice Validates the action of setting efficiency mode.
- * @param reservesData The state of all the reserves
- * @param reservesList The addresses of all the active reserves
* @param eModeCategories a mapping storing configurations for all efficiency mode categories
* @param userConfig the user configuration
* @param reservesCount The total number of valid reserves
* @param categoryId The id of the category
*/
function validateSetUserEMode(
- mapping(address => DataTypes.ReserveData) storage reservesData,
- mapping(uint256 => address) storage reservesList,
mapping(uint8 => DataTypes.EModeCategory) storage eModeCategories,
DataTypes.UserConfigurationMap memory userConfig,
uint256 reservesCount,
uint8 categoryId
) internal view {
+ DataTypes.EModeCategory storage eModeCategory = eModeCategories[categoryId];
// category is invalid if the liq threshold is not set
require(
- categoryId == 0 || eModeCategories[categoryId].liquidationThreshold != 0,
+ categoryId == 0 || eModeCategory.liquidationThreshold != 0,
Errors.INCONSISTENT_EMODE_CATEGORY
);
@@ -708,11 +572,9 @@ library ValidationLogic {
unchecked {
for (uint256 i = 0; i < reservesCount; i++) {
if (userConfig.isBorrowing(i)) {
- DataTypes.ReserveConfigurationMap memory configuration = reservesData[reservesList[i]]
- .configuration;
require(
- configuration.getEModeCategory() == categoryId,
- Errors.INCONSISTENT_EMODE_CATEGORY
+ EModeConfiguration.isReserveEnabledOnBitmap(eModeCategory.borrowableBitmap, i),
+ Errors.NOT_BORROWABLE_IN_EMODE
);
}
}
diff --git a/src/core/contracts/protocol/libraries/math/MathUtils.sol b/src/contracts/protocol/libraries/math/MathUtils.sol
similarity index 100%
rename from src/core/contracts/protocol/libraries/math/MathUtils.sol
rename to src/contracts/protocol/libraries/math/MathUtils.sol
diff --git a/src/core/contracts/protocol/libraries/math/PercentageMath.sol b/src/contracts/protocol/libraries/math/PercentageMath.sol
similarity index 100%
rename from src/core/contracts/protocol/libraries/math/PercentageMath.sol
rename to src/contracts/protocol/libraries/math/PercentageMath.sol
diff --git a/src/core/contracts/protocol/libraries/math/WadRayMath.sol b/src/contracts/protocol/libraries/math/WadRayMath.sol
similarity index 100%
rename from src/core/contracts/protocol/libraries/math/WadRayMath.sol
rename to src/contracts/protocol/libraries/math/WadRayMath.sol
diff --git a/src/core/contracts/protocol/libraries/types/ConfiguratorInputTypes.sol b/src/contracts/protocol/libraries/types/ConfiguratorInputTypes.sol
similarity index 89%
rename from src/core/contracts/protocol/libraries/types/ConfiguratorInputTypes.sol
rename to src/contracts/protocol/libraries/types/ConfiguratorInputTypes.sol
index 7a80594e..7894871b 100644
--- a/src/core/contracts/protocol/libraries/types/ConfiguratorInputTypes.sol
+++ b/src/contracts/protocol/libraries/types/ConfiguratorInputTypes.sol
@@ -4,7 +4,6 @@ pragma solidity ^0.8.0;
library ConfiguratorInputTypes {
struct InitReserveInput {
address aTokenImpl;
- address stableDebtTokenImpl;
address variableDebtTokenImpl;
bool useVirtualBalance;
address interestRateStrategyAddress;
@@ -15,8 +14,6 @@ library ConfiguratorInputTypes {
string aTokenSymbol;
string variableDebtTokenName;
string variableDebtTokenSymbol;
- string stableDebtTokenName;
- string stableDebtTokenSymbol;
bytes params;
bytes interestRateData;
}
diff --git a/src/core/contracts/protocol/libraries/types/DataTypes.sol b/src/contracts/protocol/libraries/types/DataTypes.sol
similarity index 89%
rename from src/core/contracts/protocol/libraries/types/DataTypes.sol
rename to src/contracts/protocol/libraries/types/DataTypes.sol
index 64f3e891..13c12c99 100644
--- a/src/core/contracts/protocol/libraries/types/DataTypes.sol
+++ b/src/contracts/protocol/libraries/types/DataTypes.sol
@@ -17,7 +17,7 @@ library DataTypes {
uint128 variableBorrowIndex;
//the current variable borrow rate. Expressed in ray
uint128 currentVariableBorrowRate;
- //the current stable borrow rate. Expressed in ray
+ // DEPRECATED on v3.2.0
uint128 currentStableBorrowRate;
//timestamp of last update
uint40 lastUpdateTimestamp;
@@ -25,7 +25,7 @@ library DataTypes {
uint16 id;
//aToken address
address aTokenAddress;
- //stableDebtToken address
+ // DEPRECATED on v3.2.0
address stableDebtTokenAddress;
//variableDebtToken address
address variableDebtTokenAddress;
@@ -50,8 +50,8 @@ library DataTypes {
uint128 variableBorrowIndex;
//the current variable borrow rate. Expressed in ray
uint128 currentVariableBorrowRate;
- //the current stable borrow rate. Expressed in ray
- uint128 currentStableBorrowRate;
+ // DEPRECATED on v3.2.0
+ uint128 __deprecatedStableBorrowRate;
//timestamp of last update
uint40 lastUpdateTimestamp;
//the id of the reserve. Represents the position in the list of the active reserves
@@ -60,8 +60,8 @@ library DataTypes {
uint40 liquidationGracePeriodUntil;
//aToken address
address aTokenAddress;
- //stableDebtToken address
- address stableDebtTokenAddress;
+ // DEPRECATED on v3.2.0
+ address __deprecatedStableDebtTokenAddress;
//variableDebtToken address
address variableDebtTokenAddress;
//address of the interest rate strategy
@@ -84,7 +84,7 @@ library DataTypes {
//bit 56: reserve is active
//bit 57: reserve is frozen
//bit 58: borrowing is enabled
- //bit 59: stable rate borrowing enabled
+ //bit 59: DEPRECATED: stable rate borrowing enabled
//bit 60: asset is paused
//bit 61: borrowing in isolation mode is enabled
//bit 62: siloed borrowing enabled
@@ -93,7 +93,7 @@ library DataTypes {
//bit 80-115: borrow cap in whole tokens, borrowCap == 0 => no cap
//bit 116-151: supply cap in whole tokens, supplyCap == 0 => no cap
//bit 152-167: liquidation protocol fee
- //bit 168-175: eMode category
+ //bit 168-175: DEPRECATED: eMode category
//bit 176-211: unbacked mint cap in whole tokens, unbackedMintCap == 0 => minting disabled
//bit 212-251: debt ceiling for isolation mode with (ReserveConfiguration::DEBT_CEILING_DECIMALS) decimals
//bit 252: virtual accounting is enabled for the reserve
@@ -111,30 +111,49 @@ library DataTypes {
uint256 data;
}
- struct EModeCategory {
+ // DEPRECATED: kept for backwards compatibility, might be removed in a future version
+ struct EModeCategoryLegacy {
// each eMode category has a custom ltv and liquidation threshold
uint16 ltv;
uint16 liquidationThreshold;
uint16 liquidationBonus;
- // each eMode category may or may not have a custom oracle to override the individual assets price oracles
+ // DEPRECATED
address priceSource;
string label;
}
+ struct CollateralConfig {
+ uint16 ltv;
+ uint16 liquidationThreshold;
+ uint16 liquidationBonus;
+ }
+
+ struct EModeCategoryBaseConfiguration {
+ uint16 ltv;
+ uint16 liquidationThreshold;
+ uint16 liquidationBonus;
+ string label;
+ }
+
+ struct EModeCategory {
+ // each eMode category has a custom ltv and liquidation threshold
+ uint16 ltv;
+ uint16 liquidationThreshold;
+ uint16 liquidationBonus;
+ uint128 collateralBitmap;
+ string label;
+ uint128 borrowableBitmap;
+ }
+
enum InterestRateMode {
NONE,
- STABLE,
+ __DEPRECATED,
VARIABLE
}
struct ReserveCache {
uint256 currScaledVariableDebt;
uint256 nextScaledVariableDebt;
- uint256 currPrincipalStableDebt;
- uint256 currAvgStableBorrowRate;
- uint256 currTotalStableDebt;
- uint256 nextAvgStableBorrowRate;
- uint256 nextTotalStableDebt;
uint256 currLiquidityIndex;
uint256 nextLiquidityIndex;
uint256 currVariableBorrowIndex;
@@ -144,10 +163,8 @@ library DataTypes {
uint256 reserveFactor;
ReserveConfigurationMap reserveConfiguration;
address aTokenAddress;
- address stableDebtTokenAddress;
address variableDebtTokenAddress;
uint40 reserveLastUpdateTimestamp;
- uint40 stableDebtLastUpdateTimestamp;
}
struct ExecuteLiquidationCallParams {
@@ -177,7 +194,6 @@ library DataTypes {
InterestRateMode interestRateMode;
uint16 referralCode;
bool releaseUnderlying;
- uint256 maxStableRateBorrowSizePercent;
uint256 reservesCount;
address oracle;
uint8 userEModeCategory;
@@ -229,7 +245,6 @@ library DataTypes {
uint16 referralCode;
uint256 flashLoanPremiumToProtocol;
uint256 flashLoanPremiumTotal;
- uint256 maxStableRateBorrowSizePercent;
uint256 reservesCount;
address addressesProvider;
address pool;
@@ -271,7 +286,6 @@ library DataTypes {
address userAddress;
uint256 amount;
InterestRateMode interestRateMode;
- uint256 maxStableLoanPercent;
uint256 reservesCount;
address oracle;
uint8 userEModeCategory;
@@ -292,9 +306,7 @@ library DataTypes {
uint256 unbacked;
uint256 liquidityAdded;
uint256 liquidityTaken;
- uint256 totalStableDebt;
- uint256 totalVariableDebt;
- uint256 averageStableBorrowRate;
+ uint256 totalDebt;
uint256 reserveFactor;
address reserve;
bool usingVirtualBalance;
@@ -304,7 +316,6 @@ library DataTypes {
struct InitReserveParams {
address asset;
address aTokenAddress;
- address stableDebtAddress;
address variableDebtAddress;
address interestRateStrategyAddress;
uint16 reservesCount;
diff --git a/src/core/contracts/protocol/pool/L2Pool.sol b/src/contracts/protocol/pool/L2Pool.sol
similarity index 86%
rename from src/core/contracts/protocol/pool/L2Pool.sol
rename to src/contracts/protocol/pool/L2Pool.sol
index 801c20e8..d8925717 100644
--- a/src/core/contracts/protocol/pool/L2Pool.sol
+++ b/src/contracts/protocol/pool/L2Pool.sol
@@ -79,24 +79,6 @@ abstract contract L2Pool is Pool, IL2Pool {
return repayWithATokens(asset, amount, interestRateMode);
}
- /// @inheritdoc IL2Pool
- function swapBorrowRateMode(bytes32 args) external override {
- (address asset, uint256 interestRateMode) = CalldataLogic.decodeSwapBorrowRateModeParams(
- _reservesList,
- args
- );
- swapBorrowRateMode(asset, interestRateMode);
- }
-
- /// @inheritdoc IL2Pool
- function rebalanceStableBorrowRate(bytes32 args) external override {
- (address asset, address user) = CalldataLogic.decodeRebalanceStableBorrowRateParams(
- _reservesList,
- args
- );
- rebalanceStableBorrowRate(asset, user);
- }
-
/// @inheritdoc IL2Pool
function setUserUseReserveAsCollateral(bytes32 args) external override {
(address asset, bool useAsCollateral) = CalldataLogic.decodeSetUserUseReserveAsCollateralParams(
diff --git a/src/core/contracts/protocol/pool/Pool.sol b/src/contracts/protocol/pool/Pool.sol
similarity index 90%
rename from src/core/contracts/protocol/pool/Pool.sol
rename to src/contracts/protocol/pool/Pool.sol
index 4397323d..f4a9812e 100644
--- a/src/core/contracts/protocol/pool/Pool.sol
+++ b/src/contracts/protocol/pool/Pool.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.10;
-import {VersionedInitializable} from '../libraries/aave-upgradeability/VersionedInitializable.sol';
+import {VersionedInitializable} from '../../misc/aave-upgradeability/VersionedInitializable.sol';
import {Errors} from '../libraries/helpers/Errors.sol';
import {ReserveConfiguration} from '../libraries/configuration/ReserveConfiguration.sol';
import {PoolLogic} from '../libraries/logic/PoolLogic.sol';
@@ -28,8 +28,7 @@ import {PoolStorage} from './PoolStorage.sol';
* # Withdraw
* # Borrow
* # Repay
- * # Swap their loans between variable and stable rate
- * # Enable/disable their supplied assets as collateral rebalance stable rate borrow positions
+ * # Enable/disable their supplied assets as collateral
* # Liquidate positions
* # Execute Flash Loans
* @dev To be covered by a proxy contract, owned by the PoolAddressesProvider of the specific market
@@ -230,7 +229,6 @@ abstract contract Pool is VersionedInitializable, PoolStorage, IPool {
interestRateMode: DataTypes.InterestRateMode(interestRateMode),
referralCode: referralCode,
releaseUnderlying: true,
- maxStableRateBorrowSizePercent: _maxStableRateBorrowSizePercent,
reservesCount: _reservesCount,
oracle: ADDRESSES_PROVIDER.getPriceOracle(),
userEModeCategory: _usersEModeCategory[onBehalfOf],
@@ -317,33 +315,6 @@ abstract contract Pool is VersionedInitializable, PoolStorage, IPool {
);
}
- /// @inheritdoc IPool
- function swapBorrowRateMode(address asset, uint256 interestRateMode) public virtual override {
- BorrowLogic.executeSwapBorrowRateMode(
- _reserves[asset],
- _usersConfig[msg.sender],
- asset,
- msg.sender,
- DataTypes.InterestRateMode(interestRateMode)
- );
- }
-
- /// @inheritdoc IPool
- function swapToVariable(address asset, address user) public virtual override {
- BorrowLogic.executeSwapBorrowRateMode(
- _reserves[asset],
- _usersConfig[user],
- asset,
- user,
- DataTypes.InterestRateMode.STABLE
- );
- }
-
- /// @inheritdoc IPool
- function rebalanceStableBorrowRate(address asset, address user) public virtual override {
- BorrowLogic.executeRebalanceStableBorrowRate(_reserves[asset], asset, user);
- }
-
/// @inheritdoc IPool
function setUserUseReserveAsCollateral(
address asset,
@@ -409,7 +380,6 @@ abstract contract Pool is VersionedInitializable, PoolStorage, IPool {
referralCode: referralCode,
flashLoanPremiumToProtocol: _flashLoanPremiumToProtocol,
flashLoanPremiumTotal: _flashLoanPremiumTotal,
- maxStableRateBorrowSizePercent: _maxStableRateBorrowSizePercent,
reservesCount: _reservesCount,
addressesProvider: address(ADDRESSES_PROVIDER),
pool: address(this),
@@ -472,11 +442,9 @@ abstract contract Pool is VersionedInitializable, PoolStorage, IPool {
res.currentLiquidityRate = reserve.currentLiquidityRate;
res.variableBorrowIndex = reserve.variableBorrowIndex;
res.currentVariableBorrowRate = reserve.currentVariableBorrowRate;
- res.currentStableBorrowRate = reserve.currentStableBorrowRate;
res.lastUpdateTimestamp = reserve.lastUpdateTimestamp;
res.id = reserve.id;
res.aTokenAddress = reserve.aTokenAddress;
- res.stableDebtTokenAddress = reserve.stableDebtTokenAddress;
res.variableDebtTokenAddress = reserve.variableDebtTokenAddress;
res.interestRateStrategyAddress = reserve.interestRateStrategyAddress;
res.accruedToTreasury = reserve.accruedToTreasury;
@@ -583,11 +551,6 @@ abstract contract Pool is VersionedInitializable, PoolStorage, IPool {
return _reservesList[id];
}
- /// @inheritdoc IPool
- function MAX_STABLE_RATE_BORROW_SIZE_PERCENT() public view virtual override returns (uint256) {
- return _maxStableRateBorrowSizePercent;
- }
-
/// @inheritdoc IPool
function BRIDGE_PROTOCOL_FEE() public view virtual override returns (uint256) {
return _bridgeProtocolFee;
@@ -641,7 +604,6 @@ abstract contract Pool is VersionedInitializable, PoolStorage, IPool {
function initReserve(
address asset,
address aTokenAddress,
- address stableDebtAddress,
address variableDebtAddress,
address interestRateStrategyAddress
) external virtual override onlyPoolConfigurator {
@@ -652,7 +614,6 @@ abstract contract Pool is VersionedInitializable, PoolStorage, IPool {
DataTypes.InitReserveParams({
asset: asset,
aTokenAddress: aTokenAddress,
- stableDebtAddress: stableDebtAddress,
variableDebtAddress: variableDebtAddress,
interestRateStrategyAddress: interestRateStrategyAddress,
reservesCount: _reservesCount,
@@ -725,18 +686,76 @@ abstract contract Pool is VersionedInitializable, PoolStorage, IPool {
/// @inheritdoc IPool
function configureEModeCategory(
uint8 id,
- DataTypes.EModeCategory memory category
+ DataTypes.EModeCategoryBaseConfiguration memory category
+ ) external virtual override onlyPoolConfigurator {
+ // category 0 is reserved for volatile heterogeneous assets and it's always disabled
+ require(id != 0, Errors.EMODE_CATEGORY_RESERVED);
+ _eModeCategories[id].ltv = category.ltv;
+ _eModeCategories[id].liquidationThreshold = category.liquidationThreshold;
+ _eModeCategories[id].liquidationBonus = category.liquidationBonus;
+ _eModeCategories[id].label = category.label;
+ }
+
+ /// @inheritdoc IPool
+ function configureEModeCategoryCollateralBitmap(
+ uint8 id,
+ uint128 collateralBitmap
) external virtual override onlyPoolConfigurator {
// category 0 is reserved for volatile heterogeneous assets and it's always disabled
require(id != 0, Errors.EMODE_CATEGORY_RESERVED);
- _eModeCategories[id] = category;
+ _eModeCategories[id].collateralBitmap = collateralBitmap;
+ }
+
+ /// @inheritdoc IPool
+ function configureEModeCategoryBorrowableBitmap(
+ uint8 id,
+ uint128 borrowableBitmap
+ ) external virtual override onlyPoolConfigurator {
+ // category 0 is reserved for volatile heterogeneous assets and it's always disabled
+ require(id != 0, Errors.EMODE_CATEGORY_RESERVED);
+ _eModeCategories[id].borrowableBitmap = borrowableBitmap;
}
/// @inheritdoc IPool
function getEModeCategoryData(
uint8 id
- ) external view virtual override returns (DataTypes.EModeCategory memory) {
- return _eModeCategories[id];
+ ) external view virtual override returns (DataTypes.EModeCategoryLegacy memory) {
+ DataTypes.EModeCategory memory category = _eModeCategories[id];
+ return
+ DataTypes.EModeCategoryLegacy({
+ ltv: category.ltv,
+ liquidationThreshold: category.liquidationThreshold,
+ liquidationBonus: category.liquidationBonus,
+ priceSource: address(0),
+ label: category.label
+ });
+ }
+
+ /// @inheritdoc IPool
+ function getEModeCategoryCollateralConfig(
+ uint8 id
+ ) external view returns (DataTypes.CollateralConfig memory) {
+ return
+ DataTypes.CollateralConfig({
+ ltv: _eModeCategories[id].ltv,
+ liquidationThreshold: _eModeCategories[id].liquidationThreshold,
+ liquidationBonus: _eModeCategories[id].liquidationBonus
+ });
+ }
+
+ /// @inheritdoc IPool
+ function getEModeCategoryLabel(uint8 id) external view returns (string memory) {
+ return _eModeCategories[id].label;
+ }
+
+ /// @inheritdoc IPool
+ function getEModeCategoryCollateralBitmap(uint8 id) external view returns (uint128) {
+ return _eModeCategories[id].collateralBitmap;
+ }
+
+ /// @inheritdoc IPool
+ function getEModeCategoryBorrowableBitmap(uint8 id) external view returns (uint128) {
+ return _eModeCategories[id].borrowableBitmap;
}
/// @inheritdoc IPool
diff --git a/src/core/contracts/protocol/pool/PoolConfigurator.sol b/src/contracts/protocol/pool/PoolConfigurator.sol
similarity index 89%
rename from src/core/contracts/protocol/pool/PoolConfigurator.sol
rename to src/contracts/protocol/pool/PoolConfigurator.sol
index 9a6ced2c..778ee79b 100644
--- a/src/core/contracts/protocol/pool/PoolConfigurator.sol
+++ b/src/contracts/protocol/pool/PoolConfigurator.sol
@@ -1,8 +1,9 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.10;
-import {VersionedInitializable} from '../libraries/aave-upgradeability/VersionedInitializable.sol';
+import {VersionedInitializable} from '../../misc/aave-upgradeability/VersionedInitializable.sol';
import {ReserveConfiguration} from '../libraries/configuration/ReserveConfiguration.sol';
+import {EModeConfiguration} from '../libraries/configuration/EModeConfiguration.sol';
import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
import {IDefaultInterestRateStrategyV2} from '../../interfaces/IDefaultInterestRateStrategyV2.sol';
import {Errors} from '../libraries/helpers/Errors.sol';
@@ -104,13 +105,6 @@ abstract contract PoolConfigurator is VersionedInitializable, IPoolConfigurator
ConfiguratorLogic.executeUpdateAToken(_pool, input);
}
- /// @inheritdoc IPoolConfigurator
- function updateStableDebtToken(
- ConfiguratorInputTypes.UpdateDebtTokenInput calldata input
- ) external override onlyPoolAdmin {
- ConfiguratorLogic.executeUpdateStableDebtToken(_pool, input);
- }
-
/// @inheritdoc IPoolConfigurator
function updateVariableDebtToken(
ConfiguratorInputTypes.UpdateDebtTokenInput calldata input
@@ -121,9 +115,6 @@ abstract contract PoolConfigurator is VersionedInitializable, IPoolConfigurator
/// @inheritdoc IPoolConfigurator
function setReserveBorrowing(address asset, bool enabled) external override onlyRiskOrPoolAdmins {
DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
- if (!enabled) {
- require(!currentConfig.getStableRateBorrowingEnabled(), Errors.STABLE_BORROWING_ENABLED);
- }
currentConfig.setBorrowingEnabled(enabled);
_pool.setConfiguration(asset, currentConfig);
emit ReserveBorrowing(asset, enabled);
@@ -181,20 +172,6 @@ abstract contract PoolConfigurator is VersionedInitializable, IPoolConfigurator
emit CollateralConfigurationChanged(asset, newLtv, liquidationThreshold, liquidationBonus);
}
- /// @inheritdoc IPoolConfigurator
- function setReserveStableRateBorrowing(
- address asset,
- bool enabled
- ) external override onlyRiskOrPoolAdmins {
- DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
- if (enabled) {
- require(currentConfig.getBorrowingEnabled(), Errors.BORROWING_NOT_ENABLED);
- }
- currentConfig.setStableRateBorrowingEnabled(enabled);
- _pool.setConfiguration(asset, currentConfig);
- emit ReserveStableRateBorrowing(asset, enabled);
- }
-
/// @inheritdoc IPoolConfigurator
function setReserveFlashLoaning(
address asset,
@@ -397,7 +374,6 @@ abstract contract PoolConfigurator is VersionedInitializable, IPoolConfigurator
uint16 ltv,
uint16 liquidationThreshold,
uint16 liquidationBonus,
- address oracle,
string calldata label
) external override onlyRiskOrPoolAdmins {
require(ltv != 0, Errors.INVALID_EMODE_CATEGORY_PARAMS);
@@ -420,53 +396,57 @@ abstract contract PoolConfigurator is VersionedInitializable, IPoolConfigurator
Errors.INVALID_EMODE_CATEGORY_PARAMS
);
- address[] memory reserves = _pool.getReservesList();
- for (uint256 i = 0; i < reserves.length; i++) {
- DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(reserves[i]);
- if (categoryId == currentConfig.getEModeCategory()) {
- uint256 currentLtv = currentConfig.getFrozen()
- ? _pendingLtv[reserves[i]]
- : currentConfig.getLtv();
- require(ltv > currentLtv, Errors.INVALID_EMODE_CATEGORY_PARAMS);
-
- require(
- liquidationThreshold > currentConfig.getLiquidationThreshold(),
- Errors.INVALID_EMODE_CATEGORY_PARAMS
- );
- }
- }
+ DataTypes.EModeCategoryBaseConfiguration memory categoryData;
+ categoryData.ltv = ltv;
+ categoryData.liquidationThreshold = liquidationThreshold;
+ categoryData.liquidationBonus = liquidationBonus;
+ categoryData.label = label;
- _pool.configureEModeCategory(
+ _pool.configureEModeCategory(categoryId, categoryData);
+ emit EModeCategoryAdded(
categoryId,
- DataTypes.EModeCategory({
- ltv: ltv,
- liquidationThreshold: liquidationThreshold,
- liquidationBonus: liquidationBonus,
- priceSource: oracle,
- label: label
- })
+ ltv,
+ liquidationThreshold,
+ liquidationBonus,
+ address(0),
+ label
);
- emit EModeCategoryAdded(categoryId, ltv, liquidationThreshold, liquidationBonus, oracle, label);
}
/// @inheritdoc IPoolConfigurator
- function setAssetEModeCategory(
+ function setAssetCollateralInEMode(
address asset,
- uint8 newCategoryId
+ uint8 categoryId,
+ bool allowed
) external override onlyRiskOrPoolAdmins {
- DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
+ uint128 collateralBitmap = _pool.getEModeCategoryCollateralBitmap(categoryId);
+ DataTypes.ReserveDataLegacy memory reserveData = _pool.getReserveData(asset);
+ require(reserveData.id != 0 || _pool.getReservesList()[0] == asset, Errors.ASSET_NOT_LISTED);
+ collateralBitmap = EModeConfiguration.setReserveBitmapBit(
+ collateralBitmap,
+ reserveData.id,
+ allowed
+ );
+ _pool.configureEModeCategoryCollateralBitmap(categoryId, collateralBitmap);
+ emit AssetCollateralInEModeChanged(asset, categoryId, allowed);
+ }
- if (newCategoryId != 0) {
- DataTypes.EModeCategory memory categoryData = _pool.getEModeCategoryData(newCategoryId);
- require(
- categoryData.liquidationThreshold > currentConfig.getLiquidationThreshold(),
- Errors.INVALID_EMODE_CATEGORY_ASSIGNMENT
- );
- }
- uint256 oldCategoryId = currentConfig.getEModeCategory();
- currentConfig.setEModeCategory(newCategoryId);
- _pool.setConfiguration(asset, currentConfig);
- emit EModeAssetCategoryChanged(asset, uint8(oldCategoryId), newCategoryId);
+ /// @inheritdoc IPoolConfigurator
+ function setAssetBorrowableInEMode(
+ address asset,
+ uint8 categoryId,
+ bool borrowable
+ ) external override onlyRiskOrPoolAdmins {
+ uint128 borrowableBitmap = _pool.getEModeCategoryBorrowableBitmap(categoryId);
+ DataTypes.ReserveDataLegacy memory reserveData = _pool.getReserveData(asset);
+ require(reserveData.id != 0 || _pool.getReservesList()[0] == asset, Errors.ASSET_NOT_LISTED);
+ borrowableBitmap = EModeConfiguration.setReserveBitmapBit(
+ borrowableBitmap,
+ reserveData.id,
+ borrowable
+ );
+ _pool.configureEModeCategoryBorrowableBitmap(categoryId, borrowableBitmap);
+ emit AssetBorrowableInEModeChanged(asset, categoryId, borrowable);
}
/// @inheritdoc IPoolConfigurator
diff --git a/src/core/contracts/protocol/pool/PoolStorage.sol b/src/contracts/protocol/pool/PoolStorage.sol
similarity index 93%
rename from src/core/contracts/protocol/pool/PoolStorage.sol
rename to src/contracts/protocol/pool/PoolStorage.sol
index ccf22b3f..719461e4 100644
--- a/src/core/contracts/protocol/pool/PoolStorage.sol
+++ b/src/contracts/protocol/pool/PoolStorage.sol
@@ -43,8 +43,8 @@ contract PoolStorage {
// FlashLoan premium paid to protocol treasury, expressed in bps
uint128 internal _flashLoanPremiumToProtocol;
- // Available liquidity that can be borrowed at once at stable rate, expressed in bps
- uint64 internal _maxStableRateBorrowSizePercent;
+ // DEPRECATED on v3.2.0
+ uint64 internal __DEPRECATED_maxStableRateBorrowSizePercent;
// Maximum number of active reserves there have been in the protocol. It is the upper bound of the reserves list
uint16 internal _reservesCount;
diff --git a/src/core/contracts/protocol/tokenization/AToken.sol b/src/contracts/protocol/tokenization/AToken.sol
similarity index 98%
rename from src/core/contracts/protocol/tokenization/AToken.sol
rename to src/contracts/protocol/tokenization/AToken.sol
index 126801bf..47ba03d9 100644
--- a/src/core/contracts/protocol/tokenization/AToken.sol
+++ b/src/contracts/protocol/tokenization/AToken.sol
@@ -4,7 +4,7 @@ pragma solidity ^0.8.10;
import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
import {GPv2SafeERC20} from '../../dependencies/gnosis/contracts/GPv2SafeERC20.sol';
import {SafeCast} from '../../dependencies/openzeppelin/contracts/SafeCast.sol';
-import {VersionedInitializable} from '../libraries/aave-upgradeability/VersionedInitializable.sol';
+import {VersionedInitializable} from '../../misc/aave-upgradeability/VersionedInitializable.sol';
import {Errors} from '../libraries/helpers/Errors.sol';
import {WadRayMath} from '../libraries/math/WadRayMath.sol';
import {IPool} from '../../interfaces/IPool.sol';
diff --git a/src/core/contracts/protocol/tokenization/VariableDebtToken.sol b/src/contracts/protocol/tokenization/VariableDebtToken.sol
similarity index 97%
rename from src/core/contracts/protocol/tokenization/VariableDebtToken.sol
rename to src/contracts/protocol/tokenization/VariableDebtToken.sol
index 0987494b..37494c85 100644
--- a/src/core/contracts/protocol/tokenization/VariableDebtToken.sol
+++ b/src/contracts/protocol/tokenization/VariableDebtToken.sol
@@ -3,7 +3,7 @@ pragma solidity ^0.8.10;
import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
import {SafeCast} from '../../dependencies/openzeppelin/contracts/SafeCast.sol';
-import {VersionedInitializable} from '../libraries/aave-upgradeability/VersionedInitializable.sol';
+import {VersionedInitializable} from '../../misc/aave-upgradeability/VersionedInitializable.sol';
import {WadRayMath} from '../libraries/math/WadRayMath.sol';
import {Errors} from '../libraries/helpers/Errors.sol';
import {IPool} from '../../interfaces/IPool.sol';
diff --git a/src/core/contracts/protocol/tokenization/base/DebtTokenBase.sol b/src/contracts/protocol/tokenization/base/DebtTokenBase.sol
similarity index 96%
rename from src/core/contracts/protocol/tokenization/base/DebtTokenBase.sol
rename to src/contracts/protocol/tokenization/base/DebtTokenBase.sol
index 8dc79203..626b6d8b 100644
--- a/src/core/contracts/protocol/tokenization/base/DebtTokenBase.sol
+++ b/src/contracts/protocol/tokenization/base/DebtTokenBase.sol
@@ -3,14 +3,14 @@ pragma solidity ^0.8.10;
import {Context} from '../../../dependencies/openzeppelin/contracts/Context.sol';
import {Errors} from '../../libraries/helpers/Errors.sol';
-import {VersionedInitializable} from '../../libraries/aave-upgradeability/VersionedInitializable.sol';
+import {VersionedInitializable} from '../../../misc/aave-upgradeability/VersionedInitializable.sol';
import {ICreditDelegationToken} from '../../../interfaces/ICreditDelegationToken.sol';
import {EIP712Base} from './EIP712Base.sol';
/**
* @title DebtTokenBase
* @author Aave
- * @notice Base contract for different types of debt tokens, like StableDebtToken or VariableDebtToken
+ * @notice Base contract for different types of debt tokens, like VariableDebtToken
*/
abstract contract DebtTokenBase is
VersionedInitializable,
diff --git a/src/core/contracts/protocol/tokenization/base/EIP712Base.sol b/src/contracts/protocol/tokenization/base/EIP712Base.sol
similarity index 100%
rename from src/core/contracts/protocol/tokenization/base/EIP712Base.sol
rename to src/contracts/protocol/tokenization/base/EIP712Base.sol
diff --git a/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol b/src/contracts/protocol/tokenization/base/IncentivizedERC20.sol
similarity index 98%
rename from src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol
rename to src/contracts/protocol/tokenization/base/IncentivizedERC20.sol
index a20cd05f..4bca0483 100644
--- a/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol
+++ b/src/contracts/protocol/tokenization/base/IncentivizedERC20.sol
@@ -41,8 +41,7 @@ abstract contract IncentivizedERC20 is Context, IERC20Detailed {
/**
* @dev UserState - additionalData is a flexible field.
* ATokens and VariableDebtTokens use this field store the index of the
- * user's last supply/withdrawal/borrow/repayment. StableDebtTokens use
- * this field to store the user's stable rate.
+ * user's last supply/withdrawal/borrow/repayment.
*/
struct UserState {
uint128 balance;
diff --git a/src/core/contracts/protocol/tokenization/base/MintableIncentivizedERC20.sol b/src/contracts/protocol/tokenization/base/MintableIncentivizedERC20.sol
similarity index 100%
rename from src/core/contracts/protocol/tokenization/base/MintableIncentivizedERC20.sol
rename to src/contracts/protocol/tokenization/base/MintableIncentivizedERC20.sol
diff --git a/src/core/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol b/src/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol
similarity index 100%
rename from src/core/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol
rename to src/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol
diff --git a/src/periphery/contracts/rewards/EmissionManager.sol b/src/contracts/rewards/EmissionManager.sol
similarity index 95%
rename from src/periphery/contracts/rewards/EmissionManager.sol
rename to src/contracts/rewards/EmissionManager.sol
index 19138df8..b18473ff 100644
--- a/src/periphery/contracts/rewards/EmissionManager.sol
+++ b/src/contracts/rewards/EmissionManager.sol
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.10;
-import {Ownable} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/Ownable.sol';
-import {IEACAggregatorProxy} from '../misc/interfaces/IEACAggregatorProxy.sol';
+import {Ownable} from '../dependencies/openzeppelin/contracts/Ownable.sol';
+import {IEACAggregatorProxy} from '../helpers/interfaces/IEACAggregatorProxy.sol';
import {IEmissionManager} from './interfaces/IEmissionManager.sol';
import {ITransferStrategyBase} from './interfaces/ITransferStrategyBase.sol';
import {IRewardsController} from './interfaces/IRewardsController.sol';
diff --git a/src/periphery/contracts/rewards/RewardsController.sol b/src/contracts/rewards/RewardsController.sol
similarity index 96%
rename from src/periphery/contracts/rewards/RewardsController.sol
rename to src/contracts/rewards/RewardsController.sol
index 0c369a60..3a817f60 100644
--- a/src/periphery/contracts/rewards/RewardsController.sol
+++ b/src/contracts/rewards/RewardsController.sol
@@ -1,14 +1,14 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.10;
-import {VersionedInitializable} from 'aave-v3-core/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol';
-import {SafeCast} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol';
-import {IScaledBalanceToken} from 'aave-v3-core/contracts/interfaces/IScaledBalanceToken.sol';
+import {VersionedInitializable} from '../misc/aave-upgradeability/VersionedInitializable.sol';
+import {SafeCast} from '../dependencies/openzeppelin/contracts/SafeCast.sol';
+import {IScaledBalanceToken} from '../interfaces/IScaledBalanceToken.sol';
import {RewardsDistributor} from './RewardsDistributor.sol';
import {IRewardsController} from './interfaces/IRewardsController.sol';
import {ITransferStrategyBase} from './interfaces/ITransferStrategyBase.sol';
import {RewardsDataTypes} from './libraries/RewardsDataTypes.sol';
-import {IEACAggregatorProxy} from '../misc/interfaces/IEACAggregatorProxy.sol';
+import {IEACAggregatorProxy} from '../helpers/interfaces/IEACAggregatorProxy.sol';
/**
* @title RewardsController
diff --git a/src/periphery/contracts/rewards/RewardsDistributor.sol b/src/contracts/rewards/RewardsDistributor.sol
similarity index 98%
rename from src/periphery/contracts/rewards/RewardsDistributor.sol
rename to src/contracts/rewards/RewardsDistributor.sol
index 5a76bb1e..3969a6fd 100644
--- a/src/periphery/contracts/rewards/RewardsDistributor.sol
+++ b/src/contracts/rewards/RewardsDistributor.sol
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.10;
-import {IScaledBalanceToken} from 'aave-v3-core/contracts/interfaces/IScaledBalanceToken.sol';
-import {IERC20Detailed} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol';
-import {SafeCast} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol';
+import {IScaledBalanceToken} from '../interfaces/IScaledBalanceToken.sol';
+import {IERC20Detailed} from '../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
+import {SafeCast} from '../dependencies/openzeppelin/contracts/SafeCast.sol';
import {IRewardsDistributor} from './interfaces/IRewardsDistributor.sol';
import {RewardsDataTypes} from './libraries/RewardsDataTypes.sol';
diff --git a/src/periphery/contracts/rewards/interfaces/IEmissionManager.sol b/src/contracts/rewards/interfaces/IEmissionManager.sol
similarity index 98%
rename from src/periphery/contracts/rewards/interfaces/IEmissionManager.sol
rename to src/contracts/rewards/interfaces/IEmissionManager.sol
index 2f1f7eac..4853af21 100644
--- a/src/periphery/contracts/rewards/interfaces/IEmissionManager.sol
+++ b/src/contracts/rewards/interfaces/IEmissionManager.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
-import {IEACAggregatorProxy} from '../../misc/interfaces/IEACAggregatorProxy.sol';
+import {IEACAggregatorProxy} from '../../helpers/interfaces/IEACAggregatorProxy.sol';
import {RewardsDataTypes} from '../libraries/RewardsDataTypes.sol';
import {ITransferStrategyBase} from './ITransferStrategyBase.sol';
import {IRewardsController} from './IRewardsController.sol';
diff --git a/src/periphery/contracts/rewards/interfaces/IPullRewardsTransferStrategy.sol b/src/contracts/rewards/interfaces/IPullRewardsTransferStrategy.sol
similarity index 100%
rename from src/periphery/contracts/rewards/interfaces/IPullRewardsTransferStrategy.sol
rename to src/contracts/rewards/interfaces/IPullRewardsTransferStrategy.sol
diff --git a/src/periphery/contracts/rewards/interfaces/IRewardsController.sol b/src/contracts/rewards/interfaces/IRewardsController.sol
similarity index 99%
rename from src/periphery/contracts/rewards/interfaces/IRewardsController.sol
rename to src/contracts/rewards/interfaces/IRewardsController.sol
index 952da7cb..cdb2ac29 100644
--- a/src/periphery/contracts/rewards/interfaces/IRewardsController.sol
+++ b/src/contracts/rewards/interfaces/IRewardsController.sol
@@ -3,7 +3,7 @@ pragma solidity ^0.8.10;
import {IRewardsDistributor} from './IRewardsDistributor.sol';
import {ITransferStrategyBase} from './ITransferStrategyBase.sol';
-import {IEACAggregatorProxy} from '../../misc/interfaces/IEACAggregatorProxy.sol';
+import {IEACAggregatorProxy} from '../../helpers/interfaces/IEACAggregatorProxy.sol';
import {RewardsDataTypes} from '../libraries/RewardsDataTypes.sol';
/**
diff --git a/src/periphery/contracts/rewards/interfaces/IRewardsDistributor.sol b/src/contracts/rewards/interfaces/IRewardsDistributor.sol
similarity index 100%
rename from src/periphery/contracts/rewards/interfaces/IRewardsDistributor.sol
rename to src/contracts/rewards/interfaces/IRewardsDistributor.sol
diff --git a/src/periphery/contracts/rewards/interfaces/IStakedToken.sol b/src/contracts/rewards/interfaces/IStakedToken.sol
similarity index 100%
rename from src/periphery/contracts/rewards/interfaces/IStakedToken.sol
rename to src/contracts/rewards/interfaces/IStakedToken.sol
diff --git a/src/periphery/contracts/rewards/interfaces/IStakedTokenTransferStrategy.sol b/src/contracts/rewards/interfaces/IStakedTokenTransferStrategy.sol
similarity index 100%
rename from src/periphery/contracts/rewards/interfaces/IStakedTokenTransferStrategy.sol
rename to src/contracts/rewards/interfaces/IStakedTokenTransferStrategy.sol
diff --git a/src/periphery/contracts/rewards/interfaces/ITransferStrategyBase.sol b/src/contracts/rewards/interfaces/ITransferStrategyBase.sol
similarity index 100%
rename from src/periphery/contracts/rewards/interfaces/ITransferStrategyBase.sol
rename to src/contracts/rewards/interfaces/ITransferStrategyBase.sol
diff --git a/src/periphery/contracts/rewards/libraries/RewardsDataTypes.sol b/src/contracts/rewards/libraries/RewardsDataTypes.sol
similarity index 94%
rename from src/periphery/contracts/rewards/libraries/RewardsDataTypes.sol
rename to src/contracts/rewards/libraries/RewardsDataTypes.sol
index 4cafda32..38fe87c5 100644
--- a/src/periphery/contracts/rewards/libraries/RewardsDataTypes.sol
+++ b/src/contracts/rewards/libraries/RewardsDataTypes.sol
@@ -2,7 +2,7 @@
pragma solidity ^0.8.10;
import {ITransferStrategyBase} from '../interfaces/ITransferStrategyBase.sol';
-import {IEACAggregatorProxy} from '../../misc/interfaces/IEACAggregatorProxy.sol';
+import {IEACAggregatorProxy} from '../../helpers/interfaces/IEACAggregatorProxy.sol';
library RewardsDataTypes {
struct RewardsConfigInput {
diff --git a/src/periphery/contracts/rewards/transfer-strategies/PullRewardsTransferStrategy.sol b/src/contracts/rewards/transfer-strategies/PullRewardsTransferStrategy.sol
similarity index 88%
rename from src/periphery/contracts/rewards/transfer-strategies/PullRewardsTransferStrategy.sol
rename to src/contracts/rewards/transfer-strategies/PullRewardsTransferStrategy.sol
index 46620b3e..dc4b5a9b 100644
--- a/src/periphery/contracts/rewards/transfer-strategies/PullRewardsTransferStrategy.sol
+++ b/src/contracts/rewards/transfer-strategies/PullRewardsTransferStrategy.sol
@@ -4,8 +4,8 @@ pragma solidity ^0.8.10;
import {IPullRewardsTransferStrategy} from '../interfaces/IPullRewardsTransferStrategy.sol';
import {ITransferStrategyBase} from '../interfaces/ITransferStrategyBase.sol';
import {TransferStrategyBase} from './TransferStrategyBase.sol';
-import {GPv2SafeERC20} from 'aave-v3-core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol';
-import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
+import {GPv2SafeERC20} from '../../dependencies/gnosis/contracts/GPv2SafeERC20.sol';
+import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
/**
* @title PullRewardsTransferStrategy
diff --git a/src/periphery/contracts/rewards/transfer-strategies/StakedTokenTransferStrategy.sol b/src/contracts/rewards/transfer-strategies/StakedTokenTransferStrategy.sol
similarity index 92%
rename from src/periphery/contracts/rewards/transfer-strategies/StakedTokenTransferStrategy.sol
rename to src/contracts/rewards/transfer-strategies/StakedTokenTransferStrategy.sol
index bb3901c3..9ca6f8c3 100644
--- a/src/periphery/contracts/rewards/transfer-strategies/StakedTokenTransferStrategy.sol
+++ b/src/contracts/rewards/transfer-strategies/StakedTokenTransferStrategy.sol
@@ -5,8 +5,8 @@ import {IStakedToken} from '../interfaces/IStakedToken.sol';
import {IStakedTokenTransferStrategy} from '../interfaces/IStakedTokenTransferStrategy.sol';
import {ITransferStrategyBase} from '../interfaces/ITransferStrategyBase.sol';
import {TransferStrategyBase} from './TransferStrategyBase.sol';
-import {GPv2SafeERC20} from 'aave-v3-core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol';
-import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
+import {GPv2SafeERC20} from '../../dependencies/gnosis/contracts/GPv2SafeERC20.sol';
+import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
/**
* @title StakedTokenTransferStrategy
diff --git a/src/periphery/contracts/rewards/transfer-strategies/TransferStrategyBase.sol b/src/contracts/rewards/transfer-strategies/TransferStrategyBase.sol
similarity index 89%
rename from src/periphery/contracts/rewards/transfer-strategies/TransferStrategyBase.sol
rename to src/contracts/rewards/transfer-strategies/TransferStrategyBase.sol
index 2f26b958..5064606d 100644
--- a/src/periphery/contracts/rewards/transfer-strategies/TransferStrategyBase.sol
+++ b/src/contracts/rewards/transfer-strategies/TransferStrategyBase.sol
@@ -2,8 +2,8 @@
pragma solidity ^0.8.10;
import {ITransferStrategyBase} from '../interfaces/ITransferStrategyBase.sol';
-import {GPv2SafeERC20} from 'aave-v3-core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol';
-import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
+import {GPv2SafeERC20} from '../../dependencies/gnosis/contracts/GPv2SafeERC20.sol';
+import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
/**
* @title TransferStrategyStorage
diff --git a/src/periphery/contracts/treasury/Collector.sol b/src/contracts/treasury/Collector.sol
similarity index 96%
rename from src/periphery/contracts/treasury/Collector.sol
rename to src/contracts/treasury/Collector.sol
index 22cf3e2f..daf6b7a3 100644
--- a/src/periphery/contracts/treasury/Collector.sol
+++ b/src/contracts/treasury/Collector.sol
@@ -3,10 +3,10 @@ pragma solidity ^0.8.0;
import {ICollector} from './ICollector.sol';
import {ReentrancyGuard} from '../dependencies/openzeppelin/ReentrancyGuard.sol';
-import {VersionedInitializable} from '../../../core/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol';
-import {IERC20} from '../../../core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
-import {SafeERC20} from '../../../core/contracts/dependencies/openzeppelin/contracts/SafeERC20.sol';
-import {Address} from '../../../core/contracts/dependencies/openzeppelin/contracts/Address.sol';
+import {VersionedInitializable} from '../misc/aave-upgradeability/VersionedInitializable.sol';
+import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.sol';
+import {SafeERC20} from '../dependencies/openzeppelin/contracts/SafeERC20.sol';
+import {Address} from '../dependencies/openzeppelin/contracts/Address.sol';
/**
* @title Collector
diff --git a/src/periphery/contracts/treasury/ICollector.sol b/src/contracts/treasury/ICollector.sol
similarity index 98%
rename from src/periphery/contracts/treasury/ICollector.sol
rename to src/contracts/treasury/ICollector.sol
index ae92353d..94103d48 100644
--- a/src/periphery/contracts/treasury/ICollector.sol
+++ b/src/contracts/treasury/ICollector.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
-import {IERC20} from '../../../core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
+import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.sol';
interface ICollector {
struct Stream {
diff --git a/src/periphery/contracts/treasury/IRevenueSplitter.sol b/src/contracts/treasury/IRevenueSplitter.sol
similarity index 97%
rename from src/periphery/contracts/treasury/IRevenueSplitter.sol
rename to src/contracts/treasury/IRevenueSplitter.sol
index 0bb36044..00911e3a 100644
--- a/src/periphery/contracts/treasury/IRevenueSplitter.sol
+++ b/src/contracts/treasury/IRevenueSplitter.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
-import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
+import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.sol';
interface IRevenueSplitterErrors {
error InvalidPercentSplit();
diff --git a/src/periphery/contracts/treasury/RevenueSplitter.sol b/src/contracts/treasury/RevenueSplitter.sol
similarity index 85%
rename from src/periphery/contracts/treasury/RevenueSplitter.sol
rename to src/contracts/treasury/RevenueSplitter.sol
index e926551a..3936467c 100644
--- a/src/periphery/contracts/treasury/RevenueSplitter.sol
+++ b/src/contracts/treasury/RevenueSplitter.sol
@@ -2,10 +2,10 @@
pragma solidity ^0.8.19;
import {IRevenueSplitter} from './IRevenueSplitter.sol';
-import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
-import {GPv2SafeERC20} from 'aave-v3-core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol';
-import {PercentageMath} from 'aave-v3-core/contracts/protocol/libraries/math/PercentageMath.sol';
-import {ReentrancyGuard} from 'aave-v3-periphery/contracts/dependencies/openzeppelin/ReentrancyGuard.sol';
+import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.sol';
+import {GPv2SafeERC20} from '../dependencies/gnosis/contracts/GPv2SafeERC20.sol';
+import {PercentageMath} from '../protocol/libraries/math/PercentageMath.sol';
+import {ReentrancyGuard} from '../dependencies/openzeppelin/ReentrancyGuard.sol';
/**
* @title RevenueSplitter
diff --git a/src/core/contracts/interfaces/IStableDebtToken.sol b/src/core/contracts/interfaces/IStableDebtToken.sol
deleted file mode 100644
index fa976676..00000000
--- a/src/core/contracts/interfaces/IStableDebtToken.sol
+++ /dev/null
@@ -1,139 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.0;
-
-import {IInitializableDebtToken} from './IInitializableDebtToken.sol';
-
-/**
- * @title IStableDebtToken
- * @author Aave
- * @notice Defines the interface for the stable debt token
- * @dev It does not inherit from IERC20 to save in code size
- */
-interface IStableDebtToken is IInitializableDebtToken {
- /**
- * @dev Emitted when new stable debt is minted
- * @param user The address of the user who triggered the minting
- * @param onBehalfOf The recipient of stable debt tokens
- * @param amount The amount minted (user entered amount + balance increase from interest)
- * @param currentBalance The balance of the user based on the previous balance and balance increase from interest
- * @param balanceIncrease The increase in balance since the last action of the user 'onBehalfOf'
- * @param newRate The rate of the debt after the minting
- * @param avgStableRate The next average stable rate after the minting
- * @param newTotalSupply The next total supply of the stable debt token after the action
- */
- event Mint(
- address indexed user,
- address indexed onBehalfOf,
- uint256 amount,
- uint256 currentBalance,
- uint256 balanceIncrease,
- uint256 newRate,
- uint256 avgStableRate,
- uint256 newTotalSupply
- );
-
- /**
- * @dev Emitted when new stable debt is burned
- * @param from The address from which the debt will be burned
- * @param amount The amount being burned (user entered amount - balance increase from interest)
- * @param currentBalance The balance of the user based on the previous balance and balance increase from interest
- * @param balanceIncrease The increase in balance since the last action of 'from'
- * @param avgStableRate The next average stable rate after the burning
- * @param newTotalSupply The next total supply of the stable debt token after the action
- */
- event Burn(
- address indexed from,
- uint256 amount,
- uint256 currentBalance,
- uint256 balanceIncrease,
- uint256 avgStableRate,
- uint256 newTotalSupply
- );
-
- /**
- * @notice Mints debt token to the `onBehalfOf` address.
- * @dev The resulting rate is the weighted average between the rate of the new debt
- * and the rate of the previous debt
- * @param user The address receiving the borrowed underlying, being the delegatee in case
- * of credit delegate, or same as `onBehalfOf` otherwise
- * @param onBehalfOf The address receiving the debt tokens
- * @param amount The amount of debt tokens to mint
- * @param rate The rate of the debt being minted
- * @return True if it is the first borrow, false otherwise
- * @return The total stable debt
- * @return The average stable borrow rate
- */
- function mint(
- address user,
- address onBehalfOf,
- uint256 amount,
- uint256 rate
- ) external returns (bool, uint256, uint256);
-
- /**
- * @notice Burns debt of `user`
- * @dev The resulting rate is the weighted average between the rate of the new debt
- * and the rate of the previous debt
- * @dev In some instances, a burn transaction will emit a mint event
- * if the amount to burn is less than the interest the user earned
- * @param from The address from which the debt will be burned
- * @param amount The amount of debt tokens getting burned
- * @return The total stable debt
- * @return The average stable borrow rate
- */
- function burn(address from, uint256 amount) external returns (uint256, uint256);
-
- /**
- * @notice Returns the average rate of all the stable rate loans.
- * @return The average stable rate
- */
- function getAverageStableRate() external view returns (uint256);
-
- /**
- * @notice Returns the stable rate of the user debt
- * @param user The address of the user
- * @return The stable rate of the user
- */
- function getUserStableRate(address user) external view returns (uint256);
-
- /**
- * @notice Returns the timestamp of the last update of the user
- * @param user The address of the user
- * @return The timestamp
- */
- function getUserLastUpdated(address user) external view returns (uint40);
-
- /**
- * @notice Returns the principal, the total supply, the average stable rate and the timestamp for the last update
- * @return The principal
- * @return The total supply
- * @return The average stable rate
- * @return The timestamp of the last update
- */
- function getSupplyData() external view returns (uint256, uint256, uint256, uint40);
-
- /**
- * @notice Returns the timestamp of the last update of the total supply
- * @return The timestamp
- */
- function getTotalSupplyLastUpdated() external view returns (uint40);
-
- /**
- * @notice Returns the total supply and the average stable rate
- * @return The total supply
- * @return The average rate
- */
- function getTotalSupplyAndAvgRate() external view returns (uint256, uint256);
-
- /**
- * @notice Returns the principal debt balance of the user
- * @return The debt balance of the user since the last burn/mint action
- */
- function principalBalanceOf(address user) external view returns (uint256);
-
- /**
- * @notice Returns the address of the underlying asset of this stableDebtToken (E.g. WETH for stableDebtWETH)
- * @return The address of the underlying asset
- */
- function UNDERLYING_ASSET_ADDRESS() external view returns (address);
-}
diff --git a/src/core/contracts/mocks/tokens/MockDebtTokens.sol b/src/core/contracts/mocks/tokens/MockDebtTokens.sol
deleted file mode 100644
index 8c186b82..00000000
--- a/src/core/contracts/mocks/tokens/MockDebtTokens.sol
+++ /dev/null
@@ -1,22 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.10;
-
-import {VariableDebtTokenInstance} from '../../../instances/VariableDebtTokenInstance.sol';
-import {StableDebtTokenInstance} from '../../../instances/StableDebtTokenInstance.sol';
-import {IPool} from '../../interfaces/IPool.sol';
-
-contract MockVariableDebtToken is VariableDebtTokenInstance {
- constructor(IPool pool) VariableDebtTokenInstance(pool) {}
-
- function getRevision() internal pure override returns (uint256) {
- return 0x2;
- }
-}
-
-contract MockStableDebtToken is StableDebtTokenInstance {
- constructor(IPool pool) StableDebtTokenInstance(pool) {}
-
- function getRevision() internal pure override returns (uint256) {
- return 0x2;
- }
-}
diff --git a/src/core/contracts/mocks/upgradeability/MockStableDebtToken.sol b/src/core/contracts/mocks/upgradeability/MockStableDebtToken.sol
deleted file mode 100644
index ea9d5cca..00000000
--- a/src/core/contracts/mocks/upgradeability/MockStableDebtToken.sol
+++ /dev/null
@@ -1,13 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.10;
-
-import {StableDebtTokenInstance} from '../../../instances/StableDebtTokenInstance.sol';
-import {IPool} from '../../interfaces/IPool.sol';
-
-contract MockStableDebtToken is StableDebtTokenInstance {
- constructor(IPool pool) StableDebtTokenInstance(pool) {}
-
- function getRevision() internal pure override returns (uint256) {
- return 0x2;
- }
-}
diff --git a/src/core/contracts/protocol/libraries/helpers/Helpers.sol b/src/core/contracts/protocol/libraries/helpers/Helpers.sol
deleted file mode 100644
index 4daf97c5..00000000
--- a/src/core/contracts/protocol/libraries/helpers/Helpers.sol
+++ /dev/null
@@ -1,28 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.0;
-
-import {IERC20} from '../../../dependencies/openzeppelin/contracts/IERC20.sol';
-import {DataTypes} from '../types/DataTypes.sol';
-
-/**
- * @title Helpers library
- * @author Aave
- */
-library Helpers {
- /**
- * @notice Fetches the user current stable and variable debt balances
- * @param user The user address
- * @param reserveCache The reserve cache data object
- * @return The stable debt balance
- * @return The variable debt balance
- */
- function getUserCurrentDebt(
- address user,
- DataTypes.ReserveCache memory reserveCache
- ) internal view returns (uint256, uint256) {
- return (
- IERC20(reserveCache.stableDebtTokenAddress).balanceOf(user),
- IERC20(reserveCache.variableDebtTokenAddress).balanceOf(user)
- );
- }
-}
diff --git a/src/core/contracts/protocol/tokenization/StableDebtToken.sol b/src/core/contracts/protocol/tokenization/StableDebtToken.sol
deleted file mode 100644
index e7c785e6..00000000
--- a/src/core/contracts/protocol/tokenization/StableDebtToken.sol
+++ /dev/null
@@ -1,141 +0,0 @@
-// SPDX-License-Identifier: BUSL-1.1
-pragma solidity ^0.8.10;
-
-import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol';
-import {VersionedInitializable} from '../libraries/aave-upgradeability/VersionedInitializable.sol';
-import {Errors} from '../libraries/helpers/Errors.sol';
-import {IAaveIncentivesController} from '../../interfaces/IAaveIncentivesController.sol';
-import {IInitializableDebtToken} from '../../interfaces/IInitializableDebtToken.sol';
-import {IStableDebtToken} from '../../interfaces/IStableDebtToken.sol';
-import {IPool} from '../../interfaces/IPool.sol';
-import {EIP712Base} from './base/EIP712Base.sol';
-import {DebtTokenBase} from './base/DebtTokenBase.sol';
-import {IncentivizedERC20} from './base/IncentivizedERC20.sol';
-
-/**
- * @title StableDebtToken
- * @author Aave
- * @notice Implements a stable debt token to track the borrowing positions of users
- * at stable rate mode
- * @dev Transfer and approve functionalities are disabled since its a non-transferable token
- */
-abstract contract StableDebtToken is DebtTokenBase, IncentivizedERC20, IStableDebtToken {
- /**
- * @dev Constructor.
- * @param pool The address of the Pool contract
- */
- constructor(
- IPool pool
- ) DebtTokenBase() IncentivizedERC20(pool, 'STABLE_DEBT_TOKEN_IMPL', 'STABLE_DEBT_TOKEN_IMPL', 0) {
- // Intentionally left blank
- }
-
- /// @inheritdoc IInitializableDebtToken
- function initialize(
- IPool initializingPool,
- address underlyingAsset,
- IAaveIncentivesController incentivesController,
- uint8 debtTokenDecimals,
- string memory debtTokenName,
- string memory debtTokenSymbol,
- bytes calldata params
- ) external virtual;
-
- /// @inheritdoc IStableDebtToken
- function getAverageStableRate() external pure virtual override returns (uint256) {
- return 0;
- }
-
- /// @inheritdoc IStableDebtToken
- function getUserLastUpdated(address) external pure virtual override returns (uint40) {
- return 0;
- }
-
- /// @inheritdoc IStableDebtToken
- function getUserStableRate(address) external pure virtual override returns (uint256) {
- return 0;
- }
-
- /// @inheritdoc IERC20
- function balanceOf(address) public pure virtual override returns (uint256) {
- return 0;
- }
-
- /// @inheritdoc IStableDebtToken
- function mint(
- address,
- address,
- uint256,
- uint256
- ) external virtual override onlyPool returns (bool, uint256, uint256) {
- revert(Errors.OPERATION_NOT_SUPPORTED);
- }
-
- /// @inheritdoc IStableDebtToken
- function burn(address, uint256) external virtual override onlyPool returns (uint256, uint256) {
- revert(Errors.OPERATION_NOT_SUPPORTED);
- }
-
- /// @inheritdoc IStableDebtToken
- function getSupplyData() external pure override returns (uint256, uint256, uint256, uint40) {
- return (0, 0, 0, 0);
- }
-
- /// @inheritdoc IStableDebtToken
- function getTotalSupplyAndAvgRate() external pure override returns (uint256, uint256) {
- return (0, 0);
- }
-
- /// @inheritdoc IERC20
- function totalSupply() public pure virtual override returns (uint256) {
- return 0;
- }
-
- /// @inheritdoc IStableDebtToken
- function getTotalSupplyLastUpdated() external pure override returns (uint40) {
- return 0;
- }
-
- /// @inheritdoc IStableDebtToken
- function principalBalanceOf(address) external pure virtual override returns (uint256) {
- return 0;
- }
-
- /// @inheritdoc IStableDebtToken
- function UNDERLYING_ASSET_ADDRESS() external view override returns (address) {
- return _underlyingAsset;
- }
-
- /// @inheritdoc EIP712Base
- function _EIP712BaseId() internal view override returns (string memory) {
- return name();
- }
-
- /**
- * @dev Being non transferrable, the debt token does not implement any of the
- * standard ERC20 functions for transfer and allowance.
- */
- function transfer(address, uint256) external virtual override returns (bool) {
- revert(Errors.OPERATION_NOT_SUPPORTED);
- }
-
- function allowance(address, address) external view virtual override returns (uint256) {
- revert(Errors.OPERATION_NOT_SUPPORTED);
- }
-
- function approve(address, uint256) external virtual override returns (bool) {
- revert(Errors.OPERATION_NOT_SUPPORTED);
- }
-
- function transferFrom(address, address, uint256) external virtual override returns (bool) {
- revert(Errors.OPERATION_NOT_SUPPORTED);
- }
-
- function increaseAllowance(address, uint256) external virtual override returns (bool) {
- revert(Errors.OPERATION_NOT_SUPPORTED);
- }
-
- function decreaseAllowance(address, uint256) external virtual override returns (bool) {
- revert(Errors.OPERATION_NOT_SUPPORTED);
- }
-}
diff --git a/src/core/instances/StableDebtTokenInstance.sol b/src/core/instances/StableDebtTokenInstance.sol
deleted file mode 100644
index 00f91a58..00000000
--- a/src/core/instances/StableDebtTokenInstance.sol
+++ /dev/null
@@ -1,46 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.0;
-
-import {StableDebtToken, IPool, IInitializableDebtToken, VersionedInitializable, IAaveIncentivesController, Errors} from '../contracts/protocol/tokenization/StableDebtToken.sol';
-
-contract StableDebtTokenInstance is StableDebtToken {
- uint256 public constant DEBT_TOKEN_REVISION = 1;
-
- constructor(IPool pool) StableDebtToken(pool) {}
-
- /// @inheritdoc VersionedInitializable
- function getRevision() internal pure virtual override returns (uint256) {
- return DEBT_TOKEN_REVISION;
- }
-
- /// @inheritdoc IInitializableDebtToken
- function initialize(
- IPool initializingPool,
- address underlyingAsset,
- IAaveIncentivesController incentivesController,
- uint8 debtTokenDecimals,
- string memory debtTokenName,
- string memory debtTokenSymbol,
- bytes calldata params
- ) external override initializer {
- require(initializingPool == POOL, Errors.POOL_ADDRESSES_DO_NOT_MATCH);
- _setName(debtTokenName);
- _setSymbol(debtTokenSymbol);
- _setDecimals(debtTokenDecimals);
-
- _underlyingAsset = underlyingAsset;
- _incentivesController = incentivesController;
-
- _domainSeparator = _calculateDomainSeparator();
-
- emit Initialized(
- underlyingAsset,
- address(POOL),
- address(incentivesController),
- debtTokenDecimals,
- debtTokenName,
- debtTokenSymbol,
- params
- );
- }
-}
diff --git a/src/deployments/contracts/procedures/AaveV3DefaultRateStrategyProcedure.sol b/src/deployments/contracts/procedures/AaveV3DefaultRateStrategyProcedure.sol
index db3e2bc8..d26419e7 100644
--- a/src/deployments/contracts/procedures/AaveV3DefaultRateStrategyProcedure.sol
+++ b/src/deployments/contracts/procedures/AaveV3DefaultRateStrategyProcedure.sol
@@ -2,7 +2,7 @@
pragma solidity ^0.8.0;
import '../../interfaces/IMarketReportTypes.sol';
-import {DefaultReserveInterestRateStrategyV2} from 'aave-v3-core/contracts/protocol/pool/DefaultReserveInterestRateStrategyV2.sol';
+import {DefaultReserveInterestRateStrategyV2} from '../../../contracts/misc/DefaultReserveInterestRateStrategyV2.sol';
contract AaveV3DefaultRateStrategyProcedure {
function _deployDefaultRateStrategyV2(address poolAddressesProvider) internal returns (address) {
diff --git a/src/deployments/contracts/procedures/AaveV3GettersProcedureOne.sol b/src/deployments/contracts/procedures/AaveV3GettersProcedureOne.sol
index ffa52d4d..8aa66732 100644
--- a/src/deployments/contracts/procedures/AaveV3GettersProcedureOne.sol
+++ b/src/deployments/contracts/procedures/AaveV3GettersProcedureOne.sol
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.10;
-import {WalletBalanceProvider} from 'aave-v3-periphery/contracts/misc/WalletBalanceProvider.sol';
-import {UiPoolDataProviderV3} from 'aave-v3-periphery/contracts/misc/UiPoolDataProviderV3.sol';
-import {UiIncentiveDataProviderV3} from 'aave-v3-periphery/contracts/misc/UiIncentiveDataProviderV3.sol';
-import {IEACAggregatorProxy} from 'aave-v3-periphery/contracts/misc/interfaces/IEACAggregatorProxy.sol';
-import {AaveProtocolDataProvider} from 'aave-v3-core/contracts/misc/AaveProtocolDataProvider.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
+import {WalletBalanceProvider} from '../../../contracts/helpers/WalletBalanceProvider.sol';
+import {UiPoolDataProviderV3} from '../../../contracts/helpers/UiPoolDataProviderV3.sol';
+import {UiIncentiveDataProviderV3} from '../../../contracts/helpers/UiIncentiveDataProviderV3.sol';
+import {IEACAggregatorProxy} from '../../../contracts/helpers/interfaces/IEACAggregatorProxy.sol';
+import {AaveProtocolDataProvider} from '../../../contracts/helpers/AaveProtocolDataProvider.sol';
+import {IPoolAddressesProvider} from '../../../contracts/interfaces/IPoolAddressesProvider.sol';
contract AaveV3GettersProcedureOne {
struct GettersReportBatchOne {
diff --git a/src/deployments/contracts/procedures/AaveV3GettersProcedureTwo.sol b/src/deployments/contracts/procedures/AaveV3GettersProcedureTwo.sol
index eaaddb17..947cc7a9 100644
--- a/src/deployments/contracts/procedures/AaveV3GettersProcedureTwo.sol
+++ b/src/deployments/contracts/procedures/AaveV3GettersProcedureTwo.sol
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.10;
-import {IPool} from 'aave-v3-core/contracts/interfaces/IPool.sol';
-import {WrappedTokenGatewayV3} from 'aave-v3-periphery/contracts/misc/WrappedTokenGatewayV3.sol';
-import {L2Encoder} from 'aave-v3-core/contracts/misc/L2Encoder.sol';
+import {IPool} from '../../../contracts/interfaces/IPool.sol';
+import {WrappedTokenGatewayV3} from '../../../contracts/helpers/WrappedTokenGatewayV3.sol';
+import {L2Encoder} from '../../../contracts/helpers/L2Encoder.sol';
contract AaveV3GettersProcedureTwo {
struct GettersReportBatchTwo {
diff --git a/src/deployments/contracts/procedures/AaveV3HelpersProcedureOne.sol b/src/deployments/contracts/procedures/AaveV3HelpersProcedureOne.sol
index d261158f..b31a323e 100644
--- a/src/deployments/contracts/procedures/AaveV3HelpersProcedureOne.sol
+++ b/src/deployments/contracts/procedures/AaveV3HelpersProcedureOne.sol
@@ -3,10 +3,10 @@ pragma solidity ^0.8.0;
import {Create2Utils} from '../utilities/Create2Utils.sol';
import {ConfigEngineReport} from '../../interfaces/IMarketReportTypes.sol';
-import {AaveV3ConfigEngine, IAaveV3ConfigEngine, CapsEngine, BorrowEngine, CollateralEngine, RateEngine, PriceFeedEngine, EModeEngine, ListingEngine} from 'aave-v3-periphery/contracts/v3-config-engine/AaveV3ConfigEngine.sol';
-import {IPool} from 'aave-v3-core/contracts/interfaces/IPool.sol';
-import {IPoolConfigurator} from 'aave-v3-core/contracts/interfaces/IPoolConfigurator.sol';
-import {IAaveOracle} from 'aave-v3-core/contracts/interfaces/IAaveOracle.sol';
+import {AaveV3ConfigEngine, IAaveV3ConfigEngine, CapsEngine, BorrowEngine, CollateralEngine, RateEngine, PriceFeedEngine, EModeEngine, ListingEngine} from '../../../contracts/extensions/v3-config-engine/AaveV3ConfigEngine.sol';
+import {IPool} from '../../../contracts/interfaces/IPool.sol';
+import {IPoolConfigurator} from '../../../contracts/interfaces/IPoolConfigurator.sol';
+import {IAaveOracle} from '../../../contracts/interfaces/IAaveOracle.sol';
contract AaveV3HelpersProcedureOne {
function _deployConfigEngine(
@@ -17,8 +17,7 @@ contract AaveV3HelpersProcedureOne {
address rewardsController,
address collector,
address aTokenImpl,
- address vTokenImpl,
- address sTokenImpl
+ address vTokenImpl
) internal returns (ConfigEngineReport memory configEngineReport) {
IAaveV3ConfigEngine.EngineLibraries memory engineLibraries = IAaveV3ConfigEngine
.EngineLibraries({
@@ -50,7 +49,7 @@ contract AaveV3HelpersProcedureOne {
configEngineReport.capsEngine = engineLibraries.capsEngine;
configEngineReport.configEngine = address(
- new AaveV3ConfigEngine(aTokenImpl, vTokenImpl, sTokenImpl, engineConstants, engineLibraries)
+ new AaveV3ConfigEngine(aTokenImpl, vTokenImpl, engineConstants, engineLibraries)
);
return configEngineReport;
}
diff --git a/src/deployments/contracts/procedures/AaveV3HelpersProcedureTwo.sol b/src/deployments/contracts/procedures/AaveV3HelpersProcedureTwo.sol
index 742bc971..26c79db1 100644
--- a/src/deployments/contracts/procedures/AaveV3HelpersProcedureTwo.sol
+++ b/src/deployments/contracts/procedures/AaveV3HelpersProcedureTwo.sol
@@ -4,8 +4,8 @@ pragma solidity ^0.8.0;
import '../../interfaces/IMarketReportTypes.sol';
import {ITransparentProxyFactory} from 'solidity-utils/contracts/transparent-proxy/interfaces/ITransparentProxyFactory.sol';
import {TransparentProxyFactory} from 'solidity-utils/contracts/transparent-proxy/TransparentProxyFactory.sol';
-import {StataTokenV2} from 'aave-v3-periphery/contracts/static-a-token/StataTokenV2.sol';
-import {StataTokenFactory} from 'aave-v3-periphery/contracts/static-a-token/StataTokenFactory.sol';
+import {StataTokenV2} from '../../../contracts/extensions/static-a-token/StataTokenV2.sol';
+import {StataTokenFactory} from '../../../contracts/extensions/static-a-token/StataTokenFactory.sol';
import {IErrors} from '../../interfaces/IErrors.sol';
contract AaveV3HelpersProcedureTwo is IErrors {
diff --git a/src/deployments/contracts/procedures/AaveV3IncentiveProcedure.sol b/src/deployments/contracts/procedures/AaveV3IncentiveProcedure.sol
index 1801a748..b940f795 100644
--- a/src/deployments/contracts/procedures/AaveV3IncentiveProcedure.sol
+++ b/src/deployments/contracts/procedures/AaveV3IncentiveProcedure.sol
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
-import {EmissionManager} from 'aave-v3-periphery/contracts/rewards/EmissionManager.sol';
-import {RewardsController} from 'aave-v3-periphery/contracts/rewards/RewardsController.sol';
+import {EmissionManager} from '../../../contracts/rewards/EmissionManager.sol';
+import {RewardsController} from '../../../contracts/rewards/RewardsController.sol';
contract AaveV3IncentiveProcedure {
function _deployIncentives(address tempOwner) internal returns (address, address) {
diff --git a/src/deployments/contracts/procedures/AaveV3L2PoolProcedure.sol b/src/deployments/contracts/procedures/AaveV3L2PoolProcedure.sol
index 20c7965d..f6fcba67 100644
--- a/src/deployments/contracts/procedures/AaveV3L2PoolProcedure.sol
+++ b/src/deployments/contracts/procedures/AaveV3L2PoolProcedure.sol
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
-import {L2PoolInstance} from 'aave-v3-core/instances/L2PoolInstance.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
+import {L2PoolInstance} from '../../../contracts/instances/L2PoolInstance.sol';
+import {IPoolAddressesProvider} from '../../../contracts/interfaces/IPoolAddressesProvider.sol';
import {AaveV3PoolConfigProcedure} from './AaveV3PoolConfigProcedure.sol';
-import {IPool} from 'aave-v3-core/contracts/interfaces/IPool.sol';
+import {IPool} from '../../../contracts/interfaces/IPool.sol';
import {IErrors} from '../../interfaces/IErrors.sol';
import '../../interfaces/IMarketReportTypes.sol';
diff --git a/src/deployments/contracts/procedures/AaveV3MiscProcedure.sol b/src/deployments/contracts/procedures/AaveV3MiscProcedure.sol
index 516ed9d9..bd6bac8b 100644
--- a/src/deployments/contracts/procedures/AaveV3MiscProcedure.sol
+++ b/src/deployments/contracts/procedures/AaveV3MiscProcedure.sol
@@ -2,8 +2,8 @@
pragma solidity ^0.8.0;
import '../../interfaces/IMarketReportTypes.sol';
-import {PriceOracleSentinel, ISequencerOracle} from 'aave-v3-core/contracts/protocol/configuration/PriceOracleSentinel.sol';
-import {DefaultReserveInterestRateStrategyV2} from 'aave-v3-core/contracts/protocol/pool/DefaultReserveInterestRateStrategyV2.sol';
+import {PriceOracleSentinel, ISequencerOracle} from '../../../contracts/misc/PriceOracleSentinel.sol';
+import {DefaultReserveInterestRateStrategyV2} from '../../../contracts/misc/DefaultReserveInterestRateStrategyV2.sol';
import {IErrors} from '../../interfaces/IErrors.sol';
contract AaveV3MiscProcedure is IErrors {
diff --git a/src/deployments/contracts/procedures/AaveV3OracleProcedure.sol b/src/deployments/contracts/procedures/AaveV3OracleProcedure.sol
index 7acc6c91..77e97a40 100644
--- a/src/deployments/contracts/procedures/AaveV3OracleProcedure.sol
+++ b/src/deployments/contracts/procedures/AaveV3OracleProcedure.sol
@@ -2,7 +2,7 @@
pragma solidity ^0.8.0;
import '../../interfaces/IMarketReportTypes.sol';
-import {AaveOracle} from 'aave-v3-core/contracts/misc/AaveOracle.sol';
+import {AaveOracle} from '../../../contracts/misc/AaveOracle.sol';
contract AaveV3OracleProcedure {
function _deployAaveOracle(
diff --git a/src/deployments/contracts/procedures/AaveV3ParaswapProcedure.sol b/src/deployments/contracts/procedures/AaveV3ParaswapProcedure.sol
index 8e6e8b17..b89457b6 100644
--- a/src/deployments/contracts/procedures/AaveV3ParaswapProcedure.sol
+++ b/src/deployments/contracts/procedures/AaveV3ParaswapProcedure.sol
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
-import {ParaSwapLiquiditySwapAdapter, IParaSwapAugustusRegistry} from 'aave-v3-periphery/contracts/adapters/paraswap/ParaSwapLiquiditySwapAdapter.sol';
-import {ParaSwapRepayAdapter} from 'aave-v3-periphery/contracts/adapters/paraswap/ParaSwapRepayAdapter.sol';
-import {ParaSwapWithdrawSwapAdapter} from 'aave-v3-periphery/contracts/adapters/paraswap/ParaSwapWithdrawSwapAdapter.sol';
-import {AaveParaSwapFeeClaimer} from 'aave-v3-periphery/contracts/adapters/paraswap/AaveParaSwapFeeClaimer.sol';
-import {IFeeClaimer} from 'aave-v3-periphery/contracts/adapters/paraswap/interfaces/IFeeClaimer.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
+import {ParaSwapLiquiditySwapAdapter, IParaSwapAugustusRegistry} from '../../../contracts/extensions/paraswap-adapters/ParaSwapLiquiditySwapAdapter.sol';
+import {ParaSwapRepayAdapter} from '../../../contracts/extensions/paraswap-adapters/ParaSwapRepayAdapter.sol';
+import {ParaSwapWithdrawSwapAdapter} from '../../../contracts/extensions/paraswap-adapters/ParaSwapWithdrawSwapAdapter.sol';
+import {AaveParaSwapFeeClaimer} from '../../../contracts/extensions/paraswap-adapters/AaveParaSwapFeeClaimer.sol';
+import {IFeeClaimer} from '../../../contracts/extensions/paraswap-adapters/interfaces/IFeeClaimer.sol';
+import {IPoolAddressesProvider} from '../../../contracts/interfaces/IPoolAddressesProvider.sol';
contract AaveV3ParaswapProcedure {
struct ParaswapAdapters {
diff --git a/src/deployments/contracts/procedures/AaveV3PoolConfigProcedure.sol b/src/deployments/contracts/procedures/AaveV3PoolConfigProcedure.sol
index fb968ec7..6f508ab8 100644
--- a/src/deployments/contracts/procedures/AaveV3PoolConfigProcedure.sol
+++ b/src/deployments/contracts/procedures/AaveV3PoolConfigProcedure.sol
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
-import {PoolConfiguratorInstance} from 'aave-v3-core/instances/PoolConfiguratorInstance.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
-import {IPool} from 'aave-v3-core/contracts/interfaces/IPool.sol';
-import {AaveOracle} from 'aave-v3-core/contracts/misc/AaveOracle.sol';
+import {PoolConfiguratorInstance} from '../../../contracts/instances/PoolConfiguratorInstance.sol';
+import {IPoolAddressesProvider} from '../../../contracts/interfaces/IPoolAddressesProvider.sol';
+import {IPool} from '../../../contracts/interfaces/IPool.sol';
+import {AaveOracle} from '../../../contracts/misc/AaveOracle.sol';
contract AaveV3PoolConfigProcedure {
function _deployPoolConfigurator(address poolAddressesProvider) internal returns (address) {
diff --git a/src/deployments/contracts/procedures/AaveV3PoolProcedure.sol b/src/deployments/contracts/procedures/AaveV3PoolProcedure.sol
index 0bf84a5d..cc3cc694 100644
--- a/src/deployments/contracts/procedures/AaveV3PoolProcedure.sol
+++ b/src/deployments/contracts/procedures/AaveV3PoolProcedure.sol
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
-import {PoolInstance} from 'aave-v3-core/instances/PoolInstance.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
-import {IPool} from 'aave-v3-core/contracts/interfaces/IPool.sol';
+import {PoolInstance} from '../../../contracts/instances/PoolInstance.sol';
+import {IPoolAddressesProvider} from '../../../contracts/interfaces/IPoolAddressesProvider.sol';
+import {IPool} from '../../../contracts/interfaces/IPool.sol';
import {AaveV3PoolConfigProcedure} from './AaveV3PoolConfigProcedure.sol';
import {IErrors} from '../../interfaces/IErrors.sol';
import '../../interfaces/IMarketReportTypes.sol';
diff --git a/src/deployments/contracts/procedures/AaveV3SetupProcedure.sol b/src/deployments/contracts/procedures/AaveV3SetupProcedure.sol
index 9852ea88..31d17b7e 100644
--- a/src/deployments/contracts/procedures/AaveV3SetupProcedure.sol
+++ b/src/deployments/contracts/procedures/AaveV3SetupProcedure.sol
@@ -3,13 +3,13 @@ pragma solidity ^0.8.0;
import '../../interfaces/IMarketReportTypes.sol';
import {IOwnable} from 'solidity-utils/contracts/transparent-proxy/interfaces/IOwnable.sol';
-import {ACLManager} from 'aave-v3-core/contracts/protocol/configuration/ACLManager.sol';
-import {IPoolConfigurator} from 'aave-v3-core/contracts/interfaces/IPoolConfigurator.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
-import {PoolAddressesProvider} from 'aave-v3-core/contracts/protocol/configuration/PoolAddressesProvider.sol';
-import {PoolAddressesProviderRegistry} from 'aave-v3-core/contracts/protocol/configuration/PoolAddressesProviderRegistry.sol';
-import {IEmissionManager} from 'aave-v3-periphery/contracts/rewards/interfaces/IEmissionManager.sol';
-import {IRewardsController} from 'aave-v3-periphery/contracts/rewards/interfaces/IRewardsController.sol';
+import {ACLManager} from '../../../contracts/protocol/configuration/ACLManager.sol';
+import {IPoolConfigurator} from '../../../contracts/interfaces/IPoolConfigurator.sol';
+import {IPoolAddressesProvider} from '../../../contracts/interfaces/IPoolAddressesProvider.sol';
+import {PoolAddressesProvider} from '../../../contracts/protocol/configuration/PoolAddressesProvider.sol';
+import {PoolAddressesProviderRegistry} from '../../../contracts/protocol/configuration/PoolAddressesProviderRegistry.sol';
+import {IEmissionManager} from '../../../contracts/rewards/interfaces/IEmissionManager.sol';
+import {IRewardsController} from '../../../contracts/rewards/interfaces/IRewardsController.sol';
contract AaveV3SetupProcedure {
struct AddressProviderInput {
diff --git a/src/deployments/contracts/procedures/AaveV3TokensProcedure.sol b/src/deployments/contracts/procedures/AaveV3TokensProcedure.sol
index 51668cf8..bb9cee8f 100644
--- a/src/deployments/contracts/procedures/AaveV3TokensProcedure.sol
+++ b/src/deployments/contracts/procedures/AaveV3TokensProcedure.sol
@@ -1,17 +1,15 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
-import {ATokenInstance} from 'aave-v3-core/instances/ATokenInstance.sol';
-import {VariableDebtTokenInstance} from 'aave-v3-core/instances/VariableDebtTokenInstance.sol';
-import {StableDebtTokenInstance} from 'aave-v3-core/instances/StableDebtTokenInstance.sol';
-import {IPool} from 'aave-v3-core/contracts/interfaces/IPool.sol';
-import {IAaveIncentivesController} from 'aave-v3-core/contracts/interfaces/IAaveIncentivesController.sol';
+import {ATokenInstance} from '../../../contracts/instances/ATokenInstance.sol';
+import {VariableDebtTokenInstance} from '../../../contracts/instances/VariableDebtTokenInstance.sol';
+import {IPool} from '../../../contracts/interfaces/IPool.sol';
+import {IAaveIncentivesController} from '../../../contracts/interfaces/IAaveIncentivesController.sol';
contract AaveV3TokensProcedure {
struct TokensReport {
address aToken;
address variableDebtToken;
- address stableDebtToken;
}
function _deployAaveV3TokensImplementations(
@@ -22,7 +20,6 @@ contract AaveV3TokensProcedure {
ATokenInstance aToken = new ATokenInstance(IPool(poolProxy));
VariableDebtTokenInstance variableDebtToken = new VariableDebtTokenInstance(IPool(poolProxy));
- StableDebtTokenInstance stableDebtToken = new StableDebtTokenInstance(IPool(poolProxy));
aToken.initialize(
IPool(poolProxy), // pool proxy
@@ -45,19 +42,8 @@ contract AaveV3TokensProcedure {
empty // params
);
- stableDebtToken.initialize(
- IPool(poolProxy), // initializingPool
- address(0), // underlyingAsset
- IAaveIncentivesController(address(0)), // incentivesController
- 0, // debtTokenDecimals
- 'STABLE_DEBT_TOKEN_IMPL', // debtTokenName
- 'STABLE_DEBT_TOKEN_IMPL', // debtTokenSymbol
- empty // params
- );
-
tokensReport.aToken = address(aToken);
tokensReport.variableDebtToken = address(variableDebtToken);
- tokensReport.stableDebtToken = address(stableDebtToken);
return tokensReport;
}
diff --git a/src/deployments/contracts/procedures/AaveV3TreasuryProcedure.sol b/src/deployments/contracts/procedures/AaveV3TreasuryProcedure.sol
index b6610345..f904f559 100644
--- a/src/deployments/contracts/procedures/AaveV3TreasuryProcedure.sol
+++ b/src/deployments/contracts/procedures/AaveV3TreasuryProcedure.sol
@@ -4,7 +4,7 @@ pragma solidity ^0.8.0;
import {ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/ProxyAdmin.sol';
import {TransparentUpgradeableProxy} from 'solidity-utils/contracts/transparent-proxy/TransparentUpgradeableProxy.sol';
import {IOwnable} from 'solidity-utils/contracts/transparent-proxy/interfaces/IOwnable.sol';
-import {Collector} from '../../../periphery/contracts/treasury/Collector.sol';
+import {Collector} from '../../../contracts/treasury/Collector.sol';
import '../../interfaces/IMarketReportTypes.sol';
contract AaveV3TreasuryProcedure {
diff --git a/src/deployments/contracts/utilities/MarketReportUtils.sol b/src/deployments/contracts/utilities/MarketReportUtils.sol
index 341a64c2..24edd37f 100644
--- a/src/deployments/contracts/utilities/MarketReportUtils.sol
+++ b/src/deployments/contracts/utilities/MarketReportUtils.sol
@@ -40,7 +40,6 @@ library MarketReportUtils {
l2Encoder: L2Encoder(report.l2Encoder),
aToken: IAToken(report.aToken),
variableDebtToken: IVariableDebtToken(report.variableDebtToken),
- stableDebtToken: IStableDebtToken(report.stableDebtToken),
emissionManager: IEmissionManager(report.emissionManager),
rewardsControllerImplementation: IRewardsController(report.rewardsControllerImplementation),
rewardsControllerProxy: IRewardsController(report.rewardsControllerProxy)
diff --git a/src/deployments/contracts/utilities/MetadataReporter.sol b/src/deployments/contracts/utilities/MetadataReporter.sol
index 59b5141c..60459a88 100644
--- a/src/deployments/contracts/utilities/MetadataReporter.sol
+++ b/src/deployments/contracts/utilities/MetadataReporter.sol
@@ -47,7 +47,6 @@ contract MetadataReporter is IMetadataReporter {
vm.serializeAddress(jsonReport, 'l2Encoder', report.l2Encoder);
vm.serializeAddress(jsonReport, 'aToken', report.aToken);
vm.serializeAddress(jsonReport, 'variableDebtToken', report.variableDebtToken);
- vm.serializeAddress(jsonReport, 'stableDebtToken', report.stableDebtToken);
vm.serializeAddress(jsonReport, 'emissionManager', report.emissionManager);
vm.serializeAddress(
jsonReport,
@@ -88,6 +87,7 @@ contract MetadataReporter is IMetadataReporter {
report.staticATokenImplementation
);
vm.serializeAddress(jsonReport, 'transparentProxyFactory', report.transparentProxyFactory);
+
string memory output = vm.serializeAddress(
jsonReport,
'paraSwapRepayAdapter',
diff --git a/src/deployments/interfaces/IMarketReportTypes.sol b/src/deployments/interfaces/IMarketReportTypes.sol
index 52f5e72c..3c861a6c 100644
--- a/src/deployments/interfaces/IMarketReportTypes.sol
+++ b/src/deployments/interfaces/IMarketReportTypes.sol
@@ -1,27 +1,27 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
-import 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
-import 'aave-v3-core/contracts/interfaces/IPoolAddressesProviderRegistry.sol';
-import 'aave-v3-core/contracts/interfaces/IPool.sol';
-import 'aave-v3-core/contracts/interfaces/IPoolConfigurator.sol';
-import 'aave-v3-core/contracts/interfaces/IAaveOracle.sol';
-import 'aave-v3-core/contracts/interfaces/IAToken.sol';
-import 'aave-v3-core/contracts/interfaces/IVariableDebtToken.sol';
-import 'aave-v3-core/contracts/interfaces/IStableDebtToken.sol';
-import 'aave-v3-core/contracts/interfaces/IACLManager.sol';
-import 'aave-v3-core/contracts/interfaces/IDefaultInterestRateStrategyV2.sol';
-import 'aave-v3-core/contracts/misc/AaveProtocolDataProvider.sol';
-import 'aave-v3-periphery/contracts/misc/UiPoolDataProviderV3.sol';
-import 'aave-v3-periphery/contracts/misc/UiIncentiveDataProviderV3.sol';
-import 'aave-v3-periphery/contracts/rewards/interfaces/IEmissionManager.sol';
-import 'aave-v3-periphery/contracts/rewards/interfaces/IRewardsController.sol';
-import 'aave-v3-periphery/contracts/misc/WalletBalanceProvider.sol';
-import 'aave-v3-periphery/contracts/adapters/paraswap/ParaSwapLiquiditySwapAdapter.sol';
-import 'aave-v3-periphery/contracts/adapters/paraswap/ParaSwapRepayAdapter.sol';
-import 'aave-v3-periphery/contracts/adapters/paraswap/ParaSwapWithdrawSwapAdapter.sol';
-import 'aave-v3-periphery/contracts/misc/interfaces/IWrappedTokenGatewayV3.sol';
-import 'aave-v3-core/contracts/misc/L2Encoder.sol';
-import {ICollector} from 'aave-v3-periphery/contracts/treasury/ICollector.sol';
+
+import '../../contracts/interfaces/IPoolAddressesProvider.sol';
+import '../../contracts/interfaces/IPoolAddressesProviderRegistry.sol';
+import '../../contracts/interfaces/IPool.sol';
+import '../../contracts/interfaces/IPoolConfigurator.sol';
+import '../../contracts/interfaces/IAaveOracle.sol';
+import '../../contracts/interfaces/IAToken.sol';
+import '../../contracts/interfaces/IVariableDebtToken.sol';
+import '../../contracts/interfaces/IACLManager.sol';
+import '../../contracts/interfaces/IDefaultInterestRateStrategyV2.sol';
+import '../../contracts/helpers/AaveProtocolDataProvider.sol';
+import '../../contracts/helpers/UiPoolDataProviderV3.sol';
+import '../../contracts/helpers/UiIncentiveDataProviderV3.sol';
+import '../../contracts/rewards/interfaces/IEmissionManager.sol';
+import '../../contracts/rewards/interfaces/IRewardsController.sol';
+import '../../contracts/helpers/WalletBalanceProvider.sol';
+import '../../contracts/extensions/paraswap-adapters/ParaSwapLiquiditySwapAdapter.sol';
+import '../../contracts/extensions/paraswap-adapters/ParaSwapRepayAdapter.sol';
+import '../../contracts/extensions/paraswap-adapters/ParaSwapWithdrawSwapAdapter.sol';
+import '../../contracts/helpers/interfaces/IWrappedTokenGatewayV3.sol';
+import '../../contracts/helpers/L2Encoder.sol';
+import {ICollector} from '../../contracts/treasury/ICollector.sol';
import {ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/ProxyAdmin.sol';
struct ContractsReport {
@@ -48,7 +48,6 @@ struct ContractsReport {
L2Encoder l2Encoder;
IAToken aToken;
IVariableDebtToken variableDebtToken;
- IStableDebtToken stableDebtToken;
IEmissionManager emissionManager;
IRewardsController rewardsControllerImplementation;
IRewardsController rewardsControllerProxy;
@@ -80,7 +79,6 @@ struct MarketReport {
address l2Encoder;
address aToken;
address variableDebtToken;
- address stableDebtToken;
address emissionManager;
address rewardsControllerImplementation;
address rewardsControllerProxy;
diff --git a/src/deployments/projects/aave-v3-batched/AaveV3BatchOrchestration.sol b/src/deployments/projects/aave-v3-batched/AaveV3BatchOrchestration.sol
index 02a0100f..11a2b4f6 100644
--- a/src/deployments/projects/aave-v3-batched/AaveV3BatchOrchestration.sol
+++ b/src/deployments/projects/aave-v3-batched/AaveV3BatchOrchestration.sol
@@ -183,8 +183,7 @@ library AaveV3BatchOrchestration {
setupReport.rewardsControllerProxy,
treasury,
tokensReport.aToken,
- tokensReport.variableDebtToken,
- tokensReport.stableDebtToken
+ tokensReport.variableDebtToken
);
return helpersBatchOne.getConfigEngineReport();
@@ -325,7 +324,6 @@ library AaveV3BatchOrchestration {
report.aclManager = setupReport.aclManager;
report.aToken = tokensReport.aToken;
report.variableDebtToken = tokensReport.variableDebtToken;
- report.stableDebtToken = tokensReport.stableDebtToken;
report.priceOracleSentinel = miscReport.priceOracleSentinel;
report.defaultInterestRateStrategy = miscReport.defaultInterestRateStrategy;
report.configEngine = configEngineReport.configEngine;
diff --git a/src/deployments/projects/aave-v3-batched/batches/AaveV3HelpersBatchOne.sol b/src/deployments/projects/aave-v3-batched/batches/AaveV3HelpersBatchOne.sol
index f841b657..421308a4 100644
--- a/src/deployments/projects/aave-v3-batched/batches/AaveV3HelpersBatchOne.sol
+++ b/src/deployments/projects/aave-v3-batched/batches/AaveV3HelpersBatchOne.sol
@@ -15,8 +15,7 @@ contract AaveV3HelpersBatchOne is AaveV3HelpersProcedureOne {
address rewardsController,
address collector,
address aTokenImpl,
- address vTokenImpl,
- address sTokenImpl
+ address vTokenImpl
) {
_report = _deployConfigEngine(
poolProxy,
@@ -26,8 +25,7 @@ contract AaveV3HelpersBatchOne is AaveV3HelpersProcedureOne {
rewardsController,
collector,
aTokenImpl,
- vTokenImpl,
- sTokenImpl
+ vTokenImpl
);
}
diff --git a/src/deployments/projects/aave-v3-batched/batches/AaveV3PeripheryBatch.sol b/src/deployments/projects/aave-v3-batched/batches/AaveV3PeripheryBatch.sol
index 1f3639ea..bf02940b 100644
--- a/src/deployments/projects/aave-v3-batched/batches/AaveV3PeripheryBatch.sol
+++ b/src/deployments/projects/aave-v3-batched/batches/AaveV3PeripheryBatch.sol
@@ -7,9 +7,9 @@ import {AaveV3IncentiveProcedure} from '../../../contracts/procedures/AaveV3Ince
import {AaveV3DefaultRateStrategyProcedure} from '../../../contracts/procedures/AaveV3DefaultRateStrategyProcedure.sol';
import {IOwnable} from 'solidity-utils/contracts/transparent-proxy/interfaces/IOwnable.sol';
import '../../../interfaces/IMarketReportTypes.sol';
-import {IRewardsController} from '../../../../periphery/contracts/rewards/interfaces/IRewardsController.sol';
+import {IRewardsController} from '../../../../contracts/rewards/interfaces/IRewardsController.sol';
import {IOwnable} from 'solidity-utils/contracts/transparent-proxy/interfaces/IOwnable.sol';
-import {RevenueSplitter} from '../../../../periphery/contracts/treasury/RevenueSplitter.sol';
+import {RevenueSplitter} from '../../../../contracts/treasury/RevenueSplitter.sol';
contract AaveV3PeripheryBatch is
AaveV3TreasuryProcedure,
diff --git a/src/deployments/projects/aave-v3-batched/batches/AaveV3SetupBatch.sol b/src/deployments/projects/aave-v3-batched/batches/AaveV3SetupBatch.sol
index 07b08b1d..abed9a61 100644
--- a/src/deployments/projects/aave-v3-batched/batches/AaveV3SetupBatch.sol
+++ b/src/deployments/projects/aave-v3-batched/batches/AaveV3SetupBatch.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
-import {Ownable} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/Ownable.sol';
+import {Ownable} from '../../../../contracts/dependencies/openzeppelin/contracts/Ownable.sol';
import {AaveV3SetupProcedure} from '../../../contracts/procedures/AaveV3SetupProcedure.sol';
import '../../../contracts/MarketReportStorage.sol';
diff --git a/src/deployments/projects/aave-v3-libraries/AaveV3LibrariesBatch1.sol b/src/deployments/projects/aave-v3-libraries/AaveV3LibrariesBatch1.sol
index 1eb97e86..5c292cee 100644
--- a/src/deployments/projects/aave-v3-libraries/AaveV3LibrariesBatch1.sol
+++ b/src/deployments/projects/aave-v3-libraries/AaveV3LibrariesBatch1.sol
@@ -3,10 +3,10 @@ pragma solidity ^0.8.0;
import '../../contracts/LibraryReportStorage.sol';
import {Create2Utils} from '../../contracts/utilities/Create2Utils.sol';
-import {BorrowLogic} from 'aave-v3-core/contracts/protocol/libraries/logic/BorrowLogic.sol';
-import {BridgeLogic} from 'aave-v3-core/contracts/protocol/libraries/logic/BridgeLogic.sol';
-import {ConfiguratorLogic} from 'aave-v3-core/contracts/protocol/libraries/logic/ConfiguratorLogic.sol';
-import {EModeLogic} from 'aave-v3-core/contracts/protocol/libraries/logic/EModeLogic.sol';
+import {BorrowLogic} from '../../../contracts/protocol/libraries/logic/BorrowLogic.sol';
+import {BridgeLogic} from '../../../contracts/protocol/libraries/logic/BridgeLogic.sol';
+import {ConfiguratorLogic} from '../../../contracts/protocol/libraries/logic/ConfiguratorLogic.sol';
+import {EModeLogic} from '../../../contracts/protocol/libraries/logic/EModeLogic.sol';
contract AaveV3LibrariesBatch1 is LibraryReportStorage {
constructor() {
diff --git a/src/deployments/projects/aave-v3-libraries/AaveV3LibrariesBatch2.sol b/src/deployments/projects/aave-v3-libraries/AaveV3LibrariesBatch2.sol
index ac1b3ce6..d65db0ac 100644
--- a/src/deployments/projects/aave-v3-libraries/AaveV3LibrariesBatch2.sol
+++ b/src/deployments/projects/aave-v3-libraries/AaveV3LibrariesBatch2.sol
@@ -4,10 +4,10 @@ pragma solidity ^0.8.0;
import '../../contracts/LibraryReportStorage.sol';
import {Create2Utils} from '../../contracts/utilities/Create2Utils.sol';
-import {FlashLoanLogic} from 'aave-v3-core/contracts/protocol/libraries/logic/FlashLoanLogic.sol';
-import {LiquidationLogic} from 'aave-v3-core/contracts/protocol/libraries/logic/LiquidationLogic.sol';
-import {PoolLogic} from 'aave-v3-core/contracts/protocol/libraries/logic/PoolLogic.sol';
-import {SupplyLogic} from 'aave-v3-core/contracts/protocol/libraries/logic/SupplyLogic.sol';
+import {FlashLoanLogic} from '../../../contracts/protocol/libraries/logic/FlashLoanLogic.sol';
+import {LiquidationLogic} from '../../../contracts/protocol/libraries/logic/LiquidationLogic.sol';
+import {PoolLogic} from '../../../contracts/protocol/libraries/logic/PoolLogic.sol';
+import {SupplyLogic} from '../../../contracts/protocol/libraries/logic/SupplyLogic.sol';
contract AaveV3LibrariesBatch2 is LibraryReportStorage {
constructor() {
diff --git a/src/periphery/contracts/libraries/DataTypesHelper.sol b/src/periphery/contracts/libraries/DataTypesHelper.sol
deleted file mode 100644
index 492678a5..00000000
--- a/src/periphery/contracts/libraries/DataTypesHelper.sol
+++ /dev/null
@@ -1,29 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.10;
-
-import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
-import {DataTypes} from 'aave-v3-core/contracts/protocol/libraries/types/DataTypes.sol';
-
-/**
- * @title DataTypesHelper
- * @author Aave
- * @dev Helper library to track user current debt balance, used by WrappedTokenGatewayV3
- */
-library DataTypesHelper {
- /**
- * @notice Fetches the user current stable and variable debt balances
- * @param user The user address
- * @param reserve The reserve data object
- * @return The stable debt balance
- * @return The variable debt balance
- **/
- function getUserCurrentDebt(
- address user,
- DataTypes.ReserveDataLegacy memory reserve
- ) internal view returns (uint256, uint256) {
- return (
- IERC20(reserve.stableDebtTokenAddress).balanceOf(user),
- IERC20(reserve.variableDebtTokenAddress).balanceOf(user)
- );
- }
-}
diff --git a/src/periphery/contracts/misc/interfaces/IWETH.sol b/src/periphery/contracts/misc/interfaces/IWETH.sol
deleted file mode 100644
index a46ede7f..00000000
--- a/src/periphery/contracts/misc/interfaces/IWETH.sol
+++ /dev/null
@@ -1,12 +0,0 @@
-// SPDX-License-Identifier: MIT
-pragma solidity ^0.8.10;
-
-interface IWETH {
- function deposit() external payable;
-
- function withdraw(uint256) external;
-
- function approve(address guy, uint256 wad) external returns (bool);
-
- function transferFrom(address src, address dst, uint256 wad) external returns (bool);
-}
diff --git a/tests/core/PoolConfigurator.eMode.sol b/tests/core/PoolConfigurator.eMode.sol
deleted file mode 100644
index 6f19d5c0..00000000
--- a/tests/core/PoolConfigurator.eMode.sol
+++ /dev/null
@@ -1,362 +0,0 @@
-// SPDX-License-Identifier: BUSL-1.1
-pragma solidity ^0.8.0;
-
-import 'forge-std/Test.sol';
-
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
-import {PercentageMath} from 'aave-v3-core/contracts/protocol/libraries/math/PercentageMath.sol';
-import {ReserveConfiguration, DataTypes} from 'aave-v3-core/contracts/protocol/pool/PoolConfigurator.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
-
-contract PoolConfiguratorEModeConfigTests is TestnetProcedures {
- using PercentageMath for uint256;
- using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
-
- event EModeCategoryAdded(
- uint8 indexed categoryId,
- uint256 ltv,
- uint256 liquidationThreshold,
- uint256 liquidationBonus,
- address oracle,
- string label
- );
-
- event EModeAssetCategoryChanged(address indexed asset, uint8 oldCategoryId, uint8 newCategoryId);
-
- function setUp() public {
- initTestEnvironment();
- }
-
- function test_configureEmodeCategory() public {
- EModeCategoryInput memory ct = _genCategoryOne();
- vm.expectEmit(address(contracts.poolConfiguratorProxy));
- emit EModeCategoryAdded(ct.id, ct.ltv, ct.lt, ct.lb, ct.oracle, ct.label);
-
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setEModeCategory(
- ct.id,
- ct.ltv,
- ct.lt,
- ct.lb,
- ct.oracle,
- ct.label
- );
-
- DataTypes.EModeCategory memory emodeConfig = contracts.poolProxy.getEModeCategoryData(ct.id);
- assertEq(emodeConfig.ltv, ct.ltv);
- assertEq(emodeConfig.liquidationThreshold, ct.lt);
- assertEq(emodeConfig.liquidationBonus, ct.lb);
- assertEq(emodeConfig.priceSource, ct.oracle);
- assertEq(emodeConfig.label, ct.label);
- }
-
- function test_reverts_configureEmodeCategory_bad_ltv() public {
- DataTypes.ReserveConfigurationMap memory currentConfig = contracts.poolProxy.getConfiguration(
- tokenList.wbtc
- );
-
- EModeCategoryInput memory ct = _genCategoryOne();
-
- vm.startPrank(poolAdmin);
- contracts.poolConfiguratorProxy.setEModeCategory(
- ct.id,
- ct.ltv,
- ct.lt,
- ct.lb,
- ct.oracle,
- ct.label
- );
- contracts.poolConfiguratorProxy.setAssetEModeCategory(tokenList.wbtc, ct.id);
-
- vm.expectRevert(bytes(Errors.INVALID_EMODE_CATEGORY_PARAMS));
-
- contracts.poolConfiguratorProxy.setEModeCategory(
- ct.id,
- uint16(currentConfig.getLtv() - 1),
- uint16(currentConfig.getLiquidationThreshold() + 1),
- ct.lb,
- ct.oracle,
- ct.label
- );
- vm.stopPrank();
- }
-
- function test_reverts_configureEmodeCategory_bad_lq() public {
- DataTypes.ReserveConfigurationMap memory currentConfig = contracts.poolProxy.getConfiguration(
- tokenList.wbtc
- );
-
- EModeCategoryInput memory ct = _genCategoryOne();
-
- vm.startPrank(poolAdmin);
- contracts.poolConfiguratorProxy.setEModeCategory(
- ct.id,
- ct.ltv,
- ct.lt,
- ct.lb,
- ct.oracle,
- ct.label
- );
- contracts.poolConfiguratorProxy.setAssetEModeCategory(tokenList.wbtc, ct.id);
-
- vm.expectRevert(bytes(Errors.INVALID_EMODE_CATEGORY_PARAMS));
-
- contracts.poolConfiguratorProxy.setEModeCategory(
- ct.id,
- uint16(currentConfig.getLtv() + 1),
- uint16(currentConfig.getLiquidationThreshold() - 1),
- ct.lb,
- ct.oracle,
- ct.label
- );
- vm.stopPrank();
- }
-
- function test_updateEModeCategory() public {
- EModeCategoryInput memory ogCategory = _genCategoryOne();
- EModeCategoryInput memory updatedCategory = EModeCategoryInput(
- ogCategory.id,
- 90_00,
- 92_00,
- 101_00,
- makeAddr('EMODE_ORACLE'),
- 'GROUP_B'
- );
-
- test_configureEmodeCategory();
-
- vm.prank(poolAdmin);
- vm.expectEmit(address(contracts.poolConfiguratorProxy));
- emit EModeCategoryAdded(
- ogCategory.id,
- updatedCategory.ltv,
- updatedCategory.lt,
- updatedCategory.lb,
- updatedCategory.oracle,
- updatedCategory.label
- );
-
- contracts.poolConfiguratorProxy.setEModeCategory(
- ogCategory.id,
- updatedCategory.ltv,
- updatedCategory.lt,
- updatedCategory.lb,
- updatedCategory.oracle,
- updatedCategory.label
- );
-
- DataTypes.EModeCategory memory emodeConfig = contracts.poolProxy.getEModeCategoryData(
- ogCategory.id
- );
- assertEq(emodeConfig.ltv, updatedCategory.ltv);
- assertEq(emodeConfig.liquidationThreshold, updatedCategory.lt);
- assertEq(emodeConfig.liquidationBonus, updatedCategory.lb);
- assertEq(emodeConfig.priceSource, updatedCategory.oracle);
- assertEq(emodeConfig.label, updatedCategory.label);
- }
-
- function test_reverts_setEmodeCategory_zero_ltv() public {
- vm.expectRevert(bytes(Errors.INVALID_EMODE_CATEGORY_PARAMS));
-
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setEModeCategory(1, 0, 80_00, 105_00, address(0), 'LABEL');
- }
-
- function test_reverts_setEmodeCategory_zero_liqThreshold() public {
- vm.expectRevert(bytes(Errors.INVALID_EMODE_CATEGORY_PARAMS));
-
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setEModeCategory(1, 80_00, 0, 105_00, address(0), 'LABEL');
- }
-
- function test_reverts_setEmodeCategory_ltv_gt_liqThreshold() public {
- vm.expectRevert(bytes(Errors.INVALID_EMODE_CATEGORY_PARAMS));
-
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setEModeCategory(1, 80_00, 79_00, 105_00, address(0), 'LABEL');
- }
-
- function test_reverts_setEmodeCategory_lb_lte_percentageFactor() public {
- vm.expectRevert(bytes(Errors.INVALID_EMODE_CATEGORY_PARAMS));
-
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setEModeCategory(1, 80_00, 81_00, 100_00, address(0), 'LABEL');
-
- vm.expectRevert(bytes(Errors.INVALID_EMODE_CATEGORY_PARAMS));
-
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setEModeCategory(1, 80_00, 81_00, 99_00, address(0), 'LABEL');
- }
-
- function test_reverts_setEmodeCategory_liquidation_threshold_doesnt_match_bonus() public {
- uint16 liquidationThreshold = 98_00;
- uint16 liquidationBonus = 120_00;
- uint256 isBonusNotCovered = uint256(liquidationThreshold).percentMul(liquidationBonus);
- assertGt(
- isBonusNotCovered,
- PercentageMath.PERCENTAGE_FACTOR,
- 'Input should be gt than percentage factor to revert at "threshold * bonus is required to be less than PERCENTAGE_FACTOR"'
- );
- vm.expectRevert(bytes(Errors.INVALID_EMODE_CATEGORY_PARAMS));
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setEModeCategory(
- 1,
- 90_00,
- liquidationThreshold,
- liquidationBonus,
- address(0),
- 'LABEL'
- );
- }
-
- function test_reverts_configureEmodeCategory_input_ltv_lt_reserve_emode_ltv() public {
- EModeCategoryInput memory ct = _genCategoryOne();
- vm.startPrank(poolAdmin);
-
- contracts.poolConfiguratorProxy.setEModeCategory(
- ct.id,
- ct.ltv,
- ct.lt,
- ct.lb,
- ct.oracle,
- ct.label
- );
- contracts.poolConfiguratorProxy.setAssetEModeCategory(tokenList.usdx, ct.id);
-
- (, uint256 ltv, , , , , , , , ) = contracts.protocolDataProvider.getReserveConfigurationData(
- tokenList.usdx
- );
-
- vm.expectRevert(bytes(Errors.INVALID_EMODE_CATEGORY_PARAMS));
- contracts.poolConfiguratorProxy.setEModeCategory(
- ct.id,
- uint16(ltv) - 1,
- ct.lt,
- ct.lb,
- ct.oracle,
- ct.label
- );
- vm.stopPrank();
- }
-
- function test_reverts_configureEmodeCategory_input_ltv_lt_reserve_emode_pendingLtv() public {
- EModeCategoryInput memory ct = _genCategoryOne();
- vm.startPrank(poolAdmin);
-
- contracts.poolConfiguratorProxy.setEModeCategory(
- ct.id,
- ct.ltv,
- ct.lt,
- ct.lb,
- ct.oracle,
- ct.label
- );
- contracts.poolConfiguratorProxy.setAssetEModeCategory(tokenList.usdx, ct.id);
-
- (, uint256 ltv, , , , , , , , ) = contracts.protocolDataProvider.getReserveConfigurationData(
- tokenList.usdx
- );
-
- // freeze asset
- contracts.poolConfiguratorProxy.setReserveFreeze(tokenList.usdx, true);
-
- vm.expectRevert(bytes(Errors.INVALID_EMODE_CATEGORY_PARAMS));
- contracts.poolConfiguratorProxy.setEModeCategory(
- ct.id,
- uint16(ltv) - 1,
- ct.lt,
- ct.lb,
- ct.oracle,
- ct.label
- );
- vm.stopPrank();
- }
-
- function test_reverts_configureEmodeCategory_input_lt_lt_reserve_emode_lt() public {
- EModeCategoryInput memory ct = _genCategoryOne();
- vm.startPrank(poolAdmin);
- contracts.poolConfiguratorProxy.setEModeCategory(
- ct.id,
- ct.ltv,
- ct.lt,
- ct.lb,
- ct.oracle,
- ct.label
- );
- contracts.poolConfiguratorProxy.setAssetEModeCategory(tokenList.usdx, ct.id);
-
- (, , uint256 lt, , , , , , , ) = contracts.protocolDataProvider.getReserveConfigurationData(
- tokenList.usdx
- );
-
- vm.expectRevert(bytes(Errors.INVALID_EMODE_CATEGORY_PARAMS));
- contracts.poolConfiguratorProxy.setEModeCategory(
- ct.id,
- ct.ltv,
- uint16(lt) - 1,
- ct.lb,
- ct.oracle,
- ct.label
- );
- vm.stopPrank();
- }
-
- function test_setAssetEModeCategory() public {
- EModeCategoryInput memory input = _genCategoryOne();
- test_configureEmodeCategory();
- vm.expectEmit(address(contracts.poolConfiguratorProxy));
- emit EModeAssetCategoryChanged(tokenList.usdx, 0, input.id);
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setAssetEModeCategory(tokenList.usdx, input.id);
- }
-
- function test_updateAssetEModeCategory() public {
- EModeCategoryInput memory prevCt = _genCategoryOne();
- EModeCategoryInput memory ct = _genCategoryTwo();
- test_setAssetEModeCategory();
-
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setEModeCategory(
- ct.id,
- ct.ltv,
- ct.lt,
- ct.lb,
- ct.oracle,
- ct.label
- );
-
- vm.expectEmit(address(contracts.poolConfiguratorProxy));
- emit EModeAssetCategoryChanged(tokenList.usdx, prevCt.id, ct.id);
-
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setAssetEModeCategory(tokenList.usdx, ct.id);
- }
-
- function test_removeEModeCategoryFromAsset() public {
- EModeCategoryInput memory prevCt = _genCategoryOne();
- test_setAssetEModeCategory();
- vm.expectEmit(address(contracts.poolConfiguratorProxy));
- emit EModeAssetCategoryChanged(tokenList.usdx, prevCt.id, 0);
-
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setAssetEModeCategory(tokenList.usdx, 0);
- }
-
- function test_reverts_setAssetEModeCategory_invalid() public {
- EModeCategoryInput memory ct = _genCategoryOne();
-
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setEModeCategory(
- ct.id,
- 50_00,
- 51_00,
- ct.lb,
- ct.oracle,
- ct.label
- );
-
- vm.expectRevert(bytes(Errors.INVALID_EMODE_CATEGORY_ASSIGNMENT));
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setAssetEModeCategory(tokenList.usdx, ct.id);
- }
-}
diff --git a/tests/core/PoolConfigurator.initReserves.t.sol b/tests/core/PoolConfigurator.initReserves.t.sol
deleted file mode 100644
index d59ce527..00000000
--- a/tests/core/PoolConfigurator.initReserves.t.sol
+++ /dev/null
@@ -1,306 +0,0 @@
-// SPDX-License-Identifier: BUSL-1.1
-pragma solidity ^0.8.0;
-
-import 'forge-std/Test.sol';
-
-import {AToken} from 'aave-v3-core/contracts/protocol/tokenization/AToken.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
-import {TestnetERC20} from 'aave-v3-periphery/contracts/mocks/testnet-helpers/TestnetERC20.sol';
-import {ConfiguratorInputTypes} from 'aave-v3-core/contracts/protocol/pool/PoolConfigurator.sol';
-import {IDefaultInterestRateStrategyV2} from 'aave-v3-core/contracts/protocol/pool/DefaultReserveInterestRateStrategyV2.sol';
-import {TestnetProcedures, TestVars, TestReserveConfig} from '../utils/TestnetProcedures.sol';
-
-contract PoolConfiguratorInitReservesTest is TestnetProcedures {
- event ReserveInitialized(
- address indexed asset,
- address indexed aToken,
- address stableDebtToken,
- address variableDebtToken,
- address interestRateStrategyAddress
- );
-
- function setUp() public {
- initTestEnvironment();
- }
-
- function test_initReserves_singleAsset(bool isVirtualAccActive) public {
- TestnetERC20 newToken = new TestnetERC20('Misc Token', 'MISC', 18, poolAdmin);
-
- TestVars memory t;
- t.aTokenName = 'Misc AToken';
- t.aTokenSymbol = 'aMISC';
- t.variableDebtName = 'Variable Debt Misc';
- t.variableDebtSymbol = 'varDebtMISC';
- t.stableDebtName = 'Stable Debt Misc';
- t.stableDebtSymbol = 'stableDebtMISC';
- t.rateStrategy = report.defaultInterestRateStrategy;
- t.interestRateData = abi.encode(
- IDefaultInterestRateStrategyV2.InterestRateData({
- optimalUsageRatio: 80_00,
- baseVariableBorrowRate: 1_00,
- variableRateSlope1: 4_00,
- variableRateSlope2: 60_00
- })
- );
- uint256 previousListedAssets = contracts.poolProxy.getReservesList().length;
-
- ConfiguratorInputTypes.InitReserveInput[]
- memory input = new ConfiguratorInputTypes.InitReserveInput[](1);
-
- input[0] = ConfiguratorInputTypes.InitReserveInput(
- report.aToken,
- report.stableDebtToken,
- report.variableDebtToken,
- isVirtualAccActive,
- t.rateStrategy,
- address(newToken),
- report.treasury,
- report.rewardsControllerProxy,
- t.aTokenName,
- t.aTokenSymbol,
- t.variableDebtName,
- t.variableDebtSymbol,
- t.stableDebtName,
- t.stableDebtSymbol,
- t.emptyParams,
- t.interestRateData
- );
- vm.expectEmit(true, false, false, false, address(contracts.poolConfiguratorProxy));
- emit ReserveInitialized(
- input[0].underlyingAsset,
- address(0),
- address(0),
- address(0),
- input[0].interestRateStrategyAddress
- );
-
- // Perform action
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.initReserves(input);
-
- // Perform assertions
- {
- (address aTokenProxy, address stableDebtProxy, address variableDebtProxy) = contracts
- .protocolDataProvider
- .getReserveTokensAddresses(address(newToken));
-
- assertEq(AToken(aTokenProxy).name(), t.aTokenName);
- assertEq(AToken(aTokenProxy).symbol(), t.aTokenSymbol);
- assertEq(AToken(aTokenProxy).decimals(), newToken.decimals());
- assertEq(AToken(aTokenProxy).RESERVE_TREASURY_ADDRESS(), report.treasury);
- assertEq(AToken(aTokenProxy).UNDERLYING_ASSET_ADDRESS(), address(newToken));
- assertEq(
- address(AToken(aTokenProxy).getIncentivesController()),
- report.rewardsControllerProxy
- );
-
- assertEq(AToken(stableDebtProxy).name(), t.stableDebtName);
- assertEq(AToken(stableDebtProxy).symbol(), t.stableDebtSymbol);
- assertEq(AToken(stableDebtProxy).decimals(), newToken.decimals());
- assertEq(AToken(stableDebtProxy).UNDERLYING_ASSET_ADDRESS(), address(newToken));
- assertEq(
- address(AToken(stableDebtProxy).getIncentivesController()),
- report.rewardsControllerProxy
- );
-
- assertEq(AToken(variableDebtProxy).name(), t.variableDebtName);
- assertEq(AToken(variableDebtProxy).symbol(), t.variableDebtSymbol);
- assertEq(AToken(variableDebtProxy).decimals(), newToken.decimals());
- assertEq(AToken(variableDebtProxy).UNDERLYING_ASSET_ADDRESS(), address(newToken));
- assertEq(
- address(AToken(variableDebtProxy).getIncentivesController()),
- report.rewardsControllerProxy
- );
- }
- // Perform default asset checks
- TestReserveConfig memory c = _getReserveConfig(address(newToken), report.protocolDataProvider);
-
- assertEq(c.isActive, true);
- assertEq(c.isFrozen, false);
- assertEq(c.isPaused, false);
- assertEq(c.decimals, newToken.decimals());
-
- assertEq(c.ltv, 0);
- assertEq(c.liquidationThreshold, 0);
- assertEq(c.liquidationBonus, 0);
- assertEq(c.reserveFactor, 0);
- assertEq(c.usageAsCollateralEnabled, false);
- assertEq(c.borrowingEnabled, false);
- assertEq(c.stableBorrowRateEnabled, false);
- assertEq(c.isVirtualAccActive, isVirtualAccActive);
-
- assertEq(contracts.poolProxy.getReservesList().length, previousListedAssets + 1);
- }
-
- function test_initReserves_multipleAssets() public {
- ConfiguratorInputTypes.InitReserveInput[] memory input = _generateListingInput(
- 4,
- report,
- poolAdmin
- );
- uint256 previousListedAssets = contracts.poolProxy.getReservesList().length;
-
- for (uint256 y; y < input.length; ++y) {
- vm.expectEmit(true, false, false, false, address(contracts.poolConfiguratorProxy));
- emit ReserveInitialized(
- input[y].underlyingAsset,
- address(0),
- address(0),
- address(0),
- input[y].interestRateStrategyAddress
- );
- }
-
- // Perform action
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.initReserves(input);
-
- // Perform assertions
- for (uint256 y; y < input.length; ++y) {
- ConfiguratorInputTypes.InitReserveInput memory reserveInput = input[y];
-
- {
- (address aTokenProxy, address stableDebtProxy, address variableDebtProxy) = contracts
- .protocolDataProvider
- .getReserveTokensAddresses(reserveInput.underlyingAsset);
-
- assertEq(AToken(aTokenProxy).name(), reserveInput.aTokenName);
- assertEq(AToken(aTokenProxy).symbol(), reserveInput.aTokenSymbol);
- assertEq(
- AToken(aTokenProxy).decimals(),
- TestnetERC20(reserveInput.underlyingAsset).decimals()
- );
- assertEq(AToken(aTokenProxy).RESERVE_TREASURY_ADDRESS(), reserveInput.treasury);
- assertEq(AToken(aTokenProxy).UNDERLYING_ASSET_ADDRESS(), reserveInput.underlyingAsset);
- assertEq(
- address(AToken(aTokenProxy).getIncentivesController()),
- reserveInput.incentivesController
- );
-
- assertEq(AToken(stableDebtProxy).name(), reserveInput.stableDebtTokenName);
- assertEq(AToken(stableDebtProxy).symbol(), reserveInput.stableDebtTokenSymbol);
- assertEq(
- AToken(stableDebtProxy).decimals(),
- TestnetERC20(reserveInput.underlyingAsset).decimals()
- );
- assertEq(AToken(stableDebtProxy).UNDERLYING_ASSET_ADDRESS(), reserveInput.underlyingAsset);
- assertEq(
- address(AToken(stableDebtProxy).getIncentivesController()),
- reserveInput.incentivesController
- );
-
- assertEq(AToken(variableDebtProxy).name(), reserveInput.variableDebtTokenName);
- assertEq(AToken(variableDebtProxy).symbol(), reserveInput.variableDebtTokenSymbol);
- assertEq(
- AToken(variableDebtProxy).decimals(),
- TestnetERC20(reserveInput.underlyingAsset).decimals()
- );
- assertEq(
- AToken(variableDebtProxy).UNDERLYING_ASSET_ADDRESS(),
- reserveInput.underlyingAsset
- );
- assertEq(
- address(AToken(variableDebtProxy).getIncentivesController()),
- reserveInput.incentivesController
- );
- }
- // Perform default asset checks
- TestReserveConfig memory c = _getReserveConfig(
- reserveInput.underlyingAsset,
- report.protocolDataProvider
- );
-
- assertEq(c.isActive, true);
- assertEq(c.isFrozen, false);
- assertEq(c.isPaused, false);
- assertEq(c.decimals, TestnetERC20(reserveInput.underlyingAsset).decimals());
-
- assertEq(c.ltv, 0);
- assertEq(c.liquidationThreshold, 0);
- assertEq(c.liquidationBonus, 0);
- assertEq(c.reserveFactor, 0);
- assertEq(c.usageAsCollateralEnabled, false);
- assertEq(c.borrowingEnabled, false);
- assertEq(c.stableBorrowRateEnabled, false);
- }
- assertEq(contracts.poolProxy.getReservesList().length, previousListedAssets + input.length);
- }
-
- function test_initReserves_zeroAssets() public {
- uint256 previousListedAssets = contracts.poolProxy.getReservesList().length;
-
- ConfiguratorInputTypes.InitReserveInput[] memory input;
-
- // Perform action, does not revert but does nothing due empty array, no-op
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.initReserves(input);
-
- assertEq(contracts.poolProxy.getReservesList().length, previousListedAssets);
- }
-
- function test_reverts_initReserves_maxAssets() public {
- uint256 previousListedAssets = contracts.poolProxy.getReservesList().length;
- uint256 maxListings = contracts.poolProxy.MAX_NUMBER_RESERVES() - previousListedAssets + 1;
- ConfiguratorInputTypes.InitReserveInput[] memory input = _generateListingInput(
- maxListings,
- report,
- poolAdmin
- );
-
- vm.expectRevert(bytes(Errors.NO_MORE_RESERVES_ALLOWED));
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.initReserves(input);
-
- assertEq(contracts.poolProxy.getReservesList().length, previousListedAssets);
- }
-
- function test_initReserves_notEnoughDecimal(uint8 decimals) public {
- vm.assume(decimals < 6);
- TestnetERC20 newToken = new TestnetERC20('Misc Token', 'MISC', decimals, poolAdmin);
-
- TestVars memory t;
- t.aTokenName = 'Misc AToken';
- t.aTokenSymbol = 'aMISC';
- t.variableDebtName = 'Variable Debt Misc';
- t.variableDebtSymbol = 'varDebtMISC';
- t.stableDebtName = 'Stable Debt Misc';
- t.stableDebtSymbol = 'stableDebtMISC';
- t.rateStrategy = report.defaultInterestRateStrategy;
- t.interestRateData = abi.encode(
- IDefaultInterestRateStrategyV2.InterestRateData({
- optimalUsageRatio: 80_00,
- baseVariableBorrowRate: 1_00,
- variableRateSlope1: 4_00,
- variableRateSlope2: 60_00
- })
- );
-
- ConfiguratorInputTypes.InitReserveInput[]
- memory input = new ConfiguratorInputTypes.InitReserveInput[](1);
-
- input[0] = ConfiguratorInputTypes.InitReserveInput(
- report.aToken,
- report.stableDebtToken,
- report.variableDebtToken,
- true,
- t.rateStrategy,
- address(newToken),
- report.treasury,
- report.rewardsControllerProxy,
- t.aTokenName,
- t.aTokenSymbol,
- t.variableDebtName,
- t.variableDebtSymbol,
- t.stableDebtName,
- t.stableDebtSymbol,
- t.emptyParams,
- t.interestRateData
- );
-
- vm.expectRevert(bytes(Errors.INVALID_DECIMALS));
-
- // Perform action
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.initReserves(input);
- }
-}
diff --git a/tests/core/RateStrategy.t.sol b/tests/core/RateStrategy.t.sol
deleted file mode 100644
index dd7cf3a8..00000000
--- a/tests/core/RateStrategy.t.sol
+++ /dev/null
@@ -1,1225 +0,0 @@
-// SPDX-License-Identifier: BUSL-1.1
-pragma solidity ^0.8.0;
-
-import 'forge-std/Test.sol';
-
-import {DataTypes} from 'aave-v3-core/contracts/protocol/libraries/types/DataTypes.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
-import {WadRayMath} from 'aave-v3-core/contracts/protocol/libraries/math/WadRayMath.sol';
-import {DefaultReserveInterestRateStrategyV2, IDefaultInterestRateStrategyV2, PercentageMath, IPoolAddressesProvider} from 'aave-v3-core/contracts/protocol/pool/DefaultReserveInterestRateStrategyV2.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
-
-contract RateStrategyTests is TestnetProcedures {
- using WadRayMath for uint256;
- using PercentageMath for uint256;
-
- struct Params {
- uint256 currentLiquidityRate;
- uint256 currentStableBorrowRate;
- uint256 currentVariableBorrowRate;
- }
-
- uint256 public reserveFactor;
- address public aToken;
- DefaultReserveInterestRateStrategyV2 public rateStrategy;
- Params public params;
- uint256 public borrowUsageRatio;
-
- event RateDataUpdate(
- address indexed reserve,
- uint256 optimalUsageRatio,
- uint256 baseVariableBorrowRate,
- uint256 variableRateSlope1,
- uint256 variableRateSlope2
- );
-
- // sets limits for the fuzzing parameters and sets them on the interest rate strategy
- modifier setRateParams(
- uint16 optimalUsageRatio,
- uint32 baseVariableBorrowRate,
- uint32 variableRateSlope1,
- uint32 variableRateSlope2,
- address token
- ) {
- _setRateParams(
- optimalUsageRatio,
- baseVariableBorrowRate,
- variableRateSlope1,
- variableRateSlope2,
- token
- );
- _;
- }
-
- function _setRateParams(
- uint16 optimalUsageRatio,
- uint32 baseVariableBorrowRate,
- uint32 variableRateSlope1,
- uint32 variableRateSlope2,
- address token
- ) internal {
- vm.assume(
- optimalUsageRatio >= rateStrategy.MIN_OPTIMAL_POINT() &&
- optimalUsageRatio <= rateStrategy.MAX_OPTIMAL_POINT()
- );
-
- vm.assume(variableRateSlope1 < variableRateSlope2);
- vm.assume(
- uint256(baseVariableBorrowRate) + uint256(variableRateSlope1) + uint256(variableRateSlope2) <=
- rateStrategy.MAX_BORROW_RATE()
- );
- IDefaultInterestRateStrategyV2.InterestRateData memory rateData = IDefaultInterestRateStrategyV2
- .InterestRateData({
- optimalUsageRatio: optimalUsageRatio,
- baseVariableBorrowRate: baseVariableBorrowRate,
- variableRateSlope1: variableRateSlope1,
- variableRateSlope2: variableRateSlope2
- });
-
- vm.prank(report.poolConfiguratorProxy);
- rateStrategy.setInterestRateParams(token, abi.encode(rateData));
- }
-
- function setUp() public {
- initTestEnvironment();
-
- (aToken, , ) = contracts.protocolDataProvider.getReserveTokensAddresses(tokenList.usdx);
- rateStrategy = new DefaultReserveInterestRateStrategyV2(report.poolAddressesProvider);
- (, , , , reserveFactor, , , , , ) = contracts.protocolDataProvider.getReserveConfigurationData(
- tokenList.usdx
- );
- }
-
- //----------------------------------------------------------------------------------------------------
- // INITIALIZATION TESTS
- //----------------------------------------------------------------------------------------------------
- function test_initialization() public view {
- assertEq(rateStrategy.MAX_OPTIMAL_POINT(), 99_00);
- assertEq(rateStrategy.MIN_OPTIMAL_POINT(), 1_00);
- assertEq(rateStrategy.MAX_BORROW_RATE(), 1000_00);
- assertEq(address(rateStrategy.ADDRESSES_PROVIDER()), address(report.poolAddressesProvider));
- }
-
- function test_new_DefaultReserveInterestRateStrategy_wrong_provider() public {
- vm.expectRevert(bytes(Errors.INVALID_ADDRESSES_PROVIDER));
- rateStrategy = new DefaultReserveInterestRateStrategyV2(address(0));
- }
-
- //----------------------------------------------------------------------------------------------------
- // Test Getters
- //----------------------------------------------------------------------------------------------------
- function test_getInterestRateDataRay(
- uint16 optimalUsageRatio,
- uint32 baseVariableBorrowRate,
- uint32 variableRateSlope1,
- uint32 variableRateSlope2
- )
- public
- setRateParams(
- optimalUsageRatio,
- baseVariableBorrowRate,
- variableRateSlope1,
- variableRateSlope2,
- tokenList.usdx
- )
- {
- IDefaultInterestRateStrategyV2.InterestRateDataRay memory rateData = rateStrategy
- .getInterestRateData(tokenList.usdx);
- assertEq(uint256(optimalUsageRatio) * 1e23, rateData.optimalUsageRatio);
- assertEq(uint256(baseVariableBorrowRate) * 1e23, rateData.baseVariableBorrowRate);
- assertEq(uint256(variableRateSlope1) * 1e23, rateData.variableRateSlope1);
- assertEq(uint256(variableRateSlope2) * 1e23, rateData.variableRateSlope2);
- }
-
- function test_getInterestRateDataBps(
- uint16 optimalUsageRatio,
- uint32 baseVariableBorrowRate,
- uint32 variableRateSlope1,
- uint32 variableRateSlope2
- )
- public
- setRateParams(
- optimalUsageRatio,
- baseVariableBorrowRate,
- variableRateSlope1,
- variableRateSlope2,
- tokenList.usdx
- )
- {
- IDefaultInterestRateStrategyV2.InterestRateData memory rateData = rateStrategy
- .getInterestRateDataBps(tokenList.usdx);
- assertEq(optimalUsageRatio, rateData.optimalUsageRatio);
- assertEq(baseVariableBorrowRate, rateData.baseVariableBorrowRate);
- assertEq(variableRateSlope1, rateData.variableRateSlope1);
- assertEq(variableRateSlope2, rateData.variableRateSlope2);
- }
-
- function test_getMaxVariableBorrowRate(
- uint16 optimalUsageRatio,
- uint32 baseVariableBorrowRate,
- uint32 variableRateSlope1,
- uint32 variableRateSlope2
- )
- public
- setRateParams(
- optimalUsageRatio,
- baseVariableBorrowRate,
- variableRateSlope1,
- variableRateSlope2,
- tokenList.usdx
- )
- {
- uint256 maxVariableBorrowRate = rateStrategy.getMaxVariableBorrowRate(tokenList.usdx);
- assertEq(
- uint256(baseVariableBorrowRate + variableRateSlope1 + variableRateSlope2) * 1e23,
- maxVariableBorrowRate
- );
- }
-
- //----------------------------------------------------------------------------------------------------
- // Test Set interest Rate params Using FUZZING
- //----------------------------------------------------------------------------------------------------
- function test_new_SetReserveInterestRateParams_override_method_when_not_configurator(
- uint16 optimalUsageRatio,
- uint32 baseVariableBorrowRate,
- uint32 variableRateSlope1,
- uint32 variableRateSlope2
- ) public {
- vm.assume(
- optimalUsageRatio >= rateStrategy.MIN_OPTIMAL_POINT() &&
- optimalUsageRatio <= rateStrategy.MAX_OPTIMAL_POINT()
- );
-
- vm.assume(variableRateSlope1 <= variableRateSlope2);
- vm.assume(
- uint256(baseVariableBorrowRate) + uint256(variableRateSlope1) + uint256(variableRateSlope2) <=
- rateStrategy.MAX_BORROW_RATE()
- );
- IDefaultInterestRateStrategyV2.InterestRateData memory rateData = IDefaultInterestRateStrategyV2
- .InterestRateData({
- optimalUsageRatio: optimalUsageRatio,
- baseVariableBorrowRate: baseVariableBorrowRate,
- variableRateSlope1: variableRateSlope1,
- variableRateSlope2: variableRateSlope2
- });
-
- vm.expectRevert(bytes(Errors.CALLER_NOT_POOL_CONFIGURATOR));
- rateStrategy.setInterestRateParams(tokenList.usdx, rateData);
- }
-
- function test_new_SetReserveInterestRateParams_when_not_configurator(
- uint16 optimalUsageRatio,
- uint32 baseVariableBorrowRate,
- uint32 variableRateSlope1,
- uint32 variableRateSlope2
- ) public {
- vm.assume(
- optimalUsageRatio >= rateStrategy.MIN_OPTIMAL_POINT() &&
- optimalUsageRatio <= rateStrategy.MAX_OPTIMAL_POINT()
- );
-
- vm.assume(variableRateSlope1 <= variableRateSlope2);
- vm.assume(
- uint256(baseVariableBorrowRate) + uint256(variableRateSlope1) + uint256(variableRateSlope2) <=
- rateStrategy.MAX_BORROW_RATE()
- );
- IDefaultInterestRateStrategyV2.InterestRateData memory rateData = IDefaultInterestRateStrategyV2
- .InterestRateData({
- optimalUsageRatio: optimalUsageRatio,
- baseVariableBorrowRate: baseVariableBorrowRate,
- variableRateSlope1: variableRateSlope1,
- variableRateSlope2: variableRateSlope2
- });
-
- vm.expectRevert(bytes(Errors.CALLER_NOT_POOL_CONFIGURATOR));
- rateStrategy.setInterestRateParams(tokenList.usdx, abi.encode(rateData));
- }
-
- function test_new_SetReserveInterestRateParams_override_method(
- uint16 optimalUsageRatio,
- uint32 baseVariableBorrowRate,
- uint32 variableRateSlope1,
- uint32 variableRateSlope2
- ) public {
- vm.assume(
- optimalUsageRatio >= rateStrategy.MIN_OPTIMAL_POINT() &&
- optimalUsageRatio <= rateStrategy.MAX_OPTIMAL_POINT()
- );
-
- vm.assume(variableRateSlope1 <= variableRateSlope2);
- vm.assume(
- uint256(baseVariableBorrowRate) + uint256(variableRateSlope1) + uint256(variableRateSlope2) <=
- rateStrategy.MAX_BORROW_RATE()
- );
- IDefaultInterestRateStrategyV2.InterestRateData memory rateData = IDefaultInterestRateStrategyV2
- .InterestRateData({
- optimalUsageRatio: optimalUsageRatio,
- baseVariableBorrowRate: baseVariableBorrowRate,
- variableRateSlope1: variableRateSlope1,
- variableRateSlope2: variableRateSlope2
- });
-
- vm.prank(report.poolConfiguratorProxy);
- vm.expectEmit(true, false, false, true);
- emit RateDataUpdate(
- tokenList.usdx,
- uint256(rateData.optimalUsageRatio),
- uint256(rateData.baseVariableBorrowRate),
- uint256(rateData.variableRateSlope1),
- uint256(rateData.variableRateSlope2)
- );
- rateStrategy.setInterestRateParams(tokenList.usdx, rateData);
-
- assertEq(address(rateStrategy.ADDRESSES_PROVIDER()), report.poolAddressesProvider);
- assertEq(
- rateStrategy.getOptimalUsageRatio(tokenList.usdx),
- uint256(rateData.optimalUsageRatio) * 1e23
- );
- assertEq(
- rateStrategy.getVariableRateSlope1(tokenList.usdx),
- uint256(rateData.variableRateSlope1) * 1e23
- );
- assertEq(
- rateStrategy.getVariableRateSlope2(tokenList.usdx),
- uint256(rateData.variableRateSlope2) * 1e23
- );
- assertEq(
- rateStrategy.getBaseVariableBorrowRate(tokenList.usdx),
- uint256(rateData.baseVariableBorrowRate) * 1e23
- );
- assertEq(
- rateStrategy.getMaxVariableBorrowRate(tokenList.usdx),
- uint256(
- rateData.baseVariableBorrowRate + rateData.variableRateSlope1 + rateData.variableRateSlope2
- ) * 1e23
- );
- }
-
- function test_new_SetReserveInterestRateParams(
- uint16 optimalUsageRatio,
- uint32 baseVariableBorrowRate,
- uint32 variableRateSlope1,
- uint32 variableRateSlope2
- ) public {
- vm.assume(
- optimalUsageRatio >= rateStrategy.MIN_OPTIMAL_POINT() &&
- optimalUsageRatio <= rateStrategy.MAX_OPTIMAL_POINT()
- );
- vm.assume(variableRateSlope1 <= variableRateSlope2);
- vm.assume(
- uint256(baseVariableBorrowRate) + uint256(variableRateSlope1) + uint256(variableRateSlope2) <=
- rateStrategy.MAX_BORROW_RATE()
- );
-
- IDefaultInterestRateStrategyV2.InterestRateData memory rateData = IDefaultInterestRateStrategyV2
- .InterestRateData({
- optimalUsageRatio: optimalUsageRatio,
- baseVariableBorrowRate: baseVariableBorrowRate,
- variableRateSlope1: variableRateSlope1,
- variableRateSlope2: variableRateSlope2
- });
-
- vm.prank(report.poolConfiguratorProxy);
- vm.expectEmit(true, false, false, true);
- emit RateDataUpdate(
- tokenList.usdx,
- uint256(rateData.optimalUsageRatio),
- uint256(rateData.baseVariableBorrowRate),
- uint256(rateData.variableRateSlope1),
- uint256(rateData.variableRateSlope2)
- );
- rateStrategy.setInterestRateParams(tokenList.usdx, abi.encode(rateData));
-
- assertEq(address(rateStrategy.ADDRESSES_PROVIDER()), report.poolAddressesProvider);
- assertEq(
- rateStrategy.getOptimalUsageRatio(tokenList.usdx),
- uint256(rateData.optimalUsageRatio) * 1e23
- );
- assertEq(
- rateStrategy.getVariableRateSlope1(tokenList.usdx),
- uint256(rateData.variableRateSlope1) * 1e23
- );
- assertEq(
- rateStrategy.getVariableRateSlope2(tokenList.usdx),
- uint256(rateData.variableRateSlope2) * 1e23
- );
- assertEq(
- rateStrategy.getBaseVariableBorrowRate(tokenList.usdx),
- uint256(rateData.baseVariableBorrowRate) * 1e23
- );
- assertEq(
- rateStrategy.getMaxVariableBorrowRate(tokenList.usdx),
- uint256(
- rateData.baseVariableBorrowRate + rateData.variableRateSlope1 + rateData.variableRateSlope2
- ) * 1e23
- );
- }
-
- function test_reverts_SetReserveInterestRateParams_when_reserve_0(
- uint16 optimalUsageRatio,
- uint32 baseVariableBorrowRate,
- uint32 variableRateSlope1,
- uint32 variableRateSlope2
- ) public {
- IDefaultInterestRateStrategyV2.InterestRateData memory rateData = IDefaultInterestRateStrategyV2
- .InterestRateData({
- optimalUsageRatio: optimalUsageRatio,
- baseVariableBorrowRate: baseVariableBorrowRate,
- variableRateSlope1: variableRateSlope1,
- variableRateSlope2: variableRateSlope2
- });
-
- vm.prank(report.poolConfiguratorProxy);
-
- vm.expectRevert(bytes(Errors.ZERO_ADDRESS_NOT_VALID));
- rateStrategy.setInterestRateParams(address(0), abi.encode(rateData));
- }
-
- function test_reverts_SetReserveInterestRateParams_when_reserve_0_override_method(
- uint16 optimalUsageRatio,
- uint32 baseVariableBorrowRate,
- uint32 variableRateSlope1,
- uint32 variableRateSlope2
- ) public {
- IDefaultInterestRateStrategyV2.InterestRateData memory rateData = IDefaultInterestRateStrategyV2
- .InterestRateData({
- optimalUsageRatio: optimalUsageRatio,
- baseVariableBorrowRate: baseVariableBorrowRate,
- variableRateSlope1: variableRateSlope1,
- variableRateSlope2: variableRateSlope2
- });
-
- vm.prank(report.poolConfiguratorProxy);
-
- vm.expectRevert(bytes(Errors.ZERO_ADDRESS_NOT_VALID));
- rateStrategy.setInterestRateParams(address(0), rateData);
- }
-
- function test_reverts_SetReserveInterestRateParams_when_gt_max_op(
- uint16 optimalUsageRatio,
- uint32 baseVariableBorrowRate,
- uint32 variableRateSlope1,
- uint32 variableRateSlope2
- ) public {
- vm.assume(optimalUsageRatio > rateStrategy.MAX_OPTIMAL_POINT());
-
- IDefaultInterestRateStrategyV2.InterestRateData memory rateData = IDefaultInterestRateStrategyV2
- .InterestRateData({
- optimalUsageRatio: optimalUsageRatio,
- baseVariableBorrowRate: baseVariableBorrowRate,
- variableRateSlope1: variableRateSlope1,
- variableRateSlope2: variableRateSlope2
- });
-
- vm.prank(report.poolConfiguratorProxy);
-
- vm.expectRevert(bytes(Errors.INVALID_OPTIMAL_USAGE_RATIO));
- rateStrategy.setInterestRateParams(tokenList.usdx, abi.encode(rateData));
- }
-
- function test_reverts_SetReserveInterestRateParams_when_gt_max_op_override_method(
- uint16 optimalUsageRatio,
- uint32 baseVariableBorrowRate,
- uint32 variableRateSlope1,
- uint32 variableRateSlope2
- ) public {
- vm.assume(optimalUsageRatio > rateStrategy.MAX_OPTIMAL_POINT());
-
- //<<<<<<< HEAD
- IDefaultInterestRateStrategyV2.InterestRateData memory rateData = IDefaultInterestRateStrategyV2
- .InterestRateData({
- optimalUsageRatio: optimalUsageRatio,
- baseVariableBorrowRate: baseVariableBorrowRate,
- variableRateSlope1: variableRateSlope1,
- variableRateSlope2: variableRateSlope2
- });
- //=======
- // DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
- // unbacked: 0,
- // liquidityAdded: 0,
- // liquidityTaken: 0,
- // totalStableDebt: 0,
- // totalVariableDebt: 0,
- // averageStableBorrowRate: 0,
- // reserveFactor: reserveFactor,
- // reserve: tokenList.usdx,
- // usingVirtualBalance: true,
- // virtualUnderlyingBalance: 0
- // });
- //>>>>>>> 44cf8077687ba552e6cbcbba7c7cdbbb4c68e34f
-
- vm.prank(report.poolConfiguratorProxy);
-
- vm.expectRevert(bytes(Errors.INVALID_OPTIMAL_USAGE_RATIO));
- rateStrategy.setInterestRateParams(tokenList.usdx, rateData);
- }
-
- function test_reverts_SetReserveInterestRateParams_when_lt_min_op(
- uint16 optimalUsageRatio,
- uint32 baseVariableBorrowRate,
- uint32 variableRateSlope1,
- uint32 variableRateSlope2
- ) public {
- vm.assume(optimalUsageRatio < rateStrategy.MIN_OPTIMAL_POINT());
-
- IDefaultInterestRateStrategyV2.InterestRateData memory rateData = IDefaultInterestRateStrategyV2
- .InterestRateData({
- optimalUsageRatio: optimalUsageRatio,
- baseVariableBorrowRate: baseVariableBorrowRate,
- variableRateSlope1: variableRateSlope1,
- variableRateSlope2: variableRateSlope2
- });
-
- vm.prank(report.poolConfiguratorProxy);
-
- vm.expectRevert(bytes(Errors.INVALID_OPTIMAL_USAGE_RATIO));
- rateStrategy.setInterestRateParams(tokenList.usdx, abi.encode(rateData));
- }
-
- function test_reverts_SetReserveInterestRateParams_when_lt_min_op_override_method(
- uint16 optimalUsageRatio,
- uint32 baseVariableBorrowRate,
- uint32 variableRateSlope1,
- uint32 variableRateSlope2
- ) public {
- vm.assume(optimalUsageRatio < rateStrategy.MIN_OPTIMAL_POINT());
-
- IDefaultInterestRateStrategyV2.InterestRateData memory rateData = IDefaultInterestRateStrategyV2
- .InterestRateData({
- optimalUsageRatio: optimalUsageRatio,
- baseVariableBorrowRate: baseVariableBorrowRate,
- variableRateSlope1: variableRateSlope1,
- variableRateSlope2: variableRateSlope2
- });
-
- vm.prank(report.poolConfiguratorProxy);
-
- vm.expectRevert(bytes(Errors.INVALID_OPTIMAL_USAGE_RATIO));
- rateStrategy.setInterestRateParams(tokenList.usdx, rateData);
- }
-
- function test_reverts_SetReserveInterestRateParams_when_gt_maxRate(
- uint16 optimalUsageRatio,
- uint32 baseVariableBorrowRate,
- uint32 variableRateSlope1,
- uint32 variableRateSlope2
- ) public {
- vm.assume(
- optimalUsageRatio >= rateStrategy.MIN_OPTIMAL_POINT() &&
- optimalUsageRatio <= rateStrategy.MAX_OPTIMAL_POINT()
- );
-
- vm.assume(variableRateSlope1 <= variableRateSlope2);
- vm.assume(
- uint256(baseVariableBorrowRate) + uint256(variableRateSlope1) + uint256(variableRateSlope2) >
- rateStrategy.MAX_BORROW_RATE()
- );
-
- IDefaultInterestRateStrategyV2.InterestRateData memory rateData = IDefaultInterestRateStrategyV2
- .InterestRateData({
- optimalUsageRatio: optimalUsageRatio,
- baseVariableBorrowRate: baseVariableBorrowRate,
- variableRateSlope1: variableRateSlope1,
- variableRateSlope2: variableRateSlope2
- });
-
- vm.prank(report.poolConfiguratorProxy);
-
- vm.expectRevert(bytes(Errors.INVALID_MAX_RATE));
- rateStrategy.setInterestRateParams(tokenList.usdx, abi.encode(rateData));
- }
-
- function test_reverts_SetReserveInterestRateParams_when_gt_maxRate_override_method(
- uint16 optimalUsageRatio,
- uint32 baseVariableBorrowRate,
- uint32 variableRateSlope1,
- uint32 variableRateSlope2
- ) public {
- vm.assume(
- optimalUsageRatio >= rateStrategy.MIN_OPTIMAL_POINT() &&
- optimalUsageRatio <= rateStrategy.MAX_OPTIMAL_POINT()
- );
-
- vm.assume(variableRateSlope1 <= variableRateSlope2);
- vm.assume(
- uint256(baseVariableBorrowRate) + uint256(variableRateSlope1) + uint256(variableRateSlope2) >
- rateStrategy.MAX_BORROW_RATE()
- );
-
- IDefaultInterestRateStrategyV2.InterestRateData memory rateData = IDefaultInterestRateStrategyV2
- .InterestRateData({
- optimalUsageRatio: optimalUsageRatio,
- baseVariableBorrowRate: baseVariableBorrowRate,
- variableRateSlope1: variableRateSlope1,
- variableRateSlope2: variableRateSlope2
- });
-
- vm.prank(report.poolConfiguratorProxy);
-
- vm.expectRevert(bytes(Errors.INVALID_MAX_RATE));
- rateStrategy.setInterestRateParams(tokenList.usdx, rateData);
- }
-
- function test_reverts_SetReserveInterestRateParams_when_slope1_gt_slope2(
- uint16 optimalUsageRatio,
- uint32 baseVariableBorrowRate,
- uint32 variableRateSlope1,
- uint32 variableRateSlope2
- ) public {
- vm.assume(
- optimalUsageRatio >= rateStrategy.MIN_OPTIMAL_POINT() &&
- optimalUsageRatio <= rateStrategy.MAX_OPTIMAL_POINT()
- );
-
- vm.assume(variableRateSlope1 > variableRateSlope2);
-
- IDefaultInterestRateStrategyV2.InterestRateData memory rateData = IDefaultInterestRateStrategyV2
- .InterestRateData({
- optimalUsageRatio: optimalUsageRatio,
- baseVariableBorrowRate: baseVariableBorrowRate,
- variableRateSlope1: variableRateSlope1,
- variableRateSlope2: variableRateSlope2
- });
-
- vm.prank(report.poolConfiguratorProxy);
-
- vm.expectRevert(bytes(Errors.SLOPE_2_MUST_BE_GTE_SLOPE_1));
- rateStrategy.setInterestRateParams(tokenList.usdx, abi.encode(rateData));
- }
-
- function test_reverts_SetReserveInterestRateParams_when_slope1_gt_slope2_override_method(
- uint16 optimalUsageRatio,
- uint32 baseVariableBorrowRate,
- uint32 variableRateSlope1,
- uint32 variableRateSlope2
- ) public {
- vm.assume(
- optimalUsageRatio >= rateStrategy.MIN_OPTIMAL_POINT() &&
- optimalUsageRatio <= rateStrategy.MAX_OPTIMAL_POINT()
- );
-
- vm.assume(variableRateSlope1 > variableRateSlope2);
-
- IDefaultInterestRateStrategyV2.InterestRateData memory rateData = IDefaultInterestRateStrategyV2
- .InterestRateData({
- optimalUsageRatio: optimalUsageRatio,
- baseVariableBorrowRate: baseVariableBorrowRate,
- variableRateSlope1: variableRateSlope1,
- variableRateSlope2: variableRateSlope2
- });
-
- vm.prank(report.poolConfiguratorProxy);
-
- vm.expectRevert(bytes(Errors.SLOPE_2_MUST_BE_GTE_SLOPE_1));
- rateStrategy.setInterestRateParams(tokenList.usdx, abi.encode(rateData));
- }
-
- //----------------------------------------------------------------------------------------------------
- // Test Calculate Rates with specific conditions
- //----------------------------------------------------------------------------------------------------
- function test_calculate_rates_80_percent_usage()
- public
- setRateParams(uint16(80_00), uint32(1_00), uint32(4_00), uint32(60_00), tokenList.usdx)
- {
- DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
- unbacked: 0,
- liquidityAdded: 0,
- liquidityTaken: 0,
- totalStableDebt: 0,
- totalVariableDebt: 800000000000000000,
- averageStableBorrowRate: 0,
- reserveFactor: reserveFactor,
- reserve: tokenList.usdx,
- usingVirtualBalance: true,
- virtualUnderlyingBalance: 200000000000000000
- });
- (
- params.currentLiquidityRate,
- params.currentStableBorrowRate,
- params.currentVariableBorrowRate
- ) = rateStrategy.calculateInterestRates(input);
-
- uint256 expectedVariableRate = rateStrategy.getBaseVariableBorrowRate(tokenList.usdx) +
- rateStrategy.getVariableRateSlope1(tokenList.usdx);
-
- assertEq(
- params.currentLiquidityRate,
- expectedVariableRate.percentMul(8000).percentMul(100_00 - input.reserveFactor),
- 'Invalid liquidity rate'
- );
- assertEq(params.currentStableBorrowRate, 0);
- assertEq(params.currentVariableBorrowRate, expectedVariableRate, 'Invalid variable rate');
- }
-
- function test_calculate_rates_100_percent_usage()
- public
- setRateParams(uint16(80_00), uint32(1_00), uint32(4_00), uint32(60_00), tokenList.usdx)
- {
- DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
- unbacked: 0,
- liquidityAdded: 0,
- liquidityTaken: 0,
- totalStableDebt: 0,
- totalVariableDebt: 1000000000000000000,
- averageStableBorrowRate: 0,
- reserveFactor: reserveFactor,
- reserve: tokenList.usdx,
- usingVirtualBalance: true,
- virtualUnderlyingBalance: 0
- });
-
- (
- uint256 currentLiquidityRate,
- uint256 currentStableBorrowRate,
- uint256 currentVariableBorrowRate
- ) = rateStrategy.calculateInterestRates(input);
-
- uint256 expectedVariableRate = rateStrategy.getBaseVariableBorrowRate(tokenList.usdx) +
- rateStrategy.getVariableRateSlope1(tokenList.usdx) +
- rateStrategy.getVariableRateSlope2(tokenList.usdx);
-
- assertEq(
- currentLiquidityRate,
- expectedVariableRate.percentMul(100_00 - input.reserveFactor),
- 'Invalid liquidity rate'
- );
- assertEq(currentStableBorrowRate, 0);
- assertEq(currentVariableBorrowRate, expectedVariableRate, 'Invalid variable rate');
- }
-
- function test_calculate_rates_100_percent_usage_50_percent_stable_debt_50_percent_variable_debt_10_percent_avg_stable_rate()
- public
- setRateParams(uint16(80_00), uint32(1_00), uint32(4_00), uint32(60_00), tokenList.usdx)
- {
- DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
- unbacked: 0,
- liquidityAdded: 0,
- liquidityTaken: 0,
- totalStableDebt: 400000000000000000,
- totalVariableDebt: 400000000000000000,
- averageStableBorrowRate: 100000000000000000000000000,
- reserveFactor: reserveFactor,
- reserve: tokenList.usdx,
- usingVirtualBalance: true,
- virtualUnderlyingBalance: 0
- });
-
- (
- uint256 currentLiquidityRate,
- uint256 currentStableBorrowRate,
- uint256 currentVariableBorrowRate
- ) = rateStrategy.calculateInterestRates(input);
-
- uint256 expectedVariableRate = rateStrategy.getBaseVariableBorrowRate(tokenList.usdx) +
- rateStrategy.getVariableRateSlope1(tokenList.usdx) +
- rateStrategy.getVariableRateSlope2(tokenList.usdx);
-
- uint256 expectedLiquidityRate = ((currentVariableBorrowRate + 1e26) / 2).percentMul(
- 100_00 - input.reserveFactor
- );
-
- assertEq(currentVariableBorrowRate, expectedVariableRate, 'Invalid variable rate');
- assertEq(currentStableBorrowRate, 0);
-
- assertEq(currentLiquidityRate, expectedLiquidityRate, 'Invalid liquidity rate');
- }
-
- function test_calculate_rates_80_percent_usage_and_50_percent_supply_usage_due_minted_tokens()
- public
- setRateParams(uint16(80_00), uint32(1_00), uint32(4_00), uint32(60_00), tokenList.usdx)
- {
- DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
- unbacked: 600000000000000000,
- liquidityAdded: 0,
- liquidityTaken: 0,
- totalStableDebt: 0,
- totalVariableDebt: 800000000000000000,
- averageStableBorrowRate: 0,
- reserveFactor: reserveFactor,
- reserve: tokenList.usdx,
- usingVirtualBalance: true,
- virtualUnderlyingBalance: 200000000000000000
- });
-
- (
- uint256 currentLiquidityRate,
- uint256 currentStableBorrowRate,
- uint256 currentVariableBorrowRate
- ) = rateStrategy.calculateInterestRates(input);
-
- uint256 expectedVariableRate = rateStrategy.getBaseVariableBorrowRate(tokenList.usdx) +
- rateStrategy.getVariableRateSlope1(tokenList.usdx);
-
- assertEq(
- currentLiquidityRate,
- expectedVariableRate.percentMul(5000).percentMul(100_00 - input.reserveFactor),
- 'Invalid liquidity rate'
- );
-
- assertEq(currentStableBorrowRate, 0);
- assertEq(currentVariableBorrowRate, expectedVariableRate, 'Invalid variable rate');
- }
-
- function test_calculate_rates_80_percent_usage_and_80_bps_supply_usage_due_minted_tokens()
- public
- setRateParams(uint16(80_00), uint32(1_00), uint32(4_00), uint32(60_00), tokenList.usdx)
- {
- DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
- unbacked: 800000000000000000 * 124 - 200000000000000000,
- liquidityAdded: 0,
- liquidityTaken: 0,
- totalStableDebt: 0,
- totalVariableDebt: 800000000000000000,
- averageStableBorrowRate: 0,
- reserveFactor: reserveFactor,
- reserve: tokenList.usdx,
- usingVirtualBalance: true,
- virtualUnderlyingBalance: 200000000000000000
- });
-
- (
- uint256 currentLiquidityRate,
- uint256 currentStableBorrowRate,
- uint256 currentVariableBorrowRate
- ) = rateStrategy.calculateInterestRates(input);
-
- uint256 expectedVariableRate = rateStrategy.getBaseVariableBorrowRate(tokenList.usdx) +
- rateStrategy.getVariableRateSlope1(tokenList.usdx);
-
- assertEq(
- currentLiquidityRate,
- expectedVariableRate.percentMul(80).percentMul(100_00 - input.reserveFactor),
- 'Invalid liquidity rate'
- );
-
- assertEq(currentStableBorrowRate, 0);
- assertEq(currentVariableBorrowRate, expectedVariableRate, 'Invalid variable rate');
- }
-
- function test_calculate_rates_80_bps_usage()
- public
- setRateParams(uint16(80_00), uint32(1_00), uint32(4_00), uint32(60_00), tokenList.usdx)
- {
- DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
- unbacked: 0,
- liquidityAdded: 0,
- liquidityTaken: 0,
- totalStableDebt: 0,
- totalVariableDebt: 80000000000000000000,
- averageStableBorrowRate: 0,
- reserveFactor: reserveFactor,
- reserve: tokenList.usdx,
- usingVirtualBalance: true,
- virtualUnderlyingBalance: 9920000000000000000000
- });
- (
- uint256 currentLiquidityRate,
- uint256 currentStableBorrowRate,
- uint256 currentVariableBorrowRate
- ) = rateStrategy.calculateInterestRates(input);
-
- uint256 usageRatio = _bpsToRay(80);
- uint256 expectedVariableRate = rateStrategy.getBaseVariableBorrowRate(tokenList.usdx) +
- rateStrategy.getVariableRateSlope1(tokenList.usdx).rayMul(
- usageRatio.rayDiv(rateStrategy.getOptimalUsageRatio(tokenList.usdx))
- );
- assertEq(
- currentLiquidityRate,
- expectedVariableRate.percentMul(80).percentMul(100_00 - input.reserveFactor),
- 'Invalid liquidity rate'
- );
- assertEq(currentStableBorrowRate, 0);
- assertEq(currentVariableBorrowRate, expectedVariableRate, 'Invalid variable rate');
- }
-
- function test_fuzz_calculate_rates_80_percent_usage_added_and_virtual_equal(
- uint256 virtualBalanceAmount
- ) public view {
- vm.assume(virtualBalanceAmount <= 200000000000000000);
- uint256 liquidityAddedAmount = 200000000000000000 - virtualBalanceAmount;
-
- // First, calculate using only virtual balance
- DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
- reserve: tokenList.usdx,
- unbacked: 0,
- liquidityAdded: 0,
- liquidityTaken: 0,
- totalStableDebt: 0,
- totalVariableDebt: 800000000000000000,
- averageStableBorrowRate: 0,
- reserveFactor: reserveFactor,
- usingVirtualBalance: true,
- virtualUnderlyingBalance: 200000000000000000
- });
-
- (
- uint256 currentLiquidityRateOne,
- uint256 currentStableBorrowRateOne,
- uint256 currentVariableBorrowRateOne
- ) = rateStrategy.calculateInterestRates(input);
-
- // Second, calculate using the fuzzed values, totaling the same utilization
- input = DataTypes.CalculateInterestRatesParams({
- reserve: tokenList.usdx,
- unbacked: 0,
- liquidityAdded: liquidityAddedAmount,
- liquidityTaken: 0,
- totalStableDebt: 0,
- totalVariableDebt: 800000000000000000,
- averageStableBorrowRate: 0,
- reserveFactor: reserveFactor,
- usingVirtualBalance: true,
- virtualUnderlyingBalance: virtualBalanceAmount
- });
-
- (
- uint256 currentLiquidityRateTwo,
- uint256 currentStableBorrowRateTwo,
- uint256 currentVariableBorrowRateTwo
- ) = rateStrategy.calculateInterestRates(input);
-
- assertEq(currentLiquidityRateOne, currentLiquidityRateTwo, 'Invalid liquidity rate');
-
- assertEq(currentStableBorrowRateOne, currentStableBorrowRateTwo, 'Invalid stable rate');
-
- assertEq(currentVariableBorrowRateOne, currentVariableBorrowRateTwo, 'Invalid variable rate');
-
- uint256 expectedVariableRate = rateStrategy.getBaseVariableBorrowRate(tokenList.usdx) +
- rateStrategy.getVariableRateSlope1(tokenList.usdx);
-
- assertEq(
- currentLiquidityRateTwo,
- expectedVariableRate.percentMul(8000).percentMul(100_00 - input.reserveFactor),
- 'Invalid liquidity rate'
- );
-
- assertEq(currentVariableBorrowRateTwo, expectedVariableRate, 'Invalid variable rate');
- }
-
- //----------------------------------------------------------------------------------------------------
- // Test Calculate Rates with FUZZING
- //----------------------------------------------------------------------------------------------------
- function test_calculate_rates_empty_reserve(
- uint16 optimalUsageRatio,
- uint32 baseVariableBorrowRate,
- uint32 variableRateSlope1,
- uint32 variableRateSlope2
- )
- public
- setRateParams(
- optimalUsageRatio,
- baseVariableBorrowRate,
- variableRateSlope1,
- variableRateSlope2,
- tokenList.usdx
- )
- {
- DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
- unbacked: 0,
- liquidityAdded: 0,
- liquidityTaken: 0,
- totalStableDebt: 0,
- totalVariableDebt: 0,
- averageStableBorrowRate: 0,
- reserveFactor: reserveFactor,
- reserve: tokenList.usdx,
- usingVirtualBalance: true,
- virtualUnderlyingBalance: 0
- });
-
- (
- uint256 currentLiquidityRate,
- uint256 currentStableBorrowRate,
- uint256 currentVariableBorrowRate
- ) = rateStrategy.calculateInterestRates(input);
-
- assertEq(currentLiquidityRate, 0);
- assertEq(currentStableBorrowRate, 0);
- assertEq(currentVariableBorrowRate, rateStrategy.getBaseVariableBorrowRate(tokenList.usdx));
- }
-
- function test_calculate_rates_when_not_using_virtual_valance(
- uint16 optimalUsageRatio,
- uint256 availableLiquidity,
- uint32 baseVariableBorrowRate,
- uint32 variableRateSlope1,
- uint32 variableRateSlope2,
- uint256 virtualBalanceAmount
- )
- public
- setRateParams(
- optimalUsageRatio,
- baseVariableBorrowRate,
- variableRateSlope1,
- variableRateSlope2,
- tokenList.usdx
- )
- {
- DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
- unbacked: 0,
- liquidityAdded: availableLiquidity,
- liquidityTaken: 0,
- totalStableDebt: 0,
- totalVariableDebt: 0,
- averageStableBorrowRate: 0,
- reserveFactor: reserveFactor,
- reserve: tokenList.usdx,
- usingVirtualBalance: false,
- virtualUnderlyingBalance: virtualBalanceAmount
- });
- (
- params.currentLiquidityRate,
- params.currentStableBorrowRate,
- params.currentVariableBorrowRate
- ) = rateStrategy.calculateInterestRates(input);
-
- assertEq(params.currentLiquidityRate, 0, 'Invalid liquidity rate');
- assertEq(params.currentStableBorrowRate, 0);
- assertEq(
- params.currentVariableBorrowRate,
- rateStrategy.getBaseVariableBorrowRate(tokenList.usdx),
- 'Invalid variable rate'
- );
- }
-
- function test_calculate_rates_when_total_debt_0(
- uint16 optimalUsageRatio,
- uint256 availableLiquidity,
- uint32 baseVariableBorrowRate,
- uint32 variableRateSlope1,
- uint32 variableRateSlope2,
- uint256 virtualBalanceAmount
- )
- public
- setRateParams(
- optimalUsageRatio,
- baseVariableBorrowRate,
- variableRateSlope1,
- variableRateSlope2,
- tokenList.usdx
- )
- {
- DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
- unbacked: 0,
- liquidityAdded: availableLiquidity,
- liquidityTaken: 0,
- totalStableDebt: 0,
- totalVariableDebt: 0,
- averageStableBorrowRate: 0,
- reserveFactor: reserveFactor,
- reserve: tokenList.usdx,
- usingVirtualBalance: true,
- virtualUnderlyingBalance: virtualBalanceAmount
- });
- (
- params.currentLiquidityRate,
- params.currentStableBorrowRate,
- params.currentVariableBorrowRate
- ) = rateStrategy.calculateInterestRates(input);
-
- assertEq(params.currentLiquidityRate, 0, 'Invalid liquidity rate');
- assertEq(params.currentStableBorrowRate, 0);
- assertEq(
- params.currentVariableBorrowRate,
- rateStrategy.getBaseVariableBorrowRate(tokenList.usdx),
- 'Invalid variable rate'
- );
- }
-
- function test_calculate_rates_below_op_usage(
- uint16 optimalUsageRatio,
- uint256 totalDebt,
- uint256 availableLiquidity,
- uint32 baseVariableBorrowRate,
- uint32 variableRateSlope1,
- uint32 variableRateSlope2,
- uint256 virtualBalanceAmount
- ) public {
- _setRateParams(
- optimalUsageRatio,
- baseVariableBorrowRate,
- variableRateSlope1,
- variableRateSlope2,
- tokenList.usdx
- );
- vm.assume(totalDebt > 0);
- vm.assume(totalDebt < availableLiquidity && availableLiquidity < 1e28);
- vm.assume(virtualBalanceAmount < 1e28);
- uint256 availableLiquidityPlusDebt = totalDebt + availableLiquidity + virtualBalanceAmount;
- borrowUsageRatio = totalDebt.rayDiv(availableLiquidityPlusDebt);
- vm.assume(borrowUsageRatio < (uint256(optimalUsageRatio) * 1e23));
-
- DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
- unbacked: 0,
- liquidityAdded: availableLiquidity,
- liquidityTaken: 0,
- totalStableDebt: 0,
- totalVariableDebt: totalDebt,
- averageStableBorrowRate: 0,
- reserveFactor: reserveFactor,
- reserve: tokenList.usdx,
- usingVirtualBalance: true,
- virtualUnderlyingBalance: virtualBalanceAmount
- });
-
- (
- params.currentLiquidityRate,
- params.currentStableBorrowRate,
- params.currentVariableBorrowRate
- ) = rateStrategy.calculateInterestRates(input);
-
- uint256 expectedVariableRate = rateStrategy.getBaseVariableBorrowRate(tokenList.usdx) +
- rateStrategy.getVariableRateSlope1(tokenList.usdx).rayMul(
- borrowUsageRatio.rayDiv(rateStrategy.getOptimalUsageRatio(tokenList.usdx))
- );
-
- assertApproxEqAbs(
- params.currentVariableBorrowRate,
- expectedVariableRate,
- 100,
- 'Invalid variable rate'
- );
- assertEq(params.currentStableBorrowRate, 0);
-
- assertApproxEqAbs(
- params.currentLiquidityRate,
- (
- input.totalVariableDebt.wadToRay().rayMul(expectedVariableRate).rayDiv(
- input.totalVariableDebt.wadToRay()
- )
- ).rayMul(input.totalVariableDebt.rayDiv(availableLiquidityPlusDebt)).percentMul(
- 100_00 - input.reserveFactor
- ),
- 100,
- 'Invalid liquidity rate'
- );
- }
-
- function test_calculate_rates_below_op_usage_when_no_debt(
- uint16 optimalUsageRatio,
- uint256 availableLiquidity,
- uint32 baseVariableBorrowRate,
- uint32 variableRateSlope1,
- uint32 variableRateSlope2,
- uint256 virtualBalanceAmount
- )
- public
- setRateParams(
- optimalUsageRatio,
- baseVariableBorrowRate,
- variableRateSlope1,
- variableRateSlope2,
- tokenList.usdx
- )
- {
- uint256 totalDebt = 0;
- vm.assume(totalDebt < availableLiquidity && availableLiquidity < 1e28);
- uint256 availableLiquidityPlusDebt = totalDebt + availableLiquidity;
- borrowUsageRatio = totalDebt.rayDiv(availableLiquidityPlusDebt);
- vm.assume(borrowUsageRatio < (uint256(optimalUsageRatio) * 1e23));
-
- DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
- unbacked: 0,
- liquidityAdded: availableLiquidity,
- liquidityTaken: 0,
- totalStableDebt: 0,
- totalVariableDebt: totalDebt,
- averageStableBorrowRate: 0,
- reserveFactor: reserveFactor,
- reserve: tokenList.usdx,
- usingVirtualBalance: true,
- virtualUnderlyingBalance: virtualBalanceAmount
- });
-
- (
- params.currentLiquidityRate,
- params.currentStableBorrowRate,
- params.currentVariableBorrowRate
- ) = rateStrategy.calculateInterestRates(input);
-
- uint256 expectedVariableRate = rateStrategy.getBaseVariableBorrowRate(tokenList.usdx) +
- rateStrategy.getVariableRateSlope1(tokenList.usdx).rayMul(
- borrowUsageRatio.rayDiv(rateStrategy.getOptimalUsageRatio(tokenList.usdx))
- );
-
- assertApproxEqAbs(
- params.currentVariableBorrowRate,
- expectedVariableRate,
- 100,
- 'Invalid variable rate'
- );
- assertEq(params.currentStableBorrowRate, 0);
-
- assertEq(params.currentLiquidityRate, 0, 'Invalid liquidity rate');
- }
-
- function test_calculate_rates_above_op_usage(
- uint16 optimalUsageRatio,
- uint256 totalDebt,
- uint256 availableLiquidity,
- uint32 baseVariableBorrowRate,
- uint32 variableRateSlope1,
- uint32 variableRateSlope2,
- uint256 virtualBalanceAmount
- )
- public
- setRateParams(
- optimalUsageRatio,
- baseVariableBorrowRate,
- variableRateSlope1,
- variableRateSlope2,
- tokenList.usdx
- )
- {
- availableLiquidity = bound(availableLiquidity, 1, 1e28);
- totalDebt = bound(totalDebt, 1, availableLiquidity);
- vm.assume(virtualBalanceAmount < 1e28);
- uint256 availableLiquidityPlusDebt = totalDebt + availableLiquidity + virtualBalanceAmount;
-
- borrowUsageRatio = totalDebt.rayDiv(availableLiquidityPlusDebt);
- vm.assume(borrowUsageRatio > (uint256(optimalUsageRatio) * 1e23));
-
- DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
- unbacked: 0,
- liquidityAdded: availableLiquidity,
- liquidityTaken: 0,
- totalStableDebt: 0,
- totalVariableDebt: totalDebt,
- averageStableBorrowRate: 0,
- reserveFactor: reserveFactor,
- reserve: tokenList.usdx,
- usingVirtualBalance: true,
- virtualUnderlyingBalance: virtualBalanceAmount
- });
-
- (
- params.currentLiquidityRate,
- params.currentStableBorrowRate,
- params.currentVariableBorrowRate
- ) = rateStrategy.calculateInterestRates(input);
-
- uint256 excessBorrowUsageRatio = (borrowUsageRatio -
- rateStrategy.getOptimalUsageRatio(tokenList.usdx)).rayDiv(
- WadRayMath.RAY - rateStrategy.getOptimalUsageRatio(tokenList.usdx)
- );
-
- uint256 expectedVariableRate = rateStrategy.getBaseVariableBorrowRate(tokenList.usdx) +
- rateStrategy.getVariableRateSlope1(tokenList.usdx) +
- rateStrategy.getVariableRateSlope2(tokenList.usdx).rayMul(excessBorrowUsageRatio);
-
- assertEq(params.currentVariableBorrowRate, expectedVariableRate, 'Invalid variable rate');
-
- assertEq(params.currentStableBorrowRate, 0);
- assertEq(
- params.currentLiquidityRate,
- (
- input.totalVariableDebt.wadToRay().rayMul(expectedVariableRate).rayDiv(
- input.totalVariableDebt.wadToRay()
- )
- ).rayMul(input.totalVariableDebt.rayDiv(availableLiquidityPlusDebt)).percentMul(
- 100_00 - input.reserveFactor
- ),
- 'Invalid liquidity rate'
- );
- }
-}
diff --git a/tests/core/RatesOverflow.t.sol b/tests/core/RatesOverflow.t.sol
deleted file mode 100644
index bb99d58f..00000000
--- a/tests/core/RatesOverflow.t.sol
+++ /dev/null
@@ -1,57 +0,0 @@
-// SPDX-License-Identifier: BUSL-1.1
-pragma solidity ^0.8.0;
-
-import 'forge-std/Test.sol';
-
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
-import {MockReserveInterestRateStrategy} from 'aave-v3-core/contracts/mocks/tests/MockReserveInterestRateStrategy.sol';
-import {IPoolConfigurator} from 'aave-v3-core/contracts/interfaces/IPoolConfigurator.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
-
-// @dev Ignored from coverage report, due Foundry Coverage can not detect functions if they return 0.
-contract RatesOverflowCheckTests is TestnetProcedures {
- MockReserveInterestRateStrategy internal mockRateStrategy;
-
- function setUp() public {
- initTestEnvironment();
-
- mockRateStrategy = new MockReserveInterestRateStrategy(report.poolAddressesProvider);
-
- vm.prank(carol);
- contracts.poolProxy.supply(tokenList.usdx, 100_000e6, carol, 0);
-
- vm.startPrank(poolAdmin);
- IPoolConfigurator(report.poolConfiguratorProxy).setReserveInterestRateStrategyAddress(
- tokenList.usdx,
- address(mockRateStrategy),
- _getDefaultInterestRatesStrategyData()
- );
-
- IPoolConfigurator(report.poolConfiguratorProxy).setReserveStableRateBorrowing(
- tokenList.usdx,
- true
- );
- vm.stopPrank();
- }
-
- function test_overflow_liquidity_rates() public {
- mockRateStrategy.setLiquidityRate(UINT256_MAX);
-
- vm.expectRevert(bytes("SafeCast: value doesn't fit in 128 bits"));
- vm.prank(alice);
- contracts.poolProxy.supply(tokenList.usdx, 1000e6, alice, 0);
- }
-
- function test_overflow_variable_rates() public {
- vm.prank(alice);
- contracts.poolProxy.supply(tokenList.wbtc, 1e8, alice, 0);
-
- mockRateStrategy.setVariableBorrowRate(UINT256_MAX);
-
- vm.expectRevert(bytes("SafeCast: value doesn't fit in 128 bits"));
-
- vm.prank(alice);
- contracts.poolProxy.borrow(tokenList.usdx, 10e6, 2, 0, alice);
- }
-}
diff --git a/tests/core/StableDebtToken.t.sol b/tests/core/StableDebtToken.t.sol
deleted file mode 100644
index 2394d4b6..00000000
--- a/tests/core/StableDebtToken.t.sol
+++ /dev/null
@@ -1,419 +0,0 @@
-// SPDX-License-Identifier: BUSL-1.1
-pragma solidity ^0.8.0;
-
-import 'forge-std/Test.sol';
-
-import {StableDebtTokenHarness as StableDebtTokenInstance} from '../harness/StableDebtToken.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
-import {IAaveIncentivesController} from 'aave-v3-core/contracts/interfaces/IAaveIncentivesController.sol';
-import {TestnetERC20} from 'aave-v3-periphery/contracts/mocks/testnet-helpers/TestnetERC20.sol';
-import {PoolConfigurator, ConfiguratorInputTypes, IPool} from 'aave-v3-core/contracts/protocol/pool/PoolConfigurator.sol';
-import {EIP712SigUtils} from '../utils/EIP712SigUtils.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
-
-contract StableDebtTokenEventsTests is TestnetProcedures {
- StableDebtTokenInstance public stableDebtToken;
-
- event Initialized(
- address indexed underlyingAsset,
- address indexed pool,
- address incentivesController,
- uint8 debtTokenDecimals,
- string debtTokenName,
- string debtTokenSymbol,
- bytes params
- );
-
- event BorrowAllowanceDelegated(
- address indexed fromUser,
- address indexed toUser,
- address indexed asset,
- uint256 amount
- );
-
- function setUp() public {
- initTestEnvironment();
-
- (, address stableDebtUsdx, ) = contracts.protocolDataProvider.getReserveTokensAddresses(
- tokenList.usdx
- );
-
- stableDebtToken = StableDebtTokenInstance(stableDebtUsdx);
-
- vm.prank(bob);
- contracts.poolProxy.supply(tokenList.usdx, 10000e6, bob, 0);
- vm.prank(alice);
- contracts.poolProxy.supply(tokenList.wbtc, 100e8, alice, 0);
- vm.prank(bob);
- contracts.poolProxy.supply(tokenList.wbtc, 100e8, alice, 0);
- // Allow USDX for stable borrow
- vm.prank(poolAdmin);
- PoolConfigurator(report.poolConfiguratorProxy).setReserveStableRateBorrowing(
- tokenList.usdx,
- true
- );
- }
-
- function test_new_StableDebtToken_implementation() public returns (StableDebtTokenInstance) {
- StableDebtTokenInstance stDebtToken = new StableDebtTokenInstance(IPool(report.poolProxy));
-
- assertEq(stDebtToken.name(), 'STABLE_DEBT_TOKEN_IMPL');
- assertEq(stDebtToken.symbol(), 'STABLE_DEBT_TOKEN_IMPL');
- assertEq(stDebtToken.decimals(), 0);
- assertEq(address(stDebtToken.POOL()), address(report.poolProxy));
- assertEq(address(stDebtToken.getIncentivesController()), address(0));
- assertEq(stDebtToken.UNDERLYING_ASSET_ADDRESS(), address(0));
- assertEq(stDebtToken.DEBT_TOKEN_REVISION(), 0x1);
- assertEq(stDebtToken.getAverageStableRate(), 0);
-
- return stDebtToken;
- }
-
- function test_reverts_initialize_twice() public {
- StableDebtTokenInstance staDebtToken = test_initialize_StableDebtToken();
- ConfiguratorInputTypes.InitReserveInput memory listing = (
- _generateListingInput(1, report, poolAdmin)
- )[0];
-
- uint8 decimals = TestnetERC20(listing.underlyingAsset).decimals();
-
- vm.expectRevert(bytes('Contract instance has already been initialized'));
-
- staDebtToken.initialize(
- IPool(report.poolProxy),
- listing.underlyingAsset,
- IAaveIncentivesController(listing.incentivesController),
- decimals,
- listing.stableDebtTokenSymbol,
- listing.stableDebtTokenSymbol,
- listing.params
- );
- }
-
- function test_initialize_StableDebtToken() public returns (StableDebtTokenInstance) {
- StableDebtTokenInstance stDebtToken = test_new_StableDebtToken_implementation();
- ConfiguratorInputTypes.InitReserveInput memory listing = (
- _generateListingInput(1, report, poolAdmin)
- )[0];
-
- vm.expectEmit(address(stDebtToken));
- emit Initialized(
- listing.underlyingAsset,
- report.poolProxy,
- report.rewardsControllerProxy,
- TestnetERC20(listing.underlyingAsset).decimals(),
- listing.stableDebtTokenName,
- listing.stableDebtTokenSymbol,
- listing.params
- );
-
- stDebtToken.initialize(
- IPool(report.poolProxy),
- listing.underlyingAsset,
- IAaveIncentivesController(listing.incentivesController),
- TestnetERC20(listing.underlyingAsset).decimals(),
- listing.stableDebtTokenName,
- listing.stableDebtTokenSymbol,
- listing.params
- );
-
- assertEq(stDebtToken.name(), listing.stableDebtTokenName);
- assertEq(stDebtToken.symbol(), listing.stableDebtTokenSymbol);
- assertEq(stDebtToken.decimals(), TestnetERC20(listing.underlyingAsset).decimals());
- assertEq(address(stDebtToken.POOL()), address(report.poolProxy));
- assertEq(address(stDebtToken.getIncentivesController()), listing.incentivesController);
- assertEq(stDebtToken.UNDERLYING_ASSET_ADDRESS(), listing.underlyingAsset);
- assertEq(stDebtToken.DEBT_TOKEN_REVISION(), 0x1);
-
- return stDebtToken;
- }
-
- function test_reverts_initialize_pool_do_not_match() public {
- StableDebtTokenInstance stDebtToken = test_new_StableDebtToken_implementation();
- ConfiguratorInputTypes.InitReserveInput memory listing = (
- _generateListingInput(1, report, poolAdmin)
- )[0];
-
- uint8 decimals = TestnetERC20(listing.underlyingAsset).decimals();
-
- vm.expectRevert(bytes(Errors.POOL_ADDRESSES_DO_NOT_MATCH));
-
- stDebtToken.initialize(
- IPool(makeAddr('ANY_OTHER_POOL')),
- listing.underlyingAsset,
- IAaveIncentivesController(listing.incentivesController),
- decimals,
- listing.stableDebtTokenName,
- listing.stableDebtTokenSymbol,
- listing.params
- );
- }
-
- function test_mint_stableDebt_caller_alice() public {
- StableDebtTokenInstance debtToken = test_initialize_StableDebtToken();
-
- vm.expectRevert(bytes(Errors.OPERATION_NOT_SUPPORTED));
-
- vm.prank(report.poolProxy);
- debtToken.mint(alice, alice, 0, 0);
- }
-
- function test_mint_stableDebt_caller_bob_onBehalf_alice() public {
- StableDebtTokenInstance debtToken = test_initialize_StableDebtToken();
- TestnetERC20 asset = TestnetERC20(debtToken.UNDERLYING_ASSET_ADDRESS());
- uint8 decimals = asset.decimals();
- uint256 amount = 1200 * 10 ** decimals;
-
- vm.expectEmit(address(debtToken));
- emit BorrowAllowanceDelegated(alice, bob, address(asset), amount);
-
- vm.prank(alice);
- debtToken.approveDelegation(bob, amount);
-
- vm.prank(report.poolProxy);
-
- vm.expectRevert(bytes(Errors.OPERATION_NOT_SUPPORTED));
- debtToken.mint(bob, alice, amount, 1e27);
- }
-
- function test_reverts_operation_not_supported() public {
- StableDebtTokenInstance stDebtToken = test_new_StableDebtToken_implementation();
-
- vm.expectRevert(bytes(Errors.OPERATION_NOT_SUPPORTED));
- stDebtToken.transfer(address(0), 0);
-
- vm.expectRevert(bytes(Errors.OPERATION_NOT_SUPPORTED));
- stDebtToken.allowance(address(0), address(0));
-
- vm.expectRevert(bytes(Errors.OPERATION_NOT_SUPPORTED));
- stDebtToken.approve(address(0), 0);
-
- vm.expectRevert(bytes(Errors.OPERATION_NOT_SUPPORTED));
- stDebtToken.transferFrom(address(0), address(0), 0);
-
- vm.expectRevert(bytes(Errors.OPERATION_NOT_SUPPORTED));
- stDebtToken.increaseAllowance(address(0), 0);
-
- vm.expectRevert(bytes(Errors.OPERATION_NOT_SUPPORTED));
- stDebtToken.decreaseAllowance(address(0), 0);
-
- vm.prank(report.poolProxy);
-
- vm.expectRevert(bytes(Errors.OPERATION_NOT_SUPPORTED));
- stDebtToken.mint(address(0), address(0), 0, 0);
-
- vm.prank(report.poolProxy);
-
- vm.expectRevert(bytes(Errors.OPERATION_NOT_SUPPORTED));
- stDebtToken.burn(address(0), 0);
- }
-
- function test_default_revision() public {
- StableDebtTokenInstance stDebtToken = new StableDebtTokenInstance(IPool(report.poolProxy));
- assertEq(stDebtToken._getRevision(), stDebtToken.DEBT_TOKEN_REVISION());
- }
-
- function test_getAverageStableRate() public view {
- uint256 avgStableRate = stableDebtToken.getAverageStableRate();
- assertEq(avgStableRate, 0);
- }
-
- function test_getUserLastUpdated() public view {
- uint256 lastUpdated = stableDebtToken.getUserLastUpdated(alice);
- assertEq(lastUpdated, 0);
- }
-
- function test_getUserStableRate() public view {
- uint256 userStableRate = stableDebtToken.getUserStableRate(alice);
- assertEq(userStableRate, 0);
- }
-
- function test_balanceOf() public view {
- uint256 balance = stableDebtToken.balanceOf(alice);
- assertEq(balance, 0);
- }
-
- function test_totalSupply() public view {
- uint256 scaledTotalSupply = stableDebtToken.totalSupply();
- assertEq(scaledTotalSupply, 0);
- }
-
- function test_getTotalSupplyLastUpdated() public view {
- uint256 totalSupplyLastUpdated = stableDebtToken.getTotalSupplyLastUpdated();
- assertEq(totalSupplyLastUpdated, 0);
- }
-
- function test_principalBalanceOf() public view {
- uint256 principalBalanceOf = stableDebtToken.principalBalanceOf(alice);
- assertEq(principalBalanceOf, 0);
- }
-
- function test_getTotalSupplyAndAvgRate() public view {
- (uint256 totalSupply, uint256 avgRate) = stableDebtToken.getTotalSupplyAndAvgRate();
- assertEq(totalSupply, 0);
- assertEq(avgRate, 0);
- }
-
- function test_getSupplyData() public view {
- (
- uint256 principal,
- uint256 totalSupply,
- uint256 avgStableRate,
- uint40 lastUpdatedTimestamp
- ) = stableDebtToken.getSupplyData();
-
- assertEq(principal, 0);
- assertEq(totalSupply, 0);
- assertEq(avgStableRate, 0);
- assertEq(lastUpdatedTimestamp, 0);
- }
-
- function test_delegationWithSig() public {
- uint256 amount = 120e6;
- uint256 deadline = block.timestamp + 30 days;
-
- EIP712SigUtils.CreditDelegation memory delegation = EIP712SigUtils.CreditDelegation({
- delegatee: bob,
- value: amount,
- nonce: 0,
- deadline: deadline
- });
-
- bytes32 digest = EIP712SigUtils.getCreditDelegationTypedDataHash(
- delegation,
- bytes(stableDebtToken.name()),
- bytes('1'),
- address(stableDebtToken)
- );
-
- (uint8 v, bytes32 r, bytes32 s) = vm.sign(alicePrivateKey, digest);
-
- vm.expectEmit(address(stableDebtToken));
- emit BorrowAllowanceDelegated(alice, bob, address(tokenList.usdx), amount);
-
- vm.prank(alice);
- stableDebtToken.delegationWithSig(alice, bob, amount, deadline, v, r, s);
-
- assertEq(stableDebtToken.borrowAllowance(alice, bob), amount);
- }
-
- function test_cancel_delegationWithSig() public {
- // Submit permit by Alice to Bob
- test_delegationWithSig();
-
- uint256 deadline = block.timestamp + 30 days;
-
- EIP712SigUtils.CreditDelegation memory delegation = EIP712SigUtils.CreditDelegation({
- delegatee: bob,
- value: 0,
- nonce: 1,
- deadline: deadline
- });
-
- bytes32 digest = EIP712SigUtils.getCreditDelegationTypedDataHash(
- delegation,
- bytes(stableDebtToken.name()),
- bytes('1'),
- address(stableDebtToken)
- );
-
- (uint8 v, bytes32 r, bytes32 s) = vm.sign(alicePrivateKey, digest);
-
- assertGt(
- stableDebtToken.borrowAllowance(alice, bob),
- 0,
- 'Alice borrow allowance to bob should be > 0 before cancelling the credit delegation'
- );
-
- vm.prank(alice);
- stableDebtToken.delegationWithSig(alice, bob, delegation.value, deadline, v, r, s);
-
- assertEq(
- stableDebtToken.borrowAllowance(alice, bob),
- 0,
- 'Alice allowance to bob should be zero'
- );
- assertEq(stableDebtToken.nonces(alice), 2, 'Alice nonce does not match expected nonce');
- }
-
- function test_reverts_bad_nonce_delegationWithSig() public {
- // Submit permit by Alice to Bob
- test_delegationWithSig();
-
- uint256 deadline = block.timestamp + 30 days;
-
- EIP712SigUtils.CreditDelegation memory delegation = EIP712SigUtils.CreditDelegation({
- delegatee: bob,
- value: 0,
- nonce: 0, // Wrong nonce, should be 1
- deadline: deadline
- });
-
- bytes32 digest = EIP712SigUtils.getCreditDelegationTypedDataHash(
- delegation,
- bytes(stableDebtToken.name()),
- bytes('1'),
- address(stableDebtToken)
- );
-
- (uint8 v, bytes32 r, bytes32 s) = vm.sign(alicePrivateKey, digest);
-
- vm.expectRevert(bytes(Errors.INVALID_SIGNATURE));
-
- vm.prank(alice);
- stableDebtToken.delegationWithSig(alice, bob, delegation.value, deadline, v, r, s);
- }
-
- function test_reverts_bad_expiration_delegationWithSig() public {
- uint256 amount = 120e6;
- uint256 deadline = block.timestamp + 30 days;
-
- EIP712SigUtils.CreditDelegation memory delegation = EIP712SigUtils.CreditDelegation({
- delegatee: bob,
- value: amount,
- nonce: 0,
- deadline: deadline
- });
-
- bytes32 digest = EIP712SigUtils.getCreditDelegationTypedDataHash(
- delegation,
- bytes(stableDebtToken.name()),
- bytes('1'),
- address(stableDebtToken)
- );
-
- (uint8 v, bytes32 r, bytes32 s) = vm.sign(alicePrivateKey, digest);
-
- vm.warp(delegation.deadline + 1);
- vm.expectRevert(bytes(Errors.INVALID_EXPIRATION));
-
- vm.prank(alice);
- stableDebtToken.delegationWithSig(alice, bob, amount, deadline, v, r, s);
- }
-
- function test_reverts_zero_address_delegationWithSig() public {
- uint256 amount = 120e6;
- uint256 deadline = block.timestamp + 30 days;
-
- EIP712SigUtils.CreditDelegation memory delegation = EIP712SigUtils.CreditDelegation({
- delegatee: bob,
- value: amount,
- nonce: 0,
- deadline: deadline
- });
-
- bytes32 digest = EIP712SigUtils.getCreditDelegationTypedDataHash(
- delegation,
- bytes(stableDebtToken.name()),
- bytes('1'),
- address(stableDebtToken)
- );
-
- (uint8 v, bytes32 r, bytes32 s) = vm.sign(alicePrivateKey, digest);
-
- vm.expectRevert(bytes(Errors.ZERO_ADDRESS_NOT_VALID));
-
- vm.prank(alice);
- stableDebtToken.delegationWithSig(address(0), bob, amount, deadline, v, r, s);
- }
-}
diff --git a/tests/core/ZeroInteresRateStrategy.t.sol b/tests/core/ZeroInteresRateStrategy.t.sol
deleted file mode 100644
index 0ce57a59..00000000
--- a/tests/core/ZeroInteresRateStrategy.t.sol
+++ /dev/null
@@ -1,68 +0,0 @@
-// SPDX-License-Identifier: BUSL-1.1
-pragma solidity ^0.8.0;
-
-import 'forge-std/Test.sol';
-
-import {IAToken} from 'aave-v3-core/contracts/protocol/tokenization/AToken.sol';
-import {DefaultReserveInterestRateStrategyV2, DataTypes, IPoolAddressesProvider} from 'aave-v3-core/contracts/protocol/pool/DefaultReserveInterestRateStrategyV2.sol';
-import {IDefaultInterestRateStrategyV2} from 'aave-v3-core/contracts/protocol/pool/DefaultReserveInterestRateStrategyV2.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
-
-// @dev Ignored from coverage report, due Foundry Coverage can not detect functions if they return 0.
-contract ZeroReserveInterestRateStrategyTests is TestnetProcedures {
- IAToken public aToken;
-
- function setUp() public {
- initTestEnvironment();
-
- (address aUSDX, , ) = contracts.protocolDataProvider.getReserveTokensAddresses(tokenList.usdx);
- aToken = IAToken(aUSDX);
- }
-
- function test_new_ZeroReserveInterestRateStrategy()
- public
- returns (IDefaultInterestRateStrategyV2)
- {
- IDefaultInterestRateStrategyV2 rateStrategy = new DefaultReserveInterestRateStrategyV2(
- report.poolAddressesProvider
- );
-
- assertEq(address(rateStrategy.ADDRESSES_PROVIDER()), report.poolAddressesProvider);
- assertEq(rateStrategy.getOptimalUsageRatio(tokenList.usdx), 0);
- assertEq(rateStrategy.getVariableRateSlope1(tokenList.usdx), 0);
- assertEq(rateStrategy.getVariableRateSlope2(tokenList.usdx), 0);
- assertEq(rateStrategy.getBaseVariableBorrowRate(tokenList.usdx), 0);
- assertEq(rateStrategy.getMaxVariableBorrowRate(tokenList.usdx), 0);
- return rateStrategy;
- }
-
- function test_calculate_rates() public {
- (, , , , uint256 reserveFactor, , , , , ) = contracts
- .protocolDataProvider
- .getReserveConfigurationData(tokenList.usdx);
- IDefaultInterestRateStrategyV2 rateStrategy = test_new_ZeroReserveInterestRateStrategy();
-
- DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
- unbacked: 0,
- liquidityAdded: 0,
- liquidityTaken: 0,
- totalStableDebt: 0,
- totalVariableDebt: 0,
- averageStableBorrowRate: 0,
- reserveFactor: reserveFactor,
- reserve: tokenList.usdx,
- usingVirtualBalance: true,
- virtualUnderlyingBalance: 0
- });
-
- (
- uint256 currentLiquidityRate,
- uint256 currentStableBorrowRate,
- uint256 currentVariableBorrowRate
- ) = rateStrategy.calculateInterestRates(input);
-
- assertEq(currentLiquidityRate, 0);
- assertEq(currentStableBorrowRate, 0);
- assertEq(currentVariableBorrowRate, 0);
- }
-}
diff --git a/tests/AaveV3BatchDeployment.t.sol b/tests/deployments/AaveV3BatchDeployment.t.sol
similarity index 73%
rename from tests/AaveV3BatchDeployment.t.sol
rename to tests/deployments/AaveV3BatchDeployment.t.sol
index 67f1c849..cd78c6f4 100644
--- a/tests/AaveV3BatchDeployment.t.sol
+++ b/tests/deployments/AaveV3BatchDeployment.t.sol
@@ -2,25 +2,24 @@
pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import '../src/deployments/interfaces/IMarketReportTypes.sol';
-
-import {AugustusRegistryMock} from './mocks/AugustusRegistryMock.sol';
-import {MockParaSwapFeeClaimer} from 'aave-v3-periphery/contracts/mocks/swap/MockParaSwapFeeClaimer.sol';
-import {BatchTestProcedures} from './utils/BatchTestProcedures.sol';
-import {AaveV3TestListing} from './mocks/AaveV3TestListing.sol';
-import {ACLManager} from 'aave-v3-core/contracts/protocol/configuration/ACLManager.sol';
-import {WETH9} from 'aave-v3-core/contracts/dependencies/weth/WETH9.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
-import {IAaveV3ConfigEngine} from 'aave-v3-periphery/contracts/v3-config-engine/IAaveV3ConfigEngine.sol';
-import {IPool} from 'aave-v3-core/contracts/interfaces/IPool.sol';
-import {AaveV3ConfigEngine} from 'aave-v3-periphery/contracts/v3-config-engine/AaveV3ConfigEngine.sol';
-import {SequencerOracle} from 'aave-v3-core/contracts/mocks/oracle/SequencerOracle.sol';
-import {IPoolDataProvider} from 'aave-v3-core/contracts/interfaces/IPoolDataProvider.sol';
-import {IAToken} from 'aave-v3-core/contracts/interfaces/IAToken.sol';
-import {IncentivizedERC20} from 'aave-v3-core/contracts/protocol/tokenization/base/IncentivizedERC20.sol';
-import {RewardsController} from 'aave-v3-periphery/contracts/rewards/RewardsController.sol';
-import {RewardsController} from 'aave-v3-periphery/contracts/rewards/RewardsController.sol';
-import {EmissionManager} from 'aave-v3-periphery/contracts/rewards/EmissionManager.sol';
+import '../../src/deployments/interfaces/IMarketReportTypes.sol';
+
+import {AugustusRegistryMock} from '../mocks/AugustusRegistryMock.sol';
+import {MockParaSwapFeeClaimer} from '../../src/contracts/mocks/swap/MockParaSwapFeeClaimer.sol';
+import {BatchTestProcedures} from '../utils/BatchTestProcedures.sol';
+import {AaveV3TestListing} from '../mocks/AaveV3TestListing.sol';
+import {ACLManager} from '../../src/contracts/protocol/configuration/ACLManager.sol';
+import {WETH9} from '../../src/contracts/dependencies/weth/WETH9.sol';
+import {IPoolAddressesProvider} from '../../src/contracts/interfaces/IPoolAddressesProvider.sol';
+import {IAaveV3ConfigEngine} from '../../src/contracts/extensions/v3-config-engine/IAaveV3ConfigEngine.sol';
+import {IPool} from '../../src/contracts/interfaces/IPool.sol';
+import {AaveV3ConfigEngine} from '../../src/contracts/extensions/v3-config-engine/AaveV3ConfigEngine.sol';
+import {SequencerOracle} from '../../src/contracts/mocks/oracle/SequencerOracle.sol';
+import {IPoolDataProvider} from '../../src/contracts/interfaces/IPoolDataProvider.sol';
+import {IAToken} from '../../src/contracts/interfaces/IAToken.sol';
+import {IncentivizedERC20} from '../../src/contracts/protocol/tokenization/base/IncentivizedERC20.sol';
+import {RewardsController} from '../../src/contracts/rewards/RewardsController.sol';
+import {EmissionManager} from '../../src/contracts/rewards/EmissionManager.sol';
contract AaveV3BatchDeployment is BatchTestProcedures {
address public marketOwner;
diff --git a/tests/AaveV3BatchTests.t.sol b/tests/deployments/AaveV3BatchTests.t.sol
similarity index 73%
rename from tests/AaveV3BatchTests.t.sol
rename to tests/deployments/AaveV3BatchTests.t.sol
index 2597a38f..e34ce6b2 100644
--- a/tests/AaveV3BatchTests.t.sol
+++ b/tests/deployments/AaveV3BatchTests.t.sol
@@ -2,23 +2,23 @@
pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import '../src/deployments/interfaces/IMarketReportTypes.sol';
-import {AaveV3TokensBatch} from '../src/deployments/projects/aave-v3-batched/batches/AaveV3TokensBatch.sol';
-import {AaveV3PoolBatch} from '../src/deployments/projects/aave-v3-batched/batches/AaveV3PoolBatch.sol';
-import {AaveV3L2PoolBatch} from '../src/deployments/projects/aave-v3-batched/batches/AaveV3L2PoolBatch.sol';
-import {AaveV3GettersBatchOne} from '../src/deployments/projects/aave-v3-batched/batches/AaveV3GettersBatchOne.sol';
-import {AaveV3GettersBatchTwo} from '../src/deployments/projects/aave-v3-batched/batches/AaveV3GettersBatchTwo.sol';
-import {AaveV3PeripheryBatch} from '../src/deployments/projects/aave-v3-batched/batches/AaveV3PeripheryBatch.sol';
-import {AaveV3ParaswapBatch} from '../src/deployments/projects/aave-v3-batched/batches/AaveV3ParaswapBatch.sol';
-import {AaveV3SetupBatch} from '../src/deployments/projects/aave-v3-batched/batches/AaveV3SetupBatch.sol';
-import {AaveV3MiscBatch} from '../src/deployments/projects/aave-v3-batched/batches/AaveV3MiscBatch.sol';
-import {AaveV3HelpersBatchOne} from '../src/deployments/projects/aave-v3-batched/batches/AaveV3HelpersBatchOne.sol';
-import {AaveV3HelpersBatchTwo} from '../src/deployments/projects/aave-v3-batched/batches/AaveV3HelpersBatchTwo.sol';
-import {WETH9} from 'aave-v3-core/contracts/dependencies/weth/WETH9.sol';
-import {AugustusRegistryMock} from './mocks/AugustusRegistryMock.sol';
-import {MockParaSwapFeeClaimer} from 'aave-v3-periphery/contracts/mocks/swap/MockParaSwapFeeClaimer.sol';
-import {BatchTestProcedures} from './utils/BatchTestProcedures.sol';
-import {AaveV3BatchOrchestration} from '../src/deployments/projects/aave-v3-batched/AaveV3BatchOrchestration.sol';
+import '../../src/deployments/interfaces/IMarketReportTypes.sol';
+import {AaveV3TokensBatch} from '../../src/deployments/projects/aave-v3-batched/batches/AaveV3TokensBatch.sol';
+import {AaveV3PoolBatch} from '../../src/deployments/projects/aave-v3-batched/batches/AaveV3PoolBatch.sol';
+import {AaveV3L2PoolBatch} from '../../src/deployments/projects/aave-v3-batched/batches/AaveV3L2PoolBatch.sol';
+import {AaveV3GettersBatchOne} from '../../src/deployments/projects/aave-v3-batched/batches/AaveV3GettersBatchOne.sol';
+import {AaveV3GettersBatchTwo} from '../../src/deployments/projects/aave-v3-batched/batches/AaveV3GettersBatchTwo.sol';
+import {AaveV3PeripheryBatch} from '../../src/deployments/projects/aave-v3-batched/batches/AaveV3PeripheryBatch.sol';
+import {AaveV3ParaswapBatch} from '../../src/deployments/projects/aave-v3-batched/batches/AaveV3ParaswapBatch.sol';
+import {AaveV3SetupBatch} from '../../src/deployments/projects/aave-v3-batched/batches/AaveV3SetupBatch.sol';
+import {AaveV3MiscBatch} from '../../src/deployments/projects/aave-v3-batched/batches/AaveV3MiscBatch.sol';
+import {AaveV3HelpersBatchOne} from '../../src/deployments/projects/aave-v3-batched/batches/AaveV3HelpersBatchOne.sol';
+import {AaveV3HelpersBatchTwo} from '../../src/deployments/projects/aave-v3-batched/batches/AaveV3HelpersBatchTwo.sol';
+import {WETH9} from '../../src/contracts/dependencies/weth/WETH9.sol';
+import {AugustusRegistryMock} from '../mocks/AugustusRegistryMock.sol';
+import {MockParaSwapFeeClaimer} from '../../src/contracts/mocks/swap/MockParaSwapFeeClaimer.sol';
+import {BatchTestProcedures} from '../utils/BatchTestProcedures.sol';
+import {AaveV3BatchOrchestration} from '../../src/deployments/projects/aave-v3-batched/AaveV3BatchOrchestration.sol';
contract AaveV3BatchTests is BatchTestProcedures {
address deployer;
@@ -199,8 +199,7 @@ contract AaveV3BatchTests is BatchTestProcedures {
setupReportTwo.rewardsControllerProxy,
peripheryReportOne.treasury,
tokensReport.aToken,
- tokensReport.variableDebtToken,
- tokensReport.stableDebtToken
+ tokensReport.variableDebtToken
);
}
diff --git a/tests/AaveV3PermissionsTest.t.sol b/tests/deployments/AaveV3PermissionsTest.t.sol
similarity index 92%
rename from tests/AaveV3PermissionsTest.t.sol
rename to tests/deployments/AaveV3PermissionsTest.t.sol
index d5408b68..4c0c92bb 100644
--- a/tests/AaveV3PermissionsTest.t.sol
+++ b/tests/deployments/AaveV3PermissionsTest.t.sol
@@ -2,17 +2,17 @@
pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {Ownable} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/Ownable.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
-import '../src/deployments/interfaces/IMarketReportTypes.sol';
-import {ACLManager} from 'aave-v3-core/contracts/protocol/configuration/ACLManager.sol';
-import {RewardsController} from 'aave-v3-periphery/contracts/rewards/RewardsController.sol';
-import {EmissionManager} from 'aave-v3-periphery/contracts/rewards/EmissionManager.sol';
-import {AugustusRegistryMock} from './mocks/AugustusRegistryMock.sol';
-import {MockParaSwapFeeClaimer} from '../src/periphery/contracts/mocks/swap/MockParaSwapFeeClaimer.sol';
-import {WETH9} from 'aave-v3-core/contracts/dependencies/weth/WETH9.sol';
-import {BatchTestProcedures} from './utils/BatchTestProcedures.sol';
-import {IRevenueSplitter} from 'aave-v3-periphery/contracts/treasury/IRevenueSplitter.sol';
+import {Ownable} from '../../src/contracts/dependencies/openzeppelin/contracts/Ownable.sol';
+import {IPoolAddressesProvider} from '../../src/contracts/interfaces/IPoolAddressesProvider.sol';
+import '../../src/deployments/interfaces/IMarketReportTypes.sol';
+import {ACLManager} from '../../src/contracts/protocol/configuration/ACLManager.sol';
+import {RewardsController} from '../../src/contracts/rewards/RewardsController.sol';
+import {EmissionManager} from '../../src/contracts/rewards/EmissionManager.sol';
+import {AugustusRegistryMock} from '../mocks/AugustusRegistryMock.sol';
+import {MockParaSwapFeeClaimer} from '../../src/contracts/mocks/swap/MockParaSwapFeeClaimer.sol';
+import {WETH9} from '../../src/contracts/dependencies/weth/WETH9.sol';
+import {BatchTestProcedures} from '../utils/BatchTestProcedures.sol';
+import {IRevenueSplitter} from '../../src/contracts/treasury/IRevenueSplitter.sol';
contract AaveV3PermissionsTest is BatchTestProcedures {
/**
diff --git a/tests/DeploymentsGasLimits.t.sol b/tests/deployments/DeploymentsGasLimits.t.sol
similarity index 81%
rename from tests/DeploymentsGasLimits.t.sol
rename to tests/deployments/DeploymentsGasLimits.t.sol
index 54d32c73..bbcc6ed8 100644
--- a/tests/DeploymentsGasLimits.t.sol
+++ b/tests/deployments/DeploymentsGasLimits.t.sol
@@ -2,23 +2,23 @@
pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import '../src/deployments/interfaces/IMarketReportTypes.sol';
-import {AaveV3TokensBatch} from '../src/deployments/projects/aave-v3-batched/batches/AaveV3TokensBatch.sol';
-import {AaveV3PoolBatch} from '../src/deployments/projects/aave-v3-batched/batches/AaveV3PoolBatch.sol';
-import {AaveV3L2PoolBatch} from '../src/deployments/projects/aave-v3-batched/batches/AaveV3L2PoolBatch.sol';
-import {AaveV3GettersBatchOne} from '../src/deployments/projects/aave-v3-batched/batches/AaveV3GettersBatchOne.sol';
-import {AaveV3GettersBatchTwo} from '../src/deployments/projects/aave-v3-batched/batches/AaveV3GettersBatchTwo.sol';
-import {AaveV3PeripheryBatch} from '../src/deployments/projects/aave-v3-batched/batches/AaveV3PeripheryBatch.sol';
-import {AaveV3ParaswapBatch} from '../src/deployments/projects/aave-v3-batched/batches/AaveV3ParaswapBatch.sol';
-import {AaveV3SetupBatch} from '../src/deployments/projects/aave-v3-batched/batches/AaveV3SetupBatch.sol';
-import {AaveV3MiscBatch} from '../src/deployments/projects/aave-v3-batched/batches/AaveV3MiscBatch.sol';
-import {AaveV3HelpersBatchOne} from '../src/deployments/projects/aave-v3-batched/batches/AaveV3HelpersBatchOne.sol';
-import {AaveV3HelpersBatchTwo} from '../src/deployments/projects/aave-v3-batched/batches/AaveV3HelpersBatchTwo.sol';
-import {WETH9} from 'aave-v3-core/contracts/dependencies/weth/WETH9.sol';
-import {AugustusRegistryMock} from './mocks/AugustusRegistryMock.sol';
-import {MockParaSwapFeeClaimer} from 'aave-v3-periphery/contracts/mocks/swap/MockParaSwapFeeClaimer.sol';
-import {SequencerOracle} from '../src/core/contracts/mocks/oracle/SequencerOracle.sol';
-import {BatchTestProcedures} from './utils/BatchTestProcedures.sol';
+import '../../src/deployments/interfaces/IMarketReportTypes.sol';
+import {AaveV3TokensBatch} from '../../src/deployments/projects/aave-v3-batched/batches/AaveV3TokensBatch.sol';
+import {AaveV3PoolBatch} from '../../src/deployments/projects/aave-v3-batched/batches/AaveV3PoolBatch.sol';
+import {AaveV3L2PoolBatch} from '../../src/deployments/projects/aave-v3-batched/batches/AaveV3L2PoolBatch.sol';
+import {AaveV3GettersBatchOne} from '../../src/deployments/projects/aave-v3-batched/batches/AaveV3GettersBatchOne.sol';
+import {AaveV3GettersBatchTwo} from '../../src/deployments/projects/aave-v3-batched/batches/AaveV3GettersBatchTwo.sol';
+import {AaveV3PeripheryBatch} from '../../src/deployments/projects/aave-v3-batched/batches/AaveV3PeripheryBatch.sol';
+import {AaveV3ParaswapBatch} from '../../src/deployments/projects/aave-v3-batched/batches/AaveV3ParaswapBatch.sol';
+import {AaveV3SetupBatch} from '../../src/deployments/projects/aave-v3-batched/batches/AaveV3SetupBatch.sol';
+import {AaveV3MiscBatch} from '../../src/deployments/projects/aave-v3-batched/batches/AaveV3MiscBatch.sol';
+import {AaveV3HelpersBatchOne} from '../../src/deployments/projects/aave-v3-batched/batches/AaveV3HelpersBatchOne.sol';
+import {AaveV3HelpersBatchTwo} from '../../src/deployments/projects/aave-v3-batched/batches/AaveV3HelpersBatchTwo.sol';
+import {WETH9} from '../../src/contracts/dependencies/weth/WETH9.sol';
+import {AugustusRegistryMock} from '../mocks/AugustusRegistryMock.sol';
+import {MockParaSwapFeeClaimer} from '../../src/contracts/mocks/swap/MockParaSwapFeeClaimer.sol';
+import {SequencerOracle} from '../../src/contracts/mocks/oracle/SequencerOracle.sol';
+import {BatchTestProcedures} from '../utils/BatchTestProcedures.sol';
contract DeploymentsGasLimits is BatchTestProcedures {
Roles roles;
@@ -184,8 +184,7 @@ contract DeploymentsGasLimits is BatchTestProcedures {
setupReportTwo.rewardsControllerProxy,
peripheryReportOne.treasury,
tokensReport.aToken,
- tokensReport.variableDebtToken,
- tokensReport.stableDebtToken
+ tokensReport.variableDebtToken
);
}
diff --git a/tests/periphery/RevenueSplitter.t.sol b/tests/extensions/RevenueSplitter.t.sol
similarity index 96%
rename from tests/periphery/RevenueSplitter.t.sol
rename to tests/extensions/RevenueSplitter.t.sol
index dee06a36..20e9f560 100644
--- a/tests/periphery/RevenueSplitter.t.sol
+++ b/tests/extensions/RevenueSplitter.t.sol
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;
-import {PercentageMath} from 'aave-v3-core/contracts/protocol/libraries/math/PercentageMath.sol';
-import {RevenueSplitter} from 'aave-v3-periphery/contracts/treasury/RevenueSplitter.sol';
-import {IRevenueSplitterErrors} from 'aave-v3-periphery/contracts/treasury/IRevenueSplitter.sol';
-import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
+import {PercentageMath} from '../../src/contracts/protocol/libraries/math/PercentageMath.sol';
+import {RevenueSplitter} from '../../src/contracts/treasury/RevenueSplitter.sol';
+import {IRevenueSplitterErrors} from '../../src/contracts/treasury/IRevenueSplitter.sol';
+import {IERC20} from '../../src/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
import 'forge-std/Test.sol';
import 'forge-std/console2.sol';
import 'forge-std/StdUtils.sol';
diff --git a/tests/periphery/ParaswapAdapters.t.sol b/tests/extensions/paraswap-adapters/ParaswapAdapters.t.sol
similarity index 95%
rename from tests/periphery/ParaswapAdapters.t.sol
rename to tests/extensions/paraswap-adapters/ParaswapAdapters.t.sol
index 56017b0e..42674e83 100644
--- a/tests/periphery/ParaswapAdapters.t.sol
+++ b/tests/extensions/paraswap-adapters/ParaswapAdapters.t.sol
@@ -1,22 +1,20 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
-import 'forge-std/Test.sol';
-
-import {ParaSwapLiquiditySwapAdapter, IParaSwapAugustus} from 'aave-v3-periphery/contracts/adapters/paraswap/ParaSwapLiquiditySwapAdapter.sol';
-import {ParaSwapRepayAdapter, IParaSwapAugustusRegistry} from 'aave-v3-periphery/contracts/adapters/paraswap/ParaSwapRepayAdapter.sol';
-import {ParaSwapWithdrawSwapAdapter} from 'aave-v3-periphery/contracts/adapters/paraswap/ParaSwapWithdrawSwapAdapter.sol';
-import {AaveParaSwapFeeClaimer, IERC20} from 'aave-v3-periphery/contracts/adapters/paraswap/AaveParaSwapFeeClaimer.sol';
-import {BaseParaSwapAdapter} from 'aave-v3-periphery/contracts/adapters/paraswap/BaseParaSwapAdapter.sol';
-import {IPool, DataTypes} from 'aave-v3-core/contracts/interfaces/IPool.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
-import {MockParaSwapAugustus} from 'aave-v3-periphery/contracts/mocks/swap/MockParaSwapAugustus.sol';
-import {MockParaSwapFeeClaimer} from 'aave-v3-periphery/contracts/mocks/swap/MockParaSwapFeeClaimer.sol';
-import {MockParaSwapAugustusRegistry} from 'aave-v3-periphery/contracts/mocks/swap/MockParaSwapAugustusRegistry.sol';
-import {IERC20Detailed} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol';
-import {TestnetERC20} from 'aave-v3-periphery/contracts/mocks/testnet-helpers/TestnetERC20.sol';
-import {EIP712SigUtils} from '../utils/EIP712SigUtils.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
+import {ParaSwapLiquiditySwapAdapter, IParaSwapAugustus} from '../../../src/contracts/extensions/paraswap-adapters/ParaSwapLiquiditySwapAdapter.sol';
+import {ParaSwapRepayAdapter, IParaSwapAugustusRegistry} from '../../../src/contracts/extensions/paraswap-adapters/ParaSwapRepayAdapter.sol';
+import {ParaSwapWithdrawSwapAdapter} from '../../../src/contracts/extensions/paraswap-adapters/ParaSwapWithdrawSwapAdapter.sol';
+import {AaveParaSwapFeeClaimer, IERC20} from '../../../src/contracts/extensions/paraswap-adapters/AaveParaSwapFeeClaimer.sol';
+import {BaseParaSwapAdapter} from '../../../src/contracts/extensions/paraswap-adapters/BaseParaSwapAdapter.sol';
+import {IPool, DataTypes} from '../../../src/contracts/interfaces/IPool.sol';
+import {IPoolAddressesProvider} from '../../../src/contracts/interfaces/IPoolAddressesProvider.sol';
+import {MockParaSwapAugustus} from '../../../src/contracts/mocks/swap/MockParaSwapAugustus.sol';
+import {MockParaSwapFeeClaimer} from '../../../src/contracts/mocks/swap/MockParaSwapFeeClaimer.sol';
+import {MockParaSwapAugustusRegistry} from '../../../src/contracts/mocks/swap/MockParaSwapAugustusRegistry.sol';
+import {IERC20Detailed} from '../../../src/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol';
+import {TestnetERC20} from '../../../src/contracts/mocks/testnet-helpers/TestnetERC20.sol';
+import {EIP712SigUtils} from '../../utils/EIP712SigUtils.sol';
+import {TestnetProcedures} from '../../utils/TestnetProcedures.sol';
contract ParaswapAdaptersTest is TestnetProcedures {
MockParaSwapAugustus internal mockParaSwapAugustus;
diff --git a/tests/periphery/static-a-token/ERC20AaveLMUpgradable.t.sol b/tests/extensions/static-a-token/ERC20AaveLMUpgradable.t.sol
similarity index 95%
rename from tests/periphery/static-a-token/ERC20AaveLMUpgradable.t.sol
rename to tests/extensions/static-a-token/ERC20AaveLMUpgradable.t.sol
index f831be23..bcc552f8 100644
--- a/tests/periphery/static-a-token/ERC20AaveLMUpgradable.t.sol
+++ b/tests/extensions/static-a-token/ERC20AaveLMUpgradable.t.sol
@@ -4,12 +4,12 @@ pragma solidity ^0.8.10;
import {IERC20Errors} from 'openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol';
import {IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol';
import {TestnetProcedures, TestnetERC20} from '../../utils/TestnetProcedures.sol';
-import {ERC20AaveLMUpgradeable, IERC20AaveLM} from '../../../src/periphery/contracts/static-a-token/ERC20AaveLMUpgradeable.sol';
-import {IRewardsController} from '../../../src/periphery/contracts/rewards/interfaces/IRewardsController.sol';
-import {PullRewardsTransferStrategy, ITransferStrategyBase} from '../../../src/periphery/contracts/rewards/transfer-strategies/PullRewardsTransferStrategy.sol';
-import {RewardsDataTypes} from '../../../src/periphery/contracts/rewards/libraries/RewardsDataTypes.sol';
-import {IEACAggregatorProxy} from '../../../src/periphery/contracts/misc/interfaces/IEACAggregatorProxy.sol';
-import {DataTypes} from '../../../src/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
+import {ERC20AaveLMUpgradeable, IERC20AaveLM} from '../../../src/contracts/extensions/static-a-token/ERC20AaveLMUpgradeable.sol';
+import {IRewardsController} from '../../../src/contracts/rewards/interfaces/IRewardsController.sol';
+import {PullRewardsTransferStrategy, ITransferStrategyBase} from '../../../src/contracts/rewards/transfer-strategies/PullRewardsTransferStrategy.sol';
+import {RewardsDataTypes} from '../../../src/contracts/rewards/libraries/RewardsDataTypes.sol';
+import {IEACAggregatorProxy} from '../../../src/contracts/helpers/interfaces/IEACAggregatorProxy.sol';
+import {DataTypes} from '../../../src/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
// Minimal mock as contract is abstract
contract MockERC20AaveLMUpgradeable is ERC20AaveLMUpgradeable {
diff --git a/tests/periphery/static-a-token/ERC4626StataTokenUpgradeable.t.sol b/tests/extensions/static-a-token/ERC4626StataTokenUpgradeable.t.sol
similarity index 98%
rename from tests/periphery/static-a-token/ERC4626StataTokenUpgradeable.t.sol
rename to tests/extensions/static-a-token/ERC4626StataTokenUpgradeable.t.sol
index 47461697..fb0d0b3a 100644
--- a/tests/periphery/static-a-token/ERC4626StataTokenUpgradeable.t.sol
+++ b/tests/extensions/static-a-token/ERC4626StataTokenUpgradeable.t.sol
@@ -4,10 +4,10 @@ pragma solidity ^0.8.10;
import {IERC20Errors} from 'openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol';
import {IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol';
import {IERC20Permit} from 'openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol';
-import {IPool} from '../../../src/core/contracts/interfaces/IPool.sol';
+import {IPool} from '../../../src/contracts/interfaces/IPool.sol';
import {TestnetProcedures, TestnetERC20} from '../../utils/TestnetProcedures.sol';
-import {ERC4626Upgradeable, ERC4626StataTokenUpgradeable, IERC4626StataToken} from '../../../src/periphery/contracts/static-a-token/ERC4626StataTokenUpgradeable.sol';
-import {DataTypes} from '../../../src/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
+import {ERC4626Upgradeable, ERC4626StataTokenUpgradeable, IERC4626StataToken} from '../../../src/contracts/extensions/static-a-token/ERC4626StataTokenUpgradeable.sol';
+import {DataTypes} from '../../../src/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
import {SigUtils} from '../../utils/SigUtils.sol';
// Minimal mock as contract is abstract
diff --git a/tests/periphery/static-a-token/StataTokenV2Getters.sol b/tests/extensions/static-a-token/StataTokenV2Getters.sol
similarity index 84%
rename from tests/periphery/static-a-token/StataTokenV2Getters.sol
rename to tests/extensions/static-a-token/StataTokenV2Getters.sol
index c9a8aa1c..17d71dbf 100644
--- a/tests/periphery/static-a-token/StataTokenV2Getters.sol
+++ b/tests/extensions/static-a-token/StataTokenV2Getters.sol
@@ -3,8 +3,8 @@ pragma solidity ^0.8.10;
import {Initializable} from 'openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol';
import {IERC20Metadata, IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol';
-import {AToken} from '../../../src/core/contracts/protocol/tokenization/AToken.sol';
-import {StataTokenV2} from '../../../src/periphery/contracts/static-a-token/StataTokenV2.sol'; // TODO: change import to isolate to 4626
+import {AToken} from '../../../src/contracts/protocol/tokenization/AToken.sol';
+import {StataTokenV2} from '../../../src/contracts/extensions/static-a-token/StataTokenV2.sol'; // TODO: change import to isolate to 4626
import {BaseTest} from './TestBase.sol';
contract StataTokenV2GettersTest is BaseTest {
diff --git a/tests/periphery/static-a-token/StataTokenV2Pausable.t.sol b/tests/extensions/static-a-token/StataTokenV2Pausable.t.sol
similarity index 96%
rename from tests/periphery/static-a-token/StataTokenV2Pausable.t.sol
rename to tests/extensions/static-a-token/StataTokenV2Pausable.t.sol
index 1eccc9df..894c1eff 100644
--- a/tests/periphery/static-a-token/StataTokenV2Pausable.t.sol
+++ b/tests/extensions/static-a-token/StataTokenV2Pausable.t.sol
@@ -3,7 +3,7 @@ pragma solidity ^0.8.10;
import {PausableUpgradeable} from 'openzeppelin-contracts-upgradeable/contracts/utils/PausableUpgradeable.sol';
import {IERC20Metadata, IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol';
-import {IERC4626StataToken} from '../../../src/periphery/contracts/static-a-token/interfaces/IERC4626StataToken.sol';
+import {IERC4626StataToken} from '../../../src/contracts/extensions/static-a-token/interfaces/IERC4626StataToken.sol';
import {BaseTest} from './TestBase.sol';
contract StataTokenV2PausableTest is BaseTest {
diff --git a/tests/periphery/static-a-token/StataTokenV2Permit.sol b/tests/extensions/static-a-token/StataTokenV2Permit.sol
similarity index 100%
rename from tests/periphery/static-a-token/StataTokenV2Permit.sol
rename to tests/extensions/static-a-token/StataTokenV2Permit.sol
diff --git a/tests/periphery/static-a-token/StataTokenV2Rescuable.sol b/tests/extensions/static-a-token/StataTokenV2Rescuable.sol
similarity index 95%
rename from tests/periphery/static-a-token/StataTokenV2Rescuable.sol
rename to tests/extensions/static-a-token/StataTokenV2Rescuable.sol
index c1c89f0d..8034fd52 100644
--- a/tests/periphery/static-a-token/StataTokenV2Rescuable.sol
+++ b/tests/extensions/static-a-token/StataTokenV2Rescuable.sol
@@ -2,7 +2,7 @@
pragma solidity ^0.8.10;
import {IRescuable} from 'solidity-utils/contracts/utils/Rescuable.sol';
-import {IAToken} from '../../../src/periphery/contracts/static-a-token/StataTokenV2.sol';
+import {IAToken} from '../../../src/contracts/extensions/static-a-token/StataTokenV2.sol';
import {IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol';
import {BaseTest} from './TestBase.sol';
diff --git a/tests/periphery/static-a-token/TestBase.sol b/tests/extensions/static-a-token/TestBase.sol
similarity index 88%
rename from tests/periphery/static-a-token/TestBase.sol
rename to tests/extensions/static-a-token/TestBase.sol
index 55deaa3d..652073f7 100644
--- a/tests/periphery/static-a-token/TestBase.sol
+++ b/tests/extensions/static-a-token/TestBase.sol
@@ -4,11 +4,11 @@ pragma solidity ^0.8.10;
import {IERC20Metadata, IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol';
import {TransparentUpgradeableProxy} from 'solidity-utils/contracts/transparent-proxy/TransparentUpgradeableProxy.sol';
import {ITransparentProxyFactory} from 'solidity-utils/contracts/transparent-proxy/interfaces/ITransparentProxyFactory.sol';
-import {StataTokenFactory} from '../../../src/periphery/contracts/static-a-token/StataTokenFactory.sol';
-import {StataTokenV2} from '../../../src/periphery/contracts/static-a-token/StataTokenV2.sol';
-import {IERC20AaveLM} from '../../../src/periphery/contracts/static-a-token/interfaces/IERC20AaveLM.sol';
+import {StataTokenFactory} from '../../../src/contracts/extensions/static-a-token/StataTokenFactory.sol';
+import {StataTokenV2} from '../../../src/contracts/extensions/static-a-token/StataTokenV2.sol';
+import {IERC20AaveLM} from '../../../src/contracts/extensions/static-a-token/interfaces/IERC20AaveLM.sol';
import {TestnetProcedures, TestnetERC20} from '../../utils/TestnetProcedures.sol';
-import {DataTypes} from '../../../src/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
+import {DataTypes} from '../../../src/contracts/protocol/libraries/types/DataTypes.sol';
abstract contract BaseTest is TestnetProcedures {
address constant OWNER = address(1234);
diff --git a/tests/periphery/v3-config-engine/AaveV3ConfigEngineTest.t.sol b/tests/extensions/v3-config-engine/AaveV3ConfigEngineTest.t.sol
similarity index 91%
rename from tests/periphery/v3-config-engine/AaveV3ConfigEngineTest.t.sol
rename to tests/extensions/v3-config-engine/AaveV3ConfigEngineTest.t.sol
index e73843f7..196122fb 100644
--- a/tests/periphery/v3-config-engine/AaveV3ConfigEngineTest.t.sol
+++ b/tests/extensions/v3-config-engine/AaveV3ConfigEngineTest.t.sol
@@ -2,7 +2,7 @@
pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {IAaveV3ConfigEngine} from '../../../src/periphery/contracts/v3-config-engine/IAaveV3ConfigEngine.sol';
+import {IAaveV3ConfigEngine} from '../../../src/contracts/extensions/v3-config-engine/IAaveV3ConfigEngine.sol';
import {AaveV3MockListing} from './mocks/AaveV3MockListing.sol';
import {AaveV3MockListingCustom} from './mocks/AaveV3MockListingCustom.sol';
import {AaveV3MockCapUpdate} from './mocks/AaveV3MockCapUpdate.sol';
@@ -17,15 +17,15 @@ import {AaveV3MockEModeCategoryUpdate, AaveV3MockEModeCategoryUpdateEdgeBonus} f
import {AaveV3MockEModeCategoryUpdateNoChange} from './mocks/AaveV3MockEModeCategoryUpdateNoChange.sol';
import {AaveV3MockAssetEModeUpdate} from './mocks/AaveV3MockAssetEModeUpdate.sol';
-import {ATokenInstance} from '../../../src/core/instances/ATokenInstance.sol';
-import {StableDebtTokenInstance} from '../../../src/core/instances/StableDebtTokenInstance.sol';
-import {VariableDebtTokenInstance} from '../../../src/core/instances/VariableDebtTokenInstance.sol';
+import {ATokenInstance} from '../../../src/contracts/instances/ATokenInstance.sol';
+import {EModeConfiguration} from '../../../src/contracts/protocol/libraries/configuration/EModeConfiguration.sol';
+import {VariableDebtTokenInstance} from '../../../src/contracts/instances/VariableDebtTokenInstance.sol';
import {TestnetProcedures, AaveV3ConfigEngine} from '../../utils/TestnetProcedures.sol';
-import {TestnetERC20} from '../../../src/periphery/contracts/mocks/testnet-helpers/TestnetERC20.sol';
-import {MockAggregator} from '../../../src/core/contracts/mocks/oracle/CLAggregators/MockAggregator.sol';
+import {TestnetERC20} from '../../../src/contracts/mocks/testnet-helpers/TestnetERC20.sol';
+import {MockAggregator} from '../../../src/contracts/mocks/oracle/CLAggregators/MockAggregator.sol';
import {IPool, IPoolAddressesProvider} from '../../utils/ProtocolV3TestBase.sol';
-import {DataTypes} from '../../../src/core/contracts/protocol/libraries/types/DataTypes.sol';
-import {ProtocolV3TestBase, IDefaultInterestRateStrategyV2, ReserveConfig, ReserveTokens, DataTypes as DataTypeOld} from '../../utils/ProtocolV3TestBase.sol';
+import {DataTypes} from '../../../src/contracts/protocol/libraries/types/DataTypes.sol';
+import {ProtocolV3TestBase, IDefaultInterestRateStrategyV2, ReserveConfig, ReserveTokens} from '../../utils/ProtocolV3TestBase.sol';
contract AaveV3ConfigEngineTest is TestnetProcedures, ProtocolV3TestBase {
using stdStorage for StdStorage;
@@ -80,7 +80,6 @@ contract AaveV3ConfigEngineTest is TestnetProcedures, ProtocolV3TestBase {
underlying: asset,
aToken: address(0), // Mock, as they don't get validated, because of the "dynamic" deployment on proposal execution
variableDebtToken: address(0), // Mock, as they don't get validated, because of the "dynamic" deployment on proposal execution
- stableDebtToken: address(0), // Mock, as they don't get validated, because of the "dynamic" deployment on proposal execution
decimals: 18,
ltv: 82_50,
liquidationThreshold: 86_00,
@@ -90,7 +89,6 @@ contract AaveV3ConfigEngineTest is TestnetProcedures, ProtocolV3TestBase {
usageAsCollateralEnabled: true,
borrowingEnabled: true,
interestRateStrategy: AaveV3ConfigEngine(configEngine).DEFAULT_INTEREST_RATE_STRATEGY(),
- stableBorrowRateEnabled: false,
isPaused: false,
isActive: true,
isFrozen: false,
@@ -100,7 +98,6 @@ contract AaveV3ConfigEngineTest is TestnetProcedures, ProtocolV3TestBase {
supplyCap: 85_000,
borrowCap: 60_000,
debtCeiling: 0,
- eModeCategory: 0,
virtualAccActive: true,
virtualBalance: 0,
aTokenUnderlyingBalance: 0
@@ -114,7 +111,6 @@ contract AaveV3ConfigEngineTest is TestnetProcedures, ProtocolV3TestBase {
_findReserveConfigBySymbol(allConfigsAfter, '1INCH'),
ReserveTokens({
aToken: address(contracts.aToken),
- stableDebtToken: address(contracts.stableDebtToken),
variableDebtToken: address(contracts.variableDebtToken)
})
);
@@ -150,15 +146,13 @@ contract AaveV3ConfigEngineTest is TestnetProcedures, ProtocolV3TestBase {
address feed = address(new MockAggregator(int256(15e8)));
address aTokenImpl = address(new ATokenInstance(contracts.poolProxy));
address vTokenImpl = address(new VariableDebtTokenInstance(contracts.poolProxy));
- address sTokenImpl = address(new StableDebtTokenInstance(contracts.poolProxy));
AaveV3MockListingCustom payload = new AaveV3MockListingCustom(
asset,
feed,
configEngine,
aTokenImpl,
- vTokenImpl,
- sTokenImpl
+ vTokenImpl
);
vm.prank(roleList.marketOwner);
@@ -183,7 +177,6 @@ contract AaveV3ConfigEngineTest is TestnetProcedures, ProtocolV3TestBase {
underlying: asset,
aToken: address(0), // Mock, as they don't get validated, because of the "dynamic" deployment on proposal execution
variableDebtToken: address(0), // Mock, as they don't get validated, because of the "dynamic" deployment on proposal execution
- stableDebtToken: address(0), // Mock, as they don't get validated, because of the "dynamic" deployment on proposal execution
decimals: 18,
ltv: 82_50,
liquidationThreshold: 86_00,
@@ -193,7 +186,6 @@ contract AaveV3ConfigEngineTest is TestnetProcedures, ProtocolV3TestBase {
usageAsCollateralEnabled: true,
borrowingEnabled: true,
interestRateStrategy: AaveV3ConfigEngine(configEngine).DEFAULT_INTEREST_RATE_STRATEGY(),
- stableBorrowRateEnabled: false,
isPaused: false,
isActive: true,
isFrozen: false,
@@ -203,7 +195,6 @@ contract AaveV3ConfigEngineTest is TestnetProcedures, ProtocolV3TestBase {
supplyCap: 85_000,
borrowCap: 60_000,
debtCeiling: 0,
- eModeCategory: 0,
virtualAccActive: true,
virtualBalance: 0,
aTokenUnderlyingBalance: 0
@@ -215,11 +206,7 @@ contract AaveV3ConfigEngineTest is TestnetProcedures, ProtocolV3TestBase {
_validateReserveTokensImpls(
_findReserveConfigBySymbol(allConfigsAfter, 'PSP'),
- ReserveTokens({
- aToken: aTokenImpl,
- stableDebtToken: sTokenImpl,
- variableDebtToken: vTokenImpl
- })
+ ReserveTokens({aToken: aTokenImpl, variableDebtToken: vTokenImpl})
);
_validateAssetSourceOnOracle(
@@ -550,11 +537,10 @@ contract AaveV3ConfigEngineTest is TestnetProcedures, ProtocolV3TestBase {
diffReports('preTestEngineEModeCategoryUpdate', 'postTestEngineEModeCategoryUpdate');
- DataTypeOld.EModeCategory memory prevEmodeCategoryData;
+ DataTypes.EModeCategory memory prevEmodeCategoryData;
prevEmodeCategoryData.ltv = 97_40;
prevEmodeCategoryData.liquidationThreshold = 97_60;
prevEmodeCategoryData.liquidationBonus = 101_50; // 100_00 + 1_50
- prevEmodeCategoryData.priceSource = address(0);
prevEmodeCategoryData.label = 'ETH Correlated';
_validateEmodeCategory(
@@ -582,7 +568,7 @@ contract AaveV3ConfigEngineTest is TestnetProcedures, ProtocolV3TestBase {
configEngine
);
- DataTypes.EModeCategory memory eModeCategoryDataBefore = contracts
+ DataTypes.EModeCategoryLegacy memory eModeCategoryDataBefore = contracts
.poolProxy
.getEModeCategoryData(1);
@@ -595,7 +581,7 @@ contract AaveV3ConfigEngineTest is TestnetProcedures, ProtocolV3TestBase {
eModeCategoryDataBefore.ltv,
eModeCategoryDataBefore.liquidationThreshold,
eModeCategoryDataBefore.liquidationBonus,
- eModeCategoryDataBefore.priceSource,
+ address(0),
eModeCategoryDataBefore.label
);
payload.execute();
@@ -607,7 +593,7 @@ contract AaveV3ConfigEngineTest is TestnetProcedures, ProtocolV3TestBase {
configEngine
);
- DataTypes.EModeCategory memory eModeCategoryDataBefore = contracts
+ DataTypes.EModeCategoryLegacy memory eModeCategoryDataBefore = contracts
.poolProxy
.getEModeCategoryData(1);
@@ -628,11 +614,10 @@ contract AaveV3ConfigEngineTest is TestnetProcedures, ProtocolV3TestBase {
diffReports('preTestEngineEModeCategoryNoChange', 'postTestEngineEModeCategoryNoChange');
- DataTypeOld.EModeCategory memory prevEmodeCategoryData;
+ DataTypes.EModeCategory memory prevEmodeCategoryData;
prevEmodeCategoryData.ltv = eModeCategoryDataBefore.ltv;
prevEmodeCategoryData.liquidationThreshold = eModeCategoryDataBefore.liquidationThreshold;
prevEmodeCategoryData.liquidationBonus = eModeCategoryDataBefore.liquidationBonus;
- prevEmodeCategoryData.priceSource = eModeCategoryDataBefore.priceSource;
prevEmodeCategoryData.label = eModeCategoryDataBefore.label;
_validateEmodeCategory(
@@ -644,11 +629,16 @@ contract AaveV3ConfigEngineTest is TestnetProcedures, ProtocolV3TestBase {
function testAssetEModeUpdates() public {
address asset = tokenList.usdx;
+ address asset2 = tokenList.wbtc;
AaveV3MockEModeCategoryUpdate payloadToAddEMode = new AaveV3MockEModeCategoryUpdate(
configEngine
);
- AaveV3MockAssetEModeUpdate payload = new AaveV3MockAssetEModeUpdate(asset, configEngine);
+ AaveV3MockAssetEModeUpdate payload = new AaveV3MockAssetEModeUpdate(
+ asset,
+ asset2,
+ configEngine
+ );
vm.startPrank(roleList.marketOwner);
contracts.aclManager.addPoolAdmin(address(payload));
@@ -671,6 +661,22 @@ contract AaveV3ConfigEngineTest is TestnetProcedures, ProtocolV3TestBase {
diffReports('preTestEngineAssetEModeUpdate', 'postTestEngineAssetEModeUpdate');
- assertEq(contracts.protocolDataProvider.getReserveEModeCategory(asset), 1);
+ DataTypes.ReserveDataLegacy memory reserveData = contracts.poolProxy.getReserveData(asset);
+ uint128 collateralBitmap = contracts.poolProxy.getEModeCategoryCollateralBitmap(1);
+ uint128 borrowableBitmap = contracts.poolProxy.getEModeCategoryBorrowableBitmap(1);
+ assertEq(EModeConfiguration.isReserveEnabledOnBitmap(collateralBitmap, reserveData.id), false);
+ assertEq(EModeConfiguration.isReserveEnabledOnBitmap(borrowableBitmap, reserveData.id), true);
+
+ DataTypes.ReserveDataLegacy memory reserveDataAsset2 = contracts.poolProxy.getReserveData(
+ asset2
+ );
+ assertEq(
+ EModeConfiguration.isReserveEnabledOnBitmap(collateralBitmap, reserveDataAsset2.id),
+ true
+ );
+ assertEq(
+ EModeConfiguration.isReserveEnabledOnBitmap(borrowableBitmap, reserveDataAsset2.id),
+ false
+ );
}
}
diff --git a/tests/periphery/v3-config-engine/mocks/AaveV3MockAssetEModeUpdate.sol b/tests/extensions/v3-config-engine/mocks/AaveV3MockAssetEModeUpdate.sol
similarity index 51%
rename from tests/periphery/v3-config-engine/mocks/AaveV3MockAssetEModeUpdate.sol
rename to tests/extensions/v3-config-engine/mocks/AaveV3MockAssetEModeUpdate.sol
index c92bb35a..96220fc0 100644
--- a/tests/periphery/v3-config-engine/mocks/AaveV3MockAssetEModeUpdate.sol
+++ b/tests/extensions/v3-config-engine/mocks/AaveV3MockAssetEModeUpdate.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
-import '../../../../src/periphery/contracts/v3-config-engine/AaveV3Payload.sol';
+import '../../../../src/contracts/extensions/v3-config-engine/AaveV3Payload.sol';
/**
* @dev Smart contract for a mock asset e-mode update, for testing purposes
@@ -10,15 +10,32 @@ import '../../../../src/periphery/contracts/v3-config-engine/AaveV3Payload.sol';
*/
contract AaveV3MockAssetEModeUpdate is AaveV3Payload {
address public immutable ASSET_ADDRESS;
+ address public immutable ASSET_2_ADDRESS;
- constructor(address assetAddress, address customEngine) AaveV3Payload(IEngine(customEngine)) {
+ constructor(
+ address assetAddress,
+ address asset2Address,
+ address customEngine
+ ) AaveV3Payload(IEngine(customEngine)) {
ASSET_ADDRESS = assetAddress;
+ ASSET_2_ADDRESS = asset2Address;
}
function assetsEModeUpdates() public view override returns (IEngine.AssetEModeUpdate[] memory) {
- IEngine.AssetEModeUpdate[] memory eModeUpdate = new IEngine.AssetEModeUpdate[](1);
+ IEngine.AssetEModeUpdate[] memory eModeUpdate = new IEngine.AssetEModeUpdate[](2);
- eModeUpdate[0] = IEngine.AssetEModeUpdate({asset: ASSET_ADDRESS, eModeCategory: 1});
+ eModeUpdate[0] = IEngine.AssetEModeUpdate({
+ asset: ASSET_ADDRESS,
+ eModeCategory: 1,
+ collateral: EngineFlags.DISABLED,
+ borrowable: EngineFlags.ENABLED
+ });
+ eModeUpdate[1] = IEngine.AssetEModeUpdate({
+ asset: ASSET_2_ADDRESS,
+ eModeCategory: 1,
+ collateral: EngineFlags.ENABLED,
+ borrowable: EngineFlags.KEEP_CURRENT
+ });
return eModeUpdate;
}
diff --git a/tests/periphery/v3-config-engine/mocks/AaveV3MockBorrowUpdate.sol b/tests/extensions/v3-config-engine/mocks/AaveV3MockBorrowUpdate.sol
similarity index 90%
rename from tests/periphery/v3-config-engine/mocks/AaveV3MockBorrowUpdate.sol
rename to tests/extensions/v3-config-engine/mocks/AaveV3MockBorrowUpdate.sol
index 9ddd3883..95679686 100644
--- a/tests/periphery/v3-config-engine/mocks/AaveV3MockBorrowUpdate.sol
+++ b/tests/extensions/v3-config-engine/mocks/AaveV3MockBorrowUpdate.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
-import '../../../../src/periphery/contracts/v3-config-engine/AaveV3Payload.sol';
+import '../../../../src/contracts/extensions/v3-config-engine/AaveV3Payload.sol';
/**
* @dev Smart contract for a mock borrow update, to be able to test
@@ -23,7 +23,6 @@ contract AaveV3MockBorrowUpdate is AaveV3Payload {
asset: ASSET_ADDRESS,
enabledToBorrow: EngineFlags.ENABLED,
flashloanable: EngineFlags.DISABLED,
- stableRateModeEnabled: EngineFlags.KEEP_CURRENT,
borrowableInIsolation: EngineFlags.KEEP_CURRENT,
withSiloedBorrowing: EngineFlags.KEEP_CURRENT,
reserveFactor: 15_00
diff --git a/tests/periphery/v3-config-engine/mocks/AaveV3MockBorrowUpdateNoChange.sol b/tests/extensions/v3-config-engine/mocks/AaveV3MockBorrowUpdateNoChange.sol
similarity index 89%
rename from tests/periphery/v3-config-engine/mocks/AaveV3MockBorrowUpdateNoChange.sol
rename to tests/extensions/v3-config-engine/mocks/AaveV3MockBorrowUpdateNoChange.sol
index f2dc7c34..6121bea7 100644
--- a/tests/periphery/v3-config-engine/mocks/AaveV3MockBorrowUpdateNoChange.sol
+++ b/tests/extensions/v3-config-engine/mocks/AaveV3MockBorrowUpdateNoChange.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
-import '../../../../src/periphery/contracts/v3-config-engine/AaveV3Payload.sol';
+import '../../../../src/contracts/extensions/v3-config-engine/AaveV3Payload.sol';
/**
* @dev Smart contract for a mock borrow update with no change, to be able to test
@@ -21,7 +21,6 @@ contract AaveV3MockBorrowUpdateNoChange is AaveV3Payload {
asset: ASSET_ADDRESS,
enabledToBorrow: EngineFlags.KEEP_CURRENT,
flashloanable: EngineFlags.KEEP_CURRENT,
- stableRateModeEnabled: EngineFlags.KEEP_CURRENT,
borrowableInIsolation: EngineFlags.KEEP_CURRENT,
withSiloedBorrowing: EngineFlags.KEEP_CURRENT,
reserveFactor: EngineFlags.KEEP_CURRENT
diff --git a/tests/periphery/v3-config-engine/mocks/AaveV3MockCapUpdate.sol b/tests/extensions/v3-config-engine/mocks/AaveV3MockCapUpdate.sol
similarity index 92%
rename from tests/periphery/v3-config-engine/mocks/AaveV3MockCapUpdate.sol
rename to tests/extensions/v3-config-engine/mocks/AaveV3MockCapUpdate.sol
index faa17850..7575fa20 100644
--- a/tests/periphery/v3-config-engine/mocks/AaveV3MockCapUpdate.sol
+++ b/tests/extensions/v3-config-engine/mocks/AaveV3MockCapUpdate.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
-import '../../../../src/periphery/contracts/v3-config-engine/AaveV3Payload.sol';
+import '../../../../src/contracts/extensions/v3-config-engine/AaveV3Payload.sol';
/**
* @dev Smart contract for a mock caps update, for testing purposes
diff --git a/tests/periphery/v3-config-engine/mocks/AaveV3MockCollateralUpdate.sol b/tests/extensions/v3-config-engine/mocks/AaveV3MockCollateralUpdate.sol
similarity index 93%
rename from tests/periphery/v3-config-engine/mocks/AaveV3MockCollateralUpdate.sol
rename to tests/extensions/v3-config-engine/mocks/AaveV3MockCollateralUpdate.sol
index 0a409ace..70e38f1e 100644
--- a/tests/periphery/v3-config-engine/mocks/AaveV3MockCollateralUpdate.sol
+++ b/tests/extensions/v3-config-engine/mocks/AaveV3MockCollateralUpdate.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
-import '../../../../src/periphery/contracts/v3-config-engine/AaveV3Payload.sol';
+import '../../../../src/contracts/extensions/v3-config-engine/AaveV3Payload.sol';
/**
* @dev Smart contract for a mock collateral update, for testing purposes
diff --git a/tests/periphery/v3-config-engine/mocks/AaveV3MockCollateralUpdateNoChange.sol b/tests/extensions/v3-config-engine/mocks/AaveV3MockCollateralUpdateNoChange.sol
similarity index 93%
rename from tests/periphery/v3-config-engine/mocks/AaveV3MockCollateralUpdateNoChange.sol
rename to tests/extensions/v3-config-engine/mocks/AaveV3MockCollateralUpdateNoChange.sol
index a70285f4..12c9221f 100644
--- a/tests/periphery/v3-config-engine/mocks/AaveV3MockCollateralUpdateNoChange.sol
+++ b/tests/extensions/v3-config-engine/mocks/AaveV3MockCollateralUpdateNoChange.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
-import '../../../../src/periphery/contracts/v3-config-engine/AaveV3Payload.sol';
+import '../../../../src/contracts/extensions/v3-config-engine/AaveV3Payload.sol';
/**
* @dev Smart contract for a mock collateral update with no changes, for testing purposes
diff --git a/tests/periphery/v3-config-engine/mocks/AaveV3MockCollateralUpdateWrongBonus.sol b/tests/extensions/v3-config-engine/mocks/AaveV3MockCollateralUpdateWrongBonus.sol
similarity index 96%
rename from tests/periphery/v3-config-engine/mocks/AaveV3MockCollateralUpdateWrongBonus.sol
rename to tests/extensions/v3-config-engine/mocks/AaveV3MockCollateralUpdateWrongBonus.sol
index 50727042..b41f26d5 100644
--- a/tests/periphery/v3-config-engine/mocks/AaveV3MockCollateralUpdateWrongBonus.sol
+++ b/tests/extensions/v3-config-engine/mocks/AaveV3MockCollateralUpdateWrongBonus.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
-import '../../../../src/periphery/contracts/v3-config-engine/AaveV3Payload.sol';
+import '../../../../src/contracts/extensions/v3-config-engine/AaveV3Payload.sol';
/**
* @dev Smart contracts for a mock collateral update, with wrong LT/LB ratio
diff --git a/tests/periphery/v3-config-engine/mocks/AaveV3MockEModeCategoryUpdate.sol b/tests/extensions/v3-config-engine/mocks/AaveV3MockEModeCategoryUpdate.sol
similarity index 92%
rename from tests/periphery/v3-config-engine/mocks/AaveV3MockEModeCategoryUpdate.sol
rename to tests/extensions/v3-config-engine/mocks/AaveV3MockEModeCategoryUpdate.sol
index 63a540a3..19bf1ebb 100644
--- a/tests/periphery/v3-config-engine/mocks/AaveV3MockEModeCategoryUpdate.sol
+++ b/tests/extensions/v3-config-engine/mocks/AaveV3MockEModeCategoryUpdate.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
-import '../../../../src/periphery/contracts/v3-config-engine/AaveV3Payload.sol';
+import '../../../../src/contracts/extensions/v3-config-engine/AaveV3Payload.sol';
/**
* @dev Smart contract for a mock emode category update, to be able to test
@@ -25,7 +25,6 @@ contract AaveV3MockEModeCategoryUpdate is AaveV3Payload {
ltv: 97_40,
liqThreshold: 97_60,
liqBonus: 1_50,
- priceSource: address(0),
label: 'ETH Correlated'
});
@@ -59,7 +58,6 @@ contract AaveV3MockEModeCategoryUpdateEdgeBonus is AaveV3Payload {
ltv: 97_40,
liqThreshold: 97_60,
liqBonus: 2_50,
- priceSource: EngineFlags.KEEP_CURRENT_ADDRESS,
label: EngineFlags.KEEP_CURRENT_STRING
});
diff --git a/tests/periphery/v3-config-engine/mocks/AaveV3MockEModeCategoryUpdateNoChange.sol b/tests/extensions/v3-config-engine/mocks/AaveV3MockEModeCategoryUpdateNoChange.sol
similarity index 89%
rename from tests/periphery/v3-config-engine/mocks/AaveV3MockEModeCategoryUpdateNoChange.sol
rename to tests/extensions/v3-config-engine/mocks/AaveV3MockEModeCategoryUpdateNoChange.sol
index a3bbc237..0aa0c983 100644
--- a/tests/periphery/v3-config-engine/mocks/AaveV3MockEModeCategoryUpdateNoChange.sol
+++ b/tests/extensions/v3-config-engine/mocks/AaveV3MockEModeCategoryUpdateNoChange.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
-import '../../../../src/periphery/contracts/v3-config-engine/AaveV3Payload.sol';
+import '../../../../src/contracts/extensions/v3-config-engine/AaveV3Payload.sol';
/**
* @dev Smart contract for a mock e-mode category update with no changes, for testing purposes
@@ -24,7 +24,6 @@ contract AaveV3MockEModeCategoryUpdateNoChange is AaveV3Payload {
ltv: EngineFlags.KEEP_CURRENT,
liqThreshold: EngineFlags.KEEP_CURRENT,
liqBonus: EngineFlags.KEEP_CURRENT,
- priceSource: EngineFlags.KEEP_CURRENT_ADDRESS,
label: EngineFlags.KEEP_CURRENT_STRING
});
diff --git a/tests/periphery/v3-config-engine/mocks/AaveV3MockListing.sol b/tests/extensions/v3-config-engine/mocks/AaveV3MockListing.sol
similarity index 90%
rename from tests/periphery/v3-config-engine/mocks/AaveV3MockListing.sol
rename to tests/extensions/v3-config-engine/mocks/AaveV3MockListing.sol
index 576e3248..9d28030a 100644
--- a/tests/periphery/v3-config-engine/mocks/AaveV3MockListing.sol
+++ b/tests/extensions/v3-config-engine/mocks/AaveV3MockListing.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
-import '../../../../src/periphery/contracts/v3-config-engine/AaveV3Payload.sol';
+import '../../../../src/contracts/extensions/v3-config-engine/AaveV3Payload.sol';
/**
* @dev Smart contract for a mock listing, to be able to test without having a v3 instance on Local
@@ -36,7 +36,6 @@ contract AaveV3MockListing is AaveV3Payload {
variableRateSlope2: 75_00
}),
enabledToBorrow: EngineFlags.ENABLED,
- stableRateModeEnabled: EngineFlags.DISABLED,
borrowableInIsolation: EngineFlags.DISABLED,
withSiloedBorrowing: EngineFlags.DISABLED,
flashloanable: EngineFlags.DISABLED,
@@ -47,8 +46,7 @@ contract AaveV3MockListing is AaveV3Payload {
supplyCap: 85_000,
borrowCap: 60_000,
debtCeiling: 0,
- liqProtocolFee: 10_00,
- eModeCategory: 0
+ liqProtocolFee: 10_00
});
return listings;
diff --git a/tests/periphery/v3-config-engine/mocks/AaveV3MockListingCustom.sol b/tests/extensions/v3-config-engine/mocks/AaveV3MockListingCustom.sol
similarity index 81%
rename from tests/periphery/v3-config-engine/mocks/AaveV3MockListingCustom.sol
rename to tests/extensions/v3-config-engine/mocks/AaveV3MockListingCustom.sol
index 6eb3981f..4b7d6383 100644
--- a/tests/periphery/v3-config-engine/mocks/AaveV3MockListingCustom.sol
+++ b/tests/extensions/v3-config-engine/mocks/AaveV3MockListingCustom.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
-import '../../../../src/periphery/contracts/v3-config-engine/AaveV3Payload.sol';
+import '../../../../src/contracts/extensions/v3-config-engine/AaveV3Payload.sol';
/**
* @dev Smart contract for a mock custom listing update, for testing purposes
@@ -14,21 +14,18 @@ contract AaveV3MockListingCustom is AaveV3Payload {
address public immutable A_TOKEN_IMPL;
address public immutable V_TOKEN_IMPL;
- address public immutable S_TOKEN_IMPL;
constructor(
address assetAddress,
address assetFeed,
address customEngine,
address aTokenImpl,
- address vTokenImpl,
- address sTokenImpl
+ address vTokenImpl
) AaveV3Payload(IEngine(customEngine)) {
ASSET_ADDRESS = assetAddress;
ASSET_FEED = assetFeed;
A_TOKEN_IMPL = aTokenImpl;
V_TOKEN_IMPL = vTokenImpl;
- S_TOKEN_IMPL = sTokenImpl;
}
function newListingsCustom()
@@ -51,7 +48,6 @@ contract AaveV3MockListingCustom is AaveV3Payload {
variableRateSlope2: 75_00
}),
enabledToBorrow: EngineFlags.ENABLED,
- stableRateModeEnabled: EngineFlags.DISABLED,
borrowableInIsolation: EngineFlags.DISABLED,
withSiloedBorrowing: EngineFlags.DISABLED,
flashloanable: EngineFlags.DISABLED,
@@ -62,14 +58,9 @@ contract AaveV3MockListingCustom is AaveV3Payload {
supplyCap: 85_000,
borrowCap: 60_000,
debtCeiling: 0,
- liqProtocolFee: 10_00,
- eModeCategory: 0
+ liqProtocolFee: 10_00
}),
- IEngine.TokenImplementations({
- aToken: A_TOKEN_IMPL,
- vToken: V_TOKEN_IMPL,
- sToken: S_TOKEN_IMPL
- })
+ IEngine.TokenImplementations({aToken: A_TOKEN_IMPL, vToken: V_TOKEN_IMPL})
);
return listingsCustom;
diff --git a/tests/periphery/v3-config-engine/mocks/AaveV3MockPriceFeedUpdate.sol b/tests/extensions/v3-config-engine/mocks/AaveV3MockPriceFeedUpdate.sol
similarity index 93%
rename from tests/periphery/v3-config-engine/mocks/AaveV3MockPriceFeedUpdate.sol
rename to tests/extensions/v3-config-engine/mocks/AaveV3MockPriceFeedUpdate.sol
index 45997e59..0b5bd8b1 100644
--- a/tests/periphery/v3-config-engine/mocks/AaveV3MockPriceFeedUpdate.sol
+++ b/tests/extensions/v3-config-engine/mocks/AaveV3MockPriceFeedUpdate.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
-import '../../../../src/periphery/contracts/v3-config-engine/AaveV3Payload.sol';
+import '../../../../src/contracts/extensions/v3-config-engine/AaveV3Payload.sol';
/**
* @dev Smart contract for a mock price feed update, to be able to test
diff --git a/tests/periphery/v3-config-engine/mocks/AaveV3MockRatesUpdate.sol b/tests/extensions/v3-config-engine/mocks/AaveV3MockRatesUpdate.sol
similarity index 93%
rename from tests/periphery/v3-config-engine/mocks/AaveV3MockRatesUpdate.sol
rename to tests/extensions/v3-config-engine/mocks/AaveV3MockRatesUpdate.sol
index a4444058..42214ccc 100644
--- a/tests/periphery/v3-config-engine/mocks/AaveV3MockRatesUpdate.sol
+++ b/tests/extensions/v3-config-engine/mocks/AaveV3MockRatesUpdate.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
-import '../../../../src/periphery/contracts/v3-config-engine/AaveV3Payload.sol';
+import '../../../../src/contracts/extensions/v3-config-engine/AaveV3Payload.sol';
/**
* @dev Smart contract for a mock rate strategy params update, for testing purposes
diff --git a/tests/harness/StableDebtToken.sol b/tests/harness/StableDebtToken.sol
deleted file mode 100644
index c841b9ef..00000000
--- a/tests/harness/StableDebtToken.sol
+++ /dev/null
@@ -1,12 +0,0 @@
-// SPDX-License-Identifier: BUSL-1.1
-pragma solidity ^0.8.0;
-
-import {StableDebtTokenInstance, IPool} from 'aave-v3-core/instances/StableDebtTokenInstance.sol';
-
-contract StableDebtTokenHarness is StableDebtTokenInstance {
- constructor(IPool pool) StableDebtTokenInstance(pool) {}
-
- function _getRevision() public pure returns (uint256) {
- return super.getRevision();
- }
-}
diff --git a/tests/harness/VariableDebtToken.sol b/tests/harness/VariableDebtToken.sol
index 2ca73a61..73815d97 100644
--- a/tests/harness/VariableDebtToken.sol
+++ b/tests/harness/VariableDebtToken.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
-import {VariableDebtTokenInstance, IPool} from 'aave-v3-core/instances/VariableDebtTokenInstance.sol';
+import {VariableDebtTokenInstance, IPool} from '../../src/contracts/instances/VariableDebtTokenInstance.sol';
contract VariableDebtTokenHarness is VariableDebtTokenInstance {
constructor(IPool pool) VariableDebtTokenInstance(pool) {}
diff --git a/tests/periphery/WrappedTokenGateway.t.sol b/tests/helpers/WrappedTokenGateway.t.sol
similarity index 90%
rename from tests/periphery/WrappedTokenGateway.t.sol
rename to tests/helpers/WrappedTokenGateway.t.sol
index 4b97b910..a311dd73 100644
--- a/tests/periphery/WrappedTokenGateway.t.sol
+++ b/tests/helpers/WrappedTokenGateway.t.sol
@@ -2,13 +2,12 @@
pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {AaveOracle} from 'aave-v3-core/contracts/misc/AaveOracle.sol';
-import {WrappedTokenGatewayV3} from 'aave-v3-periphery/contracts/misc/WrappedTokenGatewayV3.sol';
-import {AaveProtocolDataProvider} from 'aave-v3-core/contracts/misc/AaveProtocolDataProvider.sol';
-import {AToken} from 'aave-v3-core/contracts/protocol/tokenization/AToken.sol';
-import {StableDebtToken} from 'aave-v3-core/contracts/protocol/tokenization/StableDebtToken.sol';
-import {VariableDebtToken} from 'aave-v3-core/contracts/protocol/tokenization/VariableDebtToken.sol';
-import {DataTypes} from 'aave-v3-core/contracts/protocol/libraries/types/DataTypes.sol';
+import {AaveOracle} from '../../src/contracts/misc/AaveOracle.sol';
+import {WrappedTokenGatewayV3} from '../../src/contracts/helpers/WrappedTokenGatewayV3.sol';
+import {AaveProtocolDataProvider} from '../../src/contracts/helpers/AaveProtocolDataProvider.sol';
+import {AToken} from '../../src/contracts/protocol/tokenization/AToken.sol';
+import {VariableDebtToken} from '../../src/contracts/protocol/tokenization/VariableDebtToken.sol';
+import {DataTypes} from '../../src/contracts/protocol/libraries/types/DataTypes.sol';
import {EIP712SigUtils} from '../utils/EIP712SigUtils.sol';
import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
@@ -46,10 +45,8 @@ contract WrappedTokenGatewayTests is TestnetProcedures {
WrappedTokenGatewayV3 internal wrappedTokenGatewayV3;
AToken internal aWEth;
- StableDebtToken internal wEthStableDebtToken;
VariableDebtToken internal wEthVariableDebtToken;
AToken internal aUsdx;
- StableDebtToken internal usdxStableDebtToken;
VariableDebtToken internal usdxVariableDebtToken;
uint256 internal depositSize = 5e18;
uint256 internal usdxSize = 10000e18;
@@ -68,17 +65,15 @@ contract WrappedTokenGatewayTests is TestnetProcedures {
);
wrappedTokenGatewayV3 = WrappedTokenGatewayV3(payable(report.wrappedTokenGateway));
contracts.protocolDataProvider = AaveProtocolDataProvider(report.protocolDataProvider);
- (address aWEthAddr, address wEthStableDebt, address wEthVariableDebt) = contracts
+ (address aWEthAddr, , address wEthVariableDebt) = contracts
.protocolDataProvider
.getReserveTokensAddresses(tokenList.weth);
aWEth = AToken(aWEthAddr);
- wEthStableDebtToken = StableDebtToken(wEthStableDebt);
wEthVariableDebtToken = VariableDebtToken(wEthVariableDebt);
- (address aUsdxAddr, address usdxStableDebt, address usdxVariableDebt) = contracts
+ (address aUsdxAddr, , address usdxVariableDebt) = contracts
.protocolDataProvider
.getReserveTokensAddresses(tokenList.usdx);
aUsdx = AToken(aUsdxAddr);
- usdxStableDebtToken = StableDebtToken(usdxStableDebt);
usdxVariableDebtToken = VariableDebtToken(usdxVariableDebt);
}
@@ -305,7 +300,6 @@ contract WrappedTokenGatewayTests is TestnetProcedures {
wrappedTokenGatewayV3.repayETH{value: partialRepayment}(
report.poolProxy,
partialRepayment,
- 2,
bob
);
@@ -318,12 +312,7 @@ contract WrappedTokenGatewayTests is TestnetProcedures {
vm.expectEmit(address(contracts.poolProxy));
emit Repay(tokenList.weth, bob, address(wrappedTokenGatewayV3), partialRepayment, false);
// Full repayment
- wrappedTokenGatewayV3.repayETH{value: partialRepayment}(
- report.poolProxy,
- type(uint).max,
- 2,
- bob
- );
+ wrappedTokenGatewayV3.repayETH{value: partialRepayment}(report.poolProxy, type(uint).max, bob);
assertEq(wEthVariableDebtToken.balanceOf(bob), 0, 'The users debt should be 0');
@@ -380,7 +369,6 @@ contract WrappedTokenGatewayTests is TestnetProcedures {
wrappedTokenGatewayV3.repayETH{value: partialRepayment + 1}(
report.poolProxy,
partialRepayment,
- 2,
bob
);
@@ -393,12 +381,7 @@ contract WrappedTokenGatewayTests is TestnetProcedures {
vm.expectEmit(address(contracts.poolProxy));
emit Repay(tokenList.weth, bob, address(wrappedTokenGatewayV3), partialRepayment, false);
// Full repayment
- wrappedTokenGatewayV3.repayETH{value: partialRepayment}(
- report.poolProxy,
- type(uint).max,
- 2,
- bob
- );
+ wrappedTokenGatewayV3.repayETH{value: partialRepayment}(report.poolProxy, type(uint).max, bob);
}
function test_borrowDelegateApprove_repay() public {
@@ -410,7 +393,7 @@ contract WrappedTokenGatewayTests is TestnetProcedures {
wEthVariableDebtToken.approveDelegation(address(wrappedTokenGatewayV3), borrowSize);
- wrappedTokenGatewayV3.borrowETH(address(contracts.poolProxy), borrowSize, 2, 0);
+ wrappedTokenGatewayV3.borrowETH(address(contracts.poolProxy), borrowSize, 0);
assertEq(
wEthVariableDebtToken.balanceOf(alice),
@@ -419,7 +402,7 @@ contract WrappedTokenGatewayTests is TestnetProcedures {
);
// Full repayment
- wrappedTokenGatewayV3.repayETH{value: borrowSize}(report.poolProxy, type(uint).max, 2, alice);
+ wrappedTokenGatewayV3.repayETH{value: borrowSize}(report.poolProxy, type(uint).max, alice);
vm.stopPrank();
assertEq(wEthVariableDebtToken.balanceOf(alice), 0, 'The users debt should be 0');
diff --git a/tests/core/AaveOracle.t.sol b/tests/misc/AaveOracle.t.sol
similarity index 95%
rename from tests/core/AaveOracle.t.sol
rename to tests/misc/AaveOracle.t.sol
index 2bbd361f..3ec7335a 100644
--- a/tests/core/AaveOracle.t.sol
+++ b/tests/misc/AaveOracle.t.sol
@@ -3,11 +3,11 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {MintableERC20} from 'aave-v3-core/contracts/mocks/tokens/MintableERC20.sol';
-import {MockAggregator} from 'aave-v3-core/contracts/mocks/oracle/CLAggregators/MockAggregator.sol';
+import {MintableERC20} from '../../src/contracts/mocks/tokens/MintableERC20.sol';
+import {MockAggregator} from '../../src/contracts/mocks/oracle/CLAggregators/MockAggregator.sol';
import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
-import {PriceOracle} from 'aave-v3-core/contracts/mocks/oracle/PriceOracle.sol';
+import {Errors} from '../../src/contracts/protocol/libraries/helpers/Errors.sol';
+import {PriceOracle} from '../../src/contracts/mocks/oracle/PriceOracle.sol';
contract AaveOracleTest is TestnetProcedures {
function setUp() public {
diff --git a/tests/core/PriceOracleSentinel.t.sol b/tests/misc/PriceOracleSentinel.t.sol
similarity index 89%
rename from tests/core/PriceOracleSentinel.t.sol
rename to tests/misc/PriceOracleSentinel.t.sol
index ae4c0418..2ca5313b 100644
--- a/tests/core/PriceOracleSentinel.t.sol
+++ b/tests/misc/PriceOracleSentinel.t.sol
@@ -3,11 +3,11 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
-import {PriceOracleSentinel} from 'aave-v3-core/contracts/protocol/configuration/PriceOracleSentinel.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
-import {ACLManager} from 'aave-v3-core/contracts/protocol/configuration/ACLManager.sol';
-import {SequencerOracle, ISequencerOracle} from 'aave-v3-core/contracts/mocks/oracle/SequencerOracle.sol';
+import {Errors} from '../../src/contracts/protocol/libraries/helpers/Errors.sol';
+import {PriceOracleSentinel} from '../../src/contracts/misc/PriceOracleSentinel.sol';
+import {IPoolAddressesProvider} from '../../src/contracts/interfaces/IPoolAddressesProvider.sol';
+import {ACLManager} from '../../src/contracts/protocol/configuration/ACLManager.sol';
+import {SequencerOracle, ISequencerOracle} from '../../src/contracts/mocks/oracle/SequencerOracle.sol';
import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
contract PriceOracleSentinelTest is TestnetProcedures {
diff --git a/tests/core/InitializableImmutableAdminUpgradeabilityProxy.t.sol b/tests/misc/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.t.sol
similarity index 96%
rename from tests/core/InitializableImmutableAdminUpgradeabilityProxy.t.sol
rename to tests/misc/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.t.sol
index 4740633c..e308ab05 100644
--- a/tests/core/InitializableImmutableAdminUpgradeabilityProxy.t.sol
+++ b/tests/misc/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.t.sol
@@ -3,9 +3,9 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {SlotParser} from '../utils/SlotParser.sol';
-import {MockInitializableImple, MockInitializableImpleV2} from 'aave-v3-core/contracts/mocks/upgradeability/MockInitializableImplementation.sol';
-import 'aave-v3-core/contracts/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol';
+import {SlotParser} from '../../utils/SlotParser.sol';
+import {MockInitializableImple, MockInitializableImpleV2} from '../../../src/contracts/mocks/upgradeability/MockInitializableImplementation.sol';
+import '../../../src/contracts/misc/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol';
contract InitializableImmutableAdminUpgradeabilityProxyTests is Test {
using stdStorage for StdStorage;
diff --git a/tests/misc/rates/RateStrategy.calculateRates.t.sol b/tests/misc/rates/RateStrategy.calculateRates.t.sol
new file mode 100644
index 00000000..75d0ff90
--- /dev/null
+++ b/tests/misc/rates/RateStrategy.calculateRates.t.sol
@@ -0,0 +1,484 @@
+// SPDX-License-Identifier: BUSL-1.1
+pragma solidity ^0.8.0;
+
+import './RateStrategy.template.sol';
+
+contract RateStrategyCalculateRatesTests is RateStrategyBase {
+ using WadRayMath for uint256;
+ using PercentageMath for uint256;
+
+ //----------------------------------------------------------------------------------------------------
+ // Test Calculate Rates with specific conditions
+ //----------------------------------------------------------------------------------------------------
+ function test_calculate_rates_80_percent_usage()
+ public
+ setRateParams(
+ IDefaultInterestRateStrategyV2.InterestRateData({
+ optimalUsageRatio: uint16(80_00),
+ baseVariableBorrowRate: uint32(1_00),
+ variableRateSlope1: uint32(4_00),
+ variableRateSlope2: uint32(60_00)
+ }),
+ tokenList.usdx
+ )
+ {
+ DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
+ unbacked: 0,
+ liquidityAdded: 0,
+ liquidityTaken: 0,
+ totalDebt: 800000000000000000,
+ reserveFactor: reserveFactor,
+ reserve: tokenList.usdx,
+ usingVirtualBalance: true,
+ virtualUnderlyingBalance: 200000000000000000
+ });
+ (params.currentLiquidityRate, params.currentVariableBorrowRate) = rateStrategy
+ .calculateInterestRates(input);
+
+ uint256 expectedVariableRate = rateStrategy.getBaseVariableBorrowRate(tokenList.usdx) +
+ rateStrategy.getVariableRateSlope1(tokenList.usdx);
+
+ assertEq(
+ params.currentLiquidityRate,
+ expectedVariableRate.percentMul(8000).percentMul(100_00 - input.reserveFactor),
+ 'Invalid liquidity rate'
+ );
+ assertEq(params.currentVariableBorrowRate, expectedVariableRate, 'Invalid variable rate');
+ }
+
+ function test_calculate_rates_100_percent_usage()
+ public
+ setRateParams(
+ IDefaultInterestRateStrategyV2.InterestRateData({
+ optimalUsageRatio: uint16(80_00),
+ baseVariableBorrowRate: uint32(1_00),
+ variableRateSlope1: uint32(4_00),
+ variableRateSlope2: uint32(60_00)
+ }),
+ tokenList.usdx
+ )
+ {
+ DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
+ unbacked: 0,
+ liquidityAdded: 0,
+ liquidityTaken: 0,
+ totalDebt: 1000000000000000000,
+ reserveFactor: reserveFactor,
+ reserve: tokenList.usdx,
+ usingVirtualBalance: true,
+ virtualUnderlyingBalance: 0
+ });
+
+ (uint256 currentLiquidityRate, uint256 currentVariableBorrowRate) = rateStrategy
+ .calculateInterestRates(input);
+
+ uint256 expectedVariableRate = rateStrategy.getBaseVariableBorrowRate(tokenList.usdx) +
+ rateStrategy.getVariableRateSlope1(tokenList.usdx) +
+ rateStrategy.getVariableRateSlope2(tokenList.usdx);
+
+ assertEq(
+ currentLiquidityRate,
+ expectedVariableRate.percentMul(100_00 - input.reserveFactor),
+ 'Invalid liquidity rate'
+ );
+ assertEq(currentVariableBorrowRate, expectedVariableRate, 'Invalid variable rate');
+ }
+
+ function test_calculate_rates_80_percent_usage_and_50_percent_supply_usage_due_minted_tokens()
+ public
+ setRateParams(
+ IDefaultInterestRateStrategyV2.InterestRateData({
+ optimalUsageRatio: uint16(80_00),
+ baseVariableBorrowRate: uint32(1_00),
+ variableRateSlope1: uint32(4_00),
+ variableRateSlope2: uint32(60_00)
+ }),
+ tokenList.usdx
+ )
+ {
+ DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
+ unbacked: 600000000000000000,
+ liquidityAdded: 0,
+ liquidityTaken: 0,
+ totalDebt: 800000000000000000,
+ reserveFactor: reserveFactor,
+ reserve: tokenList.usdx,
+ usingVirtualBalance: true,
+ virtualUnderlyingBalance: 200000000000000000
+ });
+
+ (uint256 currentLiquidityRate, uint256 currentVariableBorrowRate) = rateStrategy
+ .calculateInterestRates(input);
+
+ uint256 expectedVariableRate = rateStrategy.getBaseVariableBorrowRate(tokenList.usdx) +
+ rateStrategy.getVariableRateSlope1(tokenList.usdx);
+
+ assertEq(
+ currentLiquidityRate,
+ expectedVariableRate.percentMul(5000).percentMul(100_00 - input.reserveFactor),
+ 'Invalid liquidity rate'
+ );
+
+ assertEq(currentVariableBorrowRate, expectedVariableRate, 'Invalid variable rate');
+ }
+
+ function test_calculate_rates_80_percent_usage_and_80_bps_supply_usage_due_minted_tokens()
+ public
+ setRateParams(
+ IDefaultInterestRateStrategyV2.InterestRateData({
+ optimalUsageRatio: uint16(80_00),
+ baseVariableBorrowRate: uint32(1_00),
+ variableRateSlope1: uint32(4_00),
+ variableRateSlope2: uint32(60_00)
+ }),
+ tokenList.usdx
+ )
+ {
+ DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
+ unbacked: 800000000000000000 * 124 - 200000000000000000,
+ liquidityAdded: 0,
+ liquidityTaken: 0,
+ totalDebt: 800000000000000000,
+ reserveFactor: reserveFactor,
+ reserve: tokenList.usdx,
+ usingVirtualBalance: true,
+ virtualUnderlyingBalance: 200000000000000000
+ });
+
+ (uint256 currentLiquidityRate, uint256 currentVariableBorrowRate) = rateStrategy
+ .calculateInterestRates(input);
+
+ uint256 expectedVariableRate = rateStrategy.getBaseVariableBorrowRate(tokenList.usdx) +
+ rateStrategy.getVariableRateSlope1(tokenList.usdx);
+
+ assertEq(
+ currentLiquidityRate,
+ expectedVariableRate.percentMul(80).percentMul(100_00 - input.reserveFactor),
+ 'Invalid liquidity rate'
+ );
+
+ assertEq(currentVariableBorrowRate, expectedVariableRate, 'Invalid variable rate');
+ }
+
+ function test_calculate_rates_80_bps_usage()
+ public
+ setRateParams(
+ IDefaultInterestRateStrategyV2.InterestRateData({
+ optimalUsageRatio: uint16(80_00),
+ baseVariableBorrowRate: uint32(1_00),
+ variableRateSlope1: uint32(4_00),
+ variableRateSlope2: uint32(60_00)
+ }),
+ tokenList.usdx
+ )
+ {
+ DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
+ unbacked: 0,
+ liquidityAdded: 0,
+ liquidityTaken: 0,
+ totalDebt: 80000000000000000000,
+ reserveFactor: reserveFactor,
+ reserve: tokenList.usdx,
+ usingVirtualBalance: true,
+ virtualUnderlyingBalance: 9920000000000000000000
+ });
+ (uint256 currentLiquidityRate, uint256 currentVariableBorrowRate) = rateStrategy
+ .calculateInterestRates(input);
+
+ uint256 usageRatio = _bpsToRay(80);
+ uint256 expectedVariableRate = rateStrategy.getBaseVariableBorrowRate(tokenList.usdx) +
+ rateStrategy.getVariableRateSlope1(tokenList.usdx).rayMul(
+ usageRatio.rayDiv(rateStrategy.getOptimalUsageRatio(tokenList.usdx))
+ );
+ assertEq(
+ currentLiquidityRate,
+ expectedVariableRate.percentMul(80).percentMul(100_00 - input.reserveFactor),
+ 'Invalid liquidity rate'
+ );
+ assertEq(currentVariableBorrowRate, expectedVariableRate, 'Invalid variable rate');
+ }
+
+ function test_fuzz_calculate_rates_80_percent_usage_added_and_virtual_equal(
+ uint256 virtualBalanceAmount
+ ) public view {
+ vm.assume(virtualBalanceAmount <= 200000000000000000);
+ uint256 liquidityAddedAmount = 200000000000000000 - virtualBalanceAmount;
+
+ // First, calculate using only virtual balance
+ DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
+ reserve: tokenList.usdx,
+ unbacked: 0,
+ liquidityAdded: 0,
+ liquidityTaken: 0,
+ totalDebt: 800000000000000000,
+ reserveFactor: reserveFactor,
+ usingVirtualBalance: true,
+ virtualUnderlyingBalance: 200000000000000000
+ });
+
+ (uint256 currentLiquidityRateOne, uint256 currentVariableBorrowRateOne) = rateStrategy
+ .calculateInterestRates(input);
+
+ // Second, calculate using the fuzzed values, totaling the same utilization
+ input = DataTypes.CalculateInterestRatesParams({
+ reserve: tokenList.usdx,
+ unbacked: 0,
+ liquidityAdded: liquidityAddedAmount,
+ liquidityTaken: 0,
+ totalDebt: 800000000000000000,
+ reserveFactor: reserveFactor,
+ usingVirtualBalance: true,
+ virtualUnderlyingBalance: virtualBalanceAmount
+ });
+
+ (uint256 currentLiquidityRateTwo, uint256 currentVariableBorrowRateTwo) = rateStrategy
+ .calculateInterestRates(input);
+
+ assertEq(currentLiquidityRateOne, currentLiquidityRateTwo, 'Invalid liquidity rate');
+
+ assertEq(currentVariableBorrowRateOne, currentVariableBorrowRateTwo, 'Invalid variable rate');
+
+ uint256 expectedVariableRate = rateStrategy.getBaseVariableBorrowRate(tokenList.usdx) +
+ rateStrategy.getVariableRateSlope1(tokenList.usdx);
+
+ assertEq(
+ currentLiquidityRateTwo,
+ expectedVariableRate.percentMul(8000).percentMul(100_00 - input.reserveFactor),
+ 'Invalid liquidity rate'
+ );
+
+ assertEq(currentVariableBorrowRateTwo, expectedVariableRate, 'Invalid variable rate');
+ }
+
+ //----------------------------------------------------------------------------------------------------
+ // Test Calculate Rates with FUZZING
+ //----------------------------------------------------------------------------------------------------
+ function test_calculate_rates_empty_reserve(
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateData
+ ) public setRateParams(rateData, tokenList.usdx) {
+ DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
+ unbacked: 0,
+ liquidityAdded: 0,
+ liquidityTaken: 0,
+ totalDebt: 0,
+ reserveFactor: reserveFactor,
+ reserve: tokenList.usdx,
+ usingVirtualBalance: true,
+ virtualUnderlyingBalance: 0
+ });
+
+ (uint256 currentLiquidityRate, uint256 currentVariableBorrowRate) = rateStrategy
+ .calculateInterestRates(input);
+
+ assertEq(currentLiquidityRate, 0);
+ assertEq(currentVariableBorrowRate, rateStrategy.getBaseVariableBorrowRate(tokenList.usdx));
+ }
+
+ function test_calculate_rates_when_not_using_virtual_valance(
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateData,
+ uint256 availableLiquidity,
+ uint256 virtualBalanceAmount
+ ) public setRateParams(rateData, tokenList.usdx) {
+ DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
+ unbacked: 0,
+ liquidityAdded: availableLiquidity,
+ liquidityTaken: 0,
+ totalDebt: 0,
+ reserveFactor: reserveFactor,
+ reserve: tokenList.usdx,
+ usingVirtualBalance: false,
+ virtualUnderlyingBalance: virtualBalanceAmount
+ });
+ (params.currentLiquidityRate, params.currentVariableBorrowRate) = rateStrategy
+ .calculateInterestRates(input);
+
+ assertEq(params.currentLiquidityRate, 0, 'Invalid liquidity rate');
+ assertEq(
+ params.currentVariableBorrowRate,
+ rateStrategy.getBaseVariableBorrowRate(tokenList.usdx),
+ 'Invalid variable rate'
+ );
+ }
+
+ function test_calculate_rates_when_total_debt_0(
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateData,
+ uint256 availableLiquidity,
+ uint256 virtualBalanceAmount
+ ) public setRateParams(rateData, tokenList.usdx) {
+ DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
+ unbacked: 0,
+ liquidityAdded: availableLiquidity,
+ liquidityTaken: 0,
+ totalDebt: 0,
+ reserveFactor: reserveFactor,
+ reserve: tokenList.usdx,
+ usingVirtualBalance: true,
+ virtualUnderlyingBalance: virtualBalanceAmount
+ });
+ (params.currentLiquidityRate, params.currentVariableBorrowRate) = rateStrategy
+ .calculateInterestRates(input);
+
+ assertEq(params.currentLiquidityRate, 0, 'Invalid liquidity rate');
+ assertEq(
+ params.currentVariableBorrowRate,
+ rateStrategy.getBaseVariableBorrowRate(tokenList.usdx),
+ 'Invalid variable rate'
+ );
+ }
+
+ function test_calculate_rates_below_op_usage(
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateData,
+ uint256 totalDebt,
+ uint256 availableLiquidity,
+ uint256 virtualBalanceAmount
+ ) public setRateParams(rateData, tokenList.usdx) {
+ vm.assume(totalDebt > 0);
+ vm.assume(totalDebt < availableLiquidity && availableLiquidity < 1e28);
+ vm.assume(virtualBalanceAmount < 1e28);
+ uint256 availableLiquidityPlusDebt = totalDebt + availableLiquidity + virtualBalanceAmount;
+ borrowUsageRatio = totalDebt.rayDiv(availableLiquidityPlusDebt);
+ vm.assume(borrowUsageRatio < (uint256(rateData.optimalUsageRatio) * 1e23));
+
+ DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
+ unbacked: 0,
+ liquidityAdded: availableLiquidity,
+ liquidityTaken: 0,
+ totalDebt: totalDebt,
+ reserveFactor: reserveFactor,
+ reserve: tokenList.usdx,
+ usingVirtualBalance: true,
+ virtualUnderlyingBalance: virtualBalanceAmount
+ });
+
+ (params.currentLiquidityRate, params.currentVariableBorrowRate) = rateStrategy
+ .calculateInterestRates(input);
+
+ uint256 expectedVariableRate = rateStrategy.getBaseVariableBorrowRate(tokenList.usdx) +
+ rateStrategy.getVariableRateSlope1(tokenList.usdx).rayMul(
+ borrowUsageRatio.rayDiv(rateStrategy.getOptimalUsageRatio(tokenList.usdx))
+ );
+
+ assertApproxEqAbs(
+ params.currentVariableBorrowRate,
+ expectedVariableRate,
+ 100,
+ 'Invalid variable rate'
+ );
+
+ assertApproxEqAbs(
+ params.currentLiquidityRate,
+ expectedVariableRate.rayMul(input.totalDebt.rayDiv(availableLiquidityPlusDebt)).percentMul(
+ 100_00 - input.reserveFactor
+ ),
+ 100,
+ 'Invalid liquidity rate'
+ );
+ }
+
+ function test_calculate_rates_below_op_usage_when_no_debt(
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateData,
+ uint256 availableLiquidity,
+ uint256 virtualBalanceAmount
+ ) public setRateParams(rateData, tokenList.usdx) {
+ uint256 totalDebt = 0;
+ vm.assume(totalDebt < availableLiquidity && availableLiquidity < 1e28);
+ uint256 availableLiquidityPlusDebt = totalDebt + availableLiquidity;
+ borrowUsageRatio = totalDebt.rayDiv(availableLiquidityPlusDebt);
+ vm.assume(borrowUsageRatio < (uint256(rateData.optimalUsageRatio) * 1e23));
+
+ DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
+ unbacked: 0,
+ liquidityAdded: availableLiquidity,
+ liquidityTaken: 0,
+ totalDebt: totalDebt,
+ reserveFactor: reserveFactor,
+ reserve: tokenList.usdx,
+ usingVirtualBalance: true,
+ virtualUnderlyingBalance: virtualBalanceAmount
+ });
+
+ (params.currentLiquidityRate, params.currentVariableBorrowRate) = rateStrategy
+ .calculateInterestRates(input);
+
+ uint256 expectedVariableRate = rateStrategy.getBaseVariableBorrowRate(tokenList.usdx) +
+ rateStrategy.getVariableRateSlope1(tokenList.usdx).rayMul(
+ borrowUsageRatio.rayDiv(rateStrategy.getOptimalUsageRatio(tokenList.usdx))
+ );
+
+ assertApproxEqAbs(
+ params.currentVariableBorrowRate,
+ expectedVariableRate,
+ 100,
+ 'Invalid variable rate'
+ );
+
+ assertEq(params.currentLiquidityRate, 0, 'Invalid liquidity rate');
+ }
+
+ function test_calculate_rates_above_op_usage(
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateData,
+ uint256 totalDebt,
+ uint256 availableLiquidity,
+ uint256 virtualBalanceAmount
+ ) public setRateParams(rateData, tokenList.usdx) {
+ availableLiquidity = bound(availableLiquidity, 1, 1e28);
+ totalDebt = bound(totalDebt, 1, availableLiquidity);
+ vm.assume(virtualBalanceAmount < 1e28);
+ uint256 availableLiquidityPlusDebt = totalDebt + availableLiquidity + virtualBalanceAmount;
+
+ borrowUsageRatio = totalDebt.rayDiv(availableLiquidityPlusDebt);
+ vm.assume(borrowUsageRatio > (uint256(rateData.optimalUsageRatio) * 1e23));
+
+ DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
+ unbacked: 0,
+ liquidityAdded: availableLiquidity,
+ liquidityTaken: 0,
+ totalDebt: totalDebt,
+ reserveFactor: reserveFactor,
+ reserve: tokenList.usdx,
+ usingVirtualBalance: true,
+ virtualUnderlyingBalance: virtualBalanceAmount
+ });
+
+ (params.currentLiquidityRate, params.currentVariableBorrowRate) = rateStrategy
+ .calculateInterestRates(input);
+
+ uint256 excessBorrowUsageRatio = (borrowUsageRatio -
+ rateStrategy.getOptimalUsageRatio(tokenList.usdx)).rayDiv(
+ WadRayMath.RAY - rateStrategy.getOptimalUsageRatio(tokenList.usdx)
+ );
+
+ uint256 expectedVariableRate = rateStrategy.getBaseVariableBorrowRate(tokenList.usdx) +
+ rateStrategy.getVariableRateSlope1(tokenList.usdx) +
+ rateStrategy.getVariableRateSlope2(tokenList.usdx).rayMul(excessBorrowUsageRatio);
+
+ assertEq(params.currentVariableBorrowRate, expectedVariableRate, 'Invalid variable rate');
+
+ assertEq(
+ params.currentLiquidityRate,
+ expectedVariableRate.rayMul(input.totalDebt.rayDiv(availableLiquidityPlusDebt)).percentMul(
+ 100_00 - input.reserveFactor
+ ),
+ 'Invalid liquidity rate'
+ );
+ }
+
+ function test_zero_rates_strategy_calculate_rates() public view {
+ DataTypes.CalculateInterestRatesParams memory input = DataTypes.CalculateInterestRatesParams({
+ unbacked: 10,
+ liquidityAdded: 1000,
+ liquidityTaken: 50,
+ totalDebt: 20,
+ reserveFactor: reserveFactor,
+ reserve: tokenList.wbtc,
+ usingVirtualBalance: true,
+ virtualUnderlyingBalance: 30000
+ });
+
+ (uint256 currentLiquidityRate, uint256 currentVariableBorrowRate) = rateStrategy
+ .calculateInterestRates(input);
+
+ assertEq(currentLiquidityRate, 0);
+ assertEq(currentVariableBorrowRate, 0);
+ }
+}
diff --git a/tests/misc/rates/RateStrategy.setters.t.sol b/tests/misc/rates/RateStrategy.setters.t.sol
new file mode 100644
index 00000000..ead7175e
--- /dev/null
+++ b/tests/misc/rates/RateStrategy.setters.t.sol
@@ -0,0 +1,149 @@
+// SPDX-License-Identifier: BUSL-1.1
+pragma solidity ^0.8.0;
+
+import './RateStrategy.template.sol';
+
+contract RateStrategySettersTests is RateStrategyBase {
+ using WadRayMath for uint256;
+ using PercentageMath for uint256;
+
+ // @dev we override it to test second version of setInterestRateParams later
+ function _setInterestRateParams(
+ address token,
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateData
+ ) internal virtual {
+ rateStrategy.setInterestRateParams(token, abi.encode(rateData));
+ }
+
+ //----------------------------------------------------------------------------------------------------
+ // Test Set interest Rate params Using FUZZING
+ //----------------------------------------------------------------------------------------------------
+ function test_new_SetReserveInterestRateParams_when_not_configurator(
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateData
+ ) public {
+ _validateSetRateParams(rateData);
+
+ vm.expectRevert(bytes(Errors.CALLER_NOT_POOL_CONFIGURATOR));
+ _setInterestRateParams(tokenList.usdx, rateData);
+ }
+
+ function test_new_SetReserveInterestRateParams(
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateData
+ ) public {
+ _validateSetRateParams(rateData);
+
+ vm.prank(report.poolConfiguratorProxy);
+ vm.expectEmit(true, false, false, true);
+ emit RateDataUpdate(
+ tokenList.usdx,
+ rateData.optimalUsageRatio,
+ rateData.baseVariableBorrowRate,
+ rateData.variableRateSlope1,
+ rateData.variableRateSlope2
+ );
+ _setInterestRateParams(tokenList.usdx, rateData);
+
+ assertEq(address(rateStrategy.ADDRESSES_PROVIDER()), report.poolAddressesProvider);
+ assertEq(
+ rateStrategy.getOptimalUsageRatio(tokenList.usdx),
+ uint256(rateData.optimalUsageRatio) * 1e23
+ );
+ assertEq(
+ rateStrategy.getVariableRateSlope1(tokenList.usdx),
+ uint256(rateData.variableRateSlope1) * 1e23
+ );
+ assertEq(
+ rateStrategy.getVariableRateSlope2(tokenList.usdx),
+ uint256(rateData.variableRateSlope2) * 1e23
+ );
+ assertEq(
+ rateStrategy.getBaseVariableBorrowRate(tokenList.usdx),
+ uint256(rateData.baseVariableBorrowRate) * 1e23
+ );
+ assertEq(
+ rateStrategy.getMaxVariableBorrowRate(tokenList.usdx),
+ uint256(
+ rateData.baseVariableBorrowRate + rateData.variableRateSlope1 + rateData.variableRateSlope2
+ ) * 1e23
+ );
+ }
+
+ function test_reverts_SetReserveInterestRateParams_when_reserve_0(
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateData
+ ) public {
+ _validateSetRateParams(rateData);
+
+ vm.prank(report.poolConfiguratorProxy);
+ vm.expectRevert(bytes(Errors.ZERO_ADDRESS_NOT_VALID));
+ _setInterestRateParams(address(0), rateData);
+ }
+
+ function test_reverts_SetReserveInterestRateParams_when_gt_max_op(
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateData
+ ) public {
+ vm.assume(rateData.optimalUsageRatio > rateStrategy.MAX_OPTIMAL_POINT());
+
+ vm.prank(report.poolConfiguratorProxy);
+
+ vm.expectRevert(bytes(Errors.INVALID_OPTIMAL_USAGE_RATIO));
+ _setInterestRateParams(tokenList.usdx, rateData);
+ }
+
+ function test_reverts_SetReserveInterestRateParams_when_lt_min_op(
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateData
+ ) public {
+ vm.assume(rateData.optimalUsageRatio < rateStrategy.MIN_OPTIMAL_POINT());
+
+ vm.prank(report.poolConfiguratorProxy);
+
+ vm.expectRevert(bytes(Errors.INVALID_OPTIMAL_USAGE_RATIO));
+ _setInterestRateParams(tokenList.usdx, rateData);
+ }
+
+ function test_reverts_SetReserveInterestRateParams_when_gt_maxRate(
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateData
+ ) public {
+ vm.assume(
+ rateData.optimalUsageRatio >= rateStrategy.MIN_OPTIMAL_POINT() &&
+ rateData.optimalUsageRatio <= rateStrategy.MAX_OPTIMAL_POINT()
+ );
+
+ vm.assume(rateData.variableRateSlope1 <= rateData.variableRateSlope2);
+ vm.assume(
+ uint256(rateData.baseVariableBorrowRate) +
+ uint256(rateData.variableRateSlope1) +
+ uint256(rateData.variableRateSlope2) >
+ rateStrategy.MAX_BORROW_RATE()
+ );
+
+ vm.prank(report.poolConfiguratorProxy);
+
+ vm.expectRevert(bytes(Errors.INVALID_MAX_RATE));
+ _setInterestRateParams(tokenList.usdx, rateData);
+ }
+
+ function test_reverts_SetReserveInterestRateParams_when_slope1_gt_slope2(
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateData
+ ) public {
+ vm.assume(
+ rateData.optimalUsageRatio >= rateStrategy.MIN_OPTIMAL_POINT() &&
+ rateData.optimalUsageRatio <= rateStrategy.MAX_OPTIMAL_POINT()
+ );
+
+ vm.assume(rateData.variableRateSlope1 > rateData.variableRateSlope2);
+
+ vm.prank(report.poolConfiguratorProxy);
+
+ vm.expectRevert(bytes(Errors.SLOPE_2_MUST_BE_GTE_SLOPE_1));
+ _setInterestRateParams(tokenList.usdx, rateData);
+ }
+}
+
+contract RateStrategySettersTestsOverride is RateStrategySettersTests {
+ function _setInterestRateParams(
+ address token,
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateData
+ ) internal override {
+ rateStrategy.setInterestRateParams(token, rateData);
+ }
+}
diff --git a/tests/misc/rates/RateStrategy.t.sol b/tests/misc/rates/RateStrategy.t.sol
new file mode 100644
index 00000000..1e08b19e
--- /dev/null
+++ b/tests/misc/rates/RateStrategy.t.sol
@@ -0,0 +1,278 @@
+// SPDX-License-Identifier: BUSL-1.1
+pragma solidity ^0.8.0;
+
+import './RateStrategy.template.sol';
+
+contract RateStrategyBaseTests is RateStrategyBase {
+ using WadRayMath for uint256;
+ using PercentageMath for uint256;
+
+ //----------------------------------------------------------------------------------------------------
+ // INITIALIZATION TESTS
+ //----------------------------------------------------------------------------------------------------
+ function test_initialization() public view {
+ assertEq(rateStrategy.MAX_OPTIMAL_POINT(), 99_00);
+ assertEq(rateStrategy.MIN_OPTIMAL_POINT(), 1_00);
+ assertEq(rateStrategy.MAX_BORROW_RATE(), 1000_00);
+ assertEq(address(rateStrategy.ADDRESSES_PROVIDER()), address(report.poolAddressesProvider));
+
+ assertEq(rateStrategy.getOptimalUsageRatio(tokenList.wbtc), 0);
+ assertEq(rateStrategy.getVariableRateSlope1(tokenList.wbtc), 0);
+ assertEq(rateStrategy.getVariableRateSlope2(tokenList.wbtc), 0);
+ assertEq(rateStrategy.getBaseVariableBorrowRate(tokenList.wbtc), 0);
+ assertEq(rateStrategy.getMaxVariableBorrowRate(tokenList.wbtc), 0);
+ }
+
+ function test_new_DefaultReserveInterestRateStrategy_wrong_provider() public {
+ vm.expectRevert(bytes(Errors.INVALID_ADDRESSES_PROVIDER));
+ rateStrategy = new DefaultReserveInterestRateStrategyV2(address(0));
+ }
+
+ //----------------------------------------------------------------------------------------------------
+ // Test Getters
+ //----------------------------------------------------------------------------------------------------
+ function test_getInterestRateDataRay(
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateDataToSet
+ ) public setRateParams(rateDataToSet, tokenList.usdx) {
+ IDefaultInterestRateStrategyV2.InterestRateDataRay memory rateData = rateStrategy
+ .getInterestRateData(tokenList.usdx);
+ assertEq(uint256(rateDataToSet.optimalUsageRatio) * 1e23, rateData.optimalUsageRatio);
+ assertEq(uint256(rateDataToSet.baseVariableBorrowRate) * 1e23, rateData.baseVariableBorrowRate);
+ assertEq(uint256(rateDataToSet.variableRateSlope1) * 1e23, rateData.variableRateSlope1);
+ assertEq(uint256(rateDataToSet.variableRateSlope2) * 1e23, rateData.variableRateSlope2);
+ }
+
+ function test_getInterestRateDataBps(
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateDataToSet
+ ) public setRateParams(rateDataToSet, tokenList.usdx) {
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateData = rateStrategy
+ .getInterestRateDataBps(tokenList.usdx);
+ assertEq(rateDataToSet.optimalUsageRatio, rateData.optimalUsageRatio);
+ assertEq(rateDataToSet.baseVariableBorrowRate, rateData.baseVariableBorrowRate);
+ assertEq(rateDataToSet.variableRateSlope1, rateData.variableRateSlope1);
+ assertEq(rateDataToSet.variableRateSlope2, rateData.variableRateSlope2);
+ }
+
+ function test_getMaxVariableBorrowRate(
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateDataToSet
+ ) public setRateParams(rateDataToSet, tokenList.usdx) {
+ uint256 maxVariableBorrowRate = rateStrategy.getMaxVariableBorrowRate(tokenList.usdx);
+ assertEq(
+ uint256(
+ rateDataToSet.baseVariableBorrowRate +
+ rateDataToSet.variableRateSlope1 +
+ rateDataToSet.variableRateSlope2
+ ) * 1e23,
+ maxVariableBorrowRate
+ );
+ }
+
+ function test_overflow_liquidity_rates() public {
+ vm.mockCall(
+ address(rateStrategy),
+ abi.encodeWithSelector(rateStrategy.calculateInterestRates.selector),
+ abi.encode(UINT256_MAX, 0)
+ );
+ vm.expectRevert(bytes("SafeCast: value doesn't fit in 128 bits"));
+ vm.prank(alice);
+ contracts.poolProxy.supply(tokenList.usdx, 1000e6, alice, 0);
+ }
+
+ function test_overflow_variable_rates() public {
+ vm.prank(carol);
+ contracts.poolProxy.supply(tokenList.usdx, 100_000e6, carol, 0);
+
+ vm.startPrank(alice);
+ contracts.poolProxy.supply(tokenList.wbtc, 1e8, alice, 0);
+
+ vm.mockCall(
+ address(rateStrategy),
+ abi.encodeWithSelector(rateStrategy.calculateInterestRates.selector),
+ abi.encode(0, UINT256_MAX)
+ );
+ vm.expectRevert(bytes("SafeCast: value doesn't fit in 128 bits"));
+ contracts.poolProxy.borrow(tokenList.usdx, 10e6, 2, 0, alice);
+ vm.stopPrank();
+ }
+
+ function test_new_SetReserveInterestRateParams_when_not_configurator(
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateDataToSet
+ ) public {
+ _validateSetRateParams(rateDataToSet);
+
+ vm.expectRevert(bytes(Errors.CALLER_NOT_POOL_CONFIGURATOR));
+ rateStrategy.setInterestRateParams(tokenList.usdx, abi.encode(rateDataToSet));
+ }
+
+ function test_new_SetReserveInterestRateParams_override_method(
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateDataToSet
+ ) public setRateParams(rateDataToSet, tokenList.usdx) {
+ assertEq(address(rateStrategy.ADDRESSES_PROVIDER()), report.poolAddressesProvider);
+ assertEq(
+ rateStrategy.getOptimalUsageRatio(tokenList.usdx),
+ uint256(rateDataToSet.optimalUsageRatio) * 1e23
+ );
+ assertEq(
+ rateStrategy.getVariableRateSlope1(tokenList.usdx),
+ uint256(rateDataToSet.variableRateSlope1) * 1e23
+ );
+ assertEq(
+ rateStrategy.getVariableRateSlope2(tokenList.usdx),
+ uint256(rateDataToSet.variableRateSlope2) * 1e23
+ );
+ assertEq(
+ rateStrategy.getBaseVariableBorrowRate(tokenList.usdx),
+ uint256(rateDataToSet.baseVariableBorrowRate) * 1e23
+ );
+ assertEq(
+ rateStrategy.getMaxVariableBorrowRate(tokenList.usdx),
+ uint256(
+ rateDataToSet.baseVariableBorrowRate +
+ rateDataToSet.variableRateSlope1 +
+ rateDataToSet.variableRateSlope2
+ ) * 1e23
+ );
+ }
+
+ function test_new_SetReserveInterestRateParams(
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateDataToSet
+ ) public {
+ _validateSetRateParams(rateDataToSet);
+
+ vm.prank(report.poolConfiguratorProxy);
+ vm.expectEmit(true, false, false, true);
+ emit RateDataUpdate(
+ tokenList.usdx,
+ uint256(rateDataToSet.optimalUsageRatio),
+ uint256(rateDataToSet.baseVariableBorrowRate),
+ uint256(rateDataToSet.variableRateSlope1),
+ uint256(rateDataToSet.variableRateSlope2)
+ );
+ rateStrategy.setInterestRateParams(tokenList.usdx, abi.encode(rateDataToSet));
+
+ assertEq(address(rateStrategy.ADDRESSES_PROVIDER()), report.poolAddressesProvider);
+ assertEq(
+ rateStrategy.getOptimalUsageRatio(tokenList.usdx),
+ uint256(rateDataToSet.optimalUsageRatio) * 1e23
+ );
+ assertEq(
+ rateStrategy.getVariableRateSlope1(tokenList.usdx),
+ uint256(rateDataToSet.variableRateSlope1) * 1e23
+ );
+ assertEq(
+ rateStrategy.getVariableRateSlope2(tokenList.usdx),
+ uint256(rateDataToSet.variableRateSlope2) * 1e23
+ );
+ assertEq(
+ rateStrategy.getBaseVariableBorrowRate(tokenList.usdx),
+ uint256(rateDataToSet.baseVariableBorrowRate) * 1e23
+ );
+ assertEq(
+ rateStrategy.getMaxVariableBorrowRate(tokenList.usdx),
+ uint256(
+ rateDataToSet.baseVariableBorrowRate +
+ rateDataToSet.variableRateSlope1 +
+ rateDataToSet.variableRateSlope2
+ ) * 1e23
+ );
+ }
+
+ function test_reverts_SetReserveInterestRateParams_when_reserve_0(
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateDataToSet
+ ) public {
+ vm.prank(report.poolConfiguratorProxy);
+ vm.expectRevert(bytes(Errors.ZERO_ADDRESS_NOT_VALID));
+ rateStrategy.setInterestRateParams(address(0), abi.encode(rateDataToSet));
+ // Override
+ vm.prank(report.poolConfiguratorProxy);
+ vm.expectRevert(bytes(Errors.ZERO_ADDRESS_NOT_VALID));
+ rateStrategy.setInterestRateParams(address(0), rateDataToSet);
+ }
+
+ function test_reverts_SetReserveInterestRateParams_when_gt_max_op(
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateDataToSet
+ ) public {
+ vm.assume(rateDataToSet.optimalUsageRatio > rateStrategy.MAX_OPTIMAL_POINT());
+
+ vm.prank(report.poolConfiguratorProxy);
+ vm.expectRevert(bytes(Errors.INVALID_OPTIMAL_USAGE_RATIO));
+ rateStrategy.setInterestRateParams(tokenList.usdx, abi.encode(rateDataToSet));
+
+ // Override
+ vm.prank(report.poolConfiguratorProxy);
+ vm.expectRevert(bytes(Errors.INVALID_OPTIMAL_USAGE_RATIO));
+ rateStrategy.setInterestRateParams(tokenList.usdx, rateDataToSet);
+ }
+
+ function test_reverts_SetReserveInterestRateParams_when_lt_min_op(
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateDataToSet
+ ) public {
+ vm.assume(rateDataToSet.optimalUsageRatio < rateStrategy.MIN_OPTIMAL_POINT());
+
+ vm.prank(report.poolConfiguratorProxy);
+ vm.expectRevert(bytes(Errors.INVALID_OPTIMAL_USAGE_RATIO));
+ rateStrategy.setInterestRateParams(tokenList.usdx, abi.encode(rateDataToSet));
+
+ // Override
+ vm.prank(report.poolConfiguratorProxy);
+ vm.expectRevert(bytes(Errors.INVALID_OPTIMAL_USAGE_RATIO));
+ rateStrategy.setInterestRateParams(tokenList.usdx, rateDataToSet);
+ }
+
+ function test_reverts_SetReserveInterestRateParams_when_gt_maxRate(
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateDataToSet
+ ) public {
+ vm.assume(
+ rateDataToSet.optimalUsageRatio >= rateStrategy.MIN_OPTIMAL_POINT() &&
+ rateDataToSet.optimalUsageRatio <= rateStrategy.MAX_OPTIMAL_POINT()
+ );
+
+ vm.assume(rateDataToSet.variableRateSlope1 <= rateDataToSet.variableRateSlope2);
+ vm.assume(
+ uint256(rateDataToSet.baseVariableBorrowRate) +
+ uint256(rateDataToSet.variableRateSlope1) +
+ uint256(rateDataToSet.variableRateSlope2) >
+ rateStrategy.MAX_BORROW_RATE()
+ );
+
+ vm.prank(report.poolConfiguratorProxy);
+ vm.expectRevert(bytes(Errors.INVALID_MAX_RATE));
+ rateStrategy.setInterestRateParams(tokenList.usdx, abi.encode(rateDataToSet));
+
+ // Override
+ vm.prank(report.poolConfiguratorProxy);
+ vm.expectRevert(bytes(Errors.INVALID_MAX_RATE));
+ rateStrategy.setInterestRateParams(tokenList.usdx, rateDataToSet);
+ }
+
+ function test_reverts_SetReserveInterestRateParams_when_slope1_gt_slope2(
+ uint16 optimalUsageRatio,
+ uint32 baseVariableBorrowRate,
+ uint32 variableRateSlope1,
+ uint32 variableRateSlope2
+ ) public {
+ vm.assume(
+ optimalUsageRatio >= rateStrategy.MIN_OPTIMAL_POINT() &&
+ optimalUsageRatio <= rateStrategy.MAX_OPTIMAL_POINT()
+ );
+
+ vm.assume(variableRateSlope1 > variableRateSlope2);
+
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateData = IDefaultInterestRateStrategyV2
+ .InterestRateData({
+ optimalUsageRatio: optimalUsageRatio,
+ baseVariableBorrowRate: baseVariableBorrowRate,
+ variableRateSlope1: variableRateSlope1,
+ variableRateSlope2: variableRateSlope2
+ });
+
+ vm.prank(report.poolConfiguratorProxy);
+ vm.expectRevert(bytes(Errors.SLOPE_2_MUST_BE_GTE_SLOPE_1));
+ rateStrategy.setInterestRateParams(tokenList.usdx, abi.encode(rateData));
+
+ // Override
+ vm.prank(report.poolConfiguratorProxy);
+ vm.expectRevert(bytes(Errors.SLOPE_2_MUST_BE_GTE_SLOPE_1));
+ rateStrategy.setInterestRateParams(tokenList.usdx, abi.encode(rateData));
+ }
+}
diff --git a/tests/misc/rates/RateStrategy.template.sol b/tests/misc/rates/RateStrategy.template.sol
new file mode 100644
index 00000000..01e6dc9b
--- /dev/null
+++ b/tests/misc/rates/RateStrategy.template.sol
@@ -0,0 +1,89 @@
+// SPDX-License-Identifier: BUSL-1.1
+pragma solidity ^0.8.0;
+
+import 'forge-std/Test.sol';
+
+import {DataTypes} from '../../../src/contracts/protocol/libraries/types/DataTypes.sol';
+import {Errors} from '../../../src/contracts/protocol/libraries/helpers/Errors.sol';
+import {WadRayMath} from '../../../src/contracts/protocol/libraries/math/WadRayMath.sol';
+import {DefaultReserveInterestRateStrategyV2, IDefaultInterestRateStrategyV2, PercentageMath, IPoolAddressesProvider} from '../../../src/contracts/misc/DefaultReserveInterestRateStrategyV2.sol';
+import {IPoolConfigurator} from '../../../src/contracts/interfaces/IPoolConfigurator.sol';
+import {TestnetProcedures} from '../../utils/TestnetProcedures.sol';
+
+contract RateStrategyBase is TestnetProcedures {
+ using WadRayMath for uint256;
+ using PercentageMath for uint256;
+
+ struct Params {
+ uint256 currentLiquidityRate;
+ uint256 currentVariableBorrowRate;
+ }
+
+ uint256 public reserveFactor;
+ address public aToken;
+ DefaultReserveInterestRateStrategyV2 public rateStrategy;
+ Params public params;
+ uint256 public borrowUsageRatio;
+
+ event RateDataUpdate(
+ address indexed reserve,
+ uint256 optimalUsageRatio,
+ uint256 baseVariableBorrowRate,
+ uint256 variableRateSlope1,
+ uint256 variableRateSlope2
+ );
+
+ // sets limits for the fuzzing parameters and sets them on the interest rate strategy
+ modifier setRateParams(
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateData,
+ address token
+ ) {
+ _setRateParams(rateData, token);
+ _;
+ }
+
+ function _validateSetRateParams(
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateData
+ ) internal view {
+ vm.assume(
+ rateData.optimalUsageRatio >= rateStrategy.MIN_OPTIMAL_POINT() &&
+ rateData.optimalUsageRatio <= rateStrategy.MAX_OPTIMAL_POINT()
+ );
+
+ vm.assume(rateData.variableRateSlope1 < rateData.variableRateSlope2);
+ vm.assume(
+ uint256(rateData.baseVariableBorrowRate) +
+ uint256(rateData.variableRateSlope1) +
+ uint256(rateData.variableRateSlope2) <=
+ rateStrategy.MAX_BORROW_RATE()
+ );
+ }
+
+ function _setRateParams(
+ IDefaultInterestRateStrategyV2.InterestRateData memory rateData,
+ address token
+ ) internal {
+ _validateSetRateParams(rateData);
+
+ vm.prank(report.poolConfiguratorProxy);
+ rateStrategy.setInterestRateParams(token, abi.encode(rateData));
+ }
+
+ function setUp() public {
+ initTestEnvironment();
+
+ (aToken, , ) = contracts.protocolDataProvider.getReserveTokensAddresses(tokenList.usdx);
+ rateStrategy = new DefaultReserveInterestRateStrategyV2(report.poolAddressesProvider);
+ (, , , , reserveFactor, , , , , ) = contracts.protocolDataProvider.getReserveConfigurationData(
+ tokenList.usdx
+ );
+
+ vm.startPrank(poolAdmin);
+ IPoolConfigurator(report.poolConfiguratorProxy).setReserveInterestRateStrategyAddress(
+ tokenList.usdx,
+ address(rateStrategy),
+ _getDefaultInterestRatesStrategyData()
+ );
+ vm.stopPrank();
+ }
+}
diff --git a/tests/mocks/AaveV3TestListing.sol b/tests/mocks/AaveV3TestListing.sol
index 30751b34..65dc9ccb 100644
--- a/tests/mocks/AaveV3TestListing.sol
+++ b/tests/mocks/AaveV3TestListing.sol
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
-import 'aave-v3-periphery/contracts/v3-config-engine/AaveV3Payload.sol';
-import {TestnetERC20} from 'aave-v3-periphery/contracts/mocks/testnet-helpers/TestnetERC20.sol';
-import {MockAggregator} from 'aave-v3-core/contracts/mocks/oracle/CLAggregators/MockAggregator.sol';
-import {ACLManager} from 'aave-v3-core/contracts/protocol/configuration/ACLManager.sol';
+import '../../src/contracts/extensions/v3-config-engine/AaveV3Payload.sol';
+import {TestnetERC20} from '../../src/contracts/mocks/testnet-helpers/TestnetERC20.sol';
+import {MockAggregator} from '../../src/contracts/mocks/oracle/CLAggregators/MockAggregator.sol';
+import {ACLManager} from '../../src/contracts/protocol/configuration/ACLManager.sol';
import {MarketReport} from '../../src/deployments/interfaces/IMarketReportTypes.sol';
/**
@@ -27,7 +27,6 @@ contract AaveV3TestListing is AaveV3Payload {
address immutable ATOKEN_IMPLEMENTATION;
address immutable VARIABLE_DEBT_TOKEN_IMPLEMENTATION;
- address immutable STABLE_DEBT_TOKEN_IMPLEMENTATION;
ACLManager immutable ACL_MANAGER;
@@ -48,7 +47,6 @@ contract AaveV3TestListing is AaveV3Payload {
ATOKEN_IMPLEMENTATION = report.aToken;
VARIABLE_DEBT_TOKEN_IMPLEMENTATION = report.variableDebtToken;
- STABLE_DEBT_TOKEN_IMPLEMENTATION = report.stableDebtToken;
ACL_MANAGER = ACLManager(report.aclManager);
}
@@ -75,7 +73,6 @@ contract AaveV3TestListing is AaveV3Payload {
priceFeed: USDX_MOCK_PRICE_FEED,
rateStrategyParams: rateParams,
enabledToBorrow: EngineFlags.ENABLED,
- stableRateModeEnabled: EngineFlags.DISABLED,
borrowableInIsolation: EngineFlags.DISABLED,
withSiloedBorrowing: EngineFlags.DISABLED,
flashloanable: EngineFlags.ENABLED,
@@ -86,13 +83,11 @@ contract AaveV3TestListing is AaveV3Payload {
supplyCap: 0,
borrowCap: 0,
debtCeiling: 0,
- liqProtocolFee: 10_00,
- eModeCategory: 0
+ liqProtocolFee: 10_00
}),
IEngine.TokenImplementations({
aToken: ATOKEN_IMPLEMENTATION,
- vToken: VARIABLE_DEBT_TOKEN_IMPLEMENTATION,
- sToken: STABLE_DEBT_TOKEN_IMPLEMENTATION
+ vToken: VARIABLE_DEBT_TOKEN_IMPLEMENTATION
})
);
@@ -103,7 +98,6 @@ contract AaveV3TestListing is AaveV3Payload {
priceFeed: WBTC_MOCK_PRICE_FEED,
rateStrategyParams: rateParams,
enabledToBorrow: EngineFlags.ENABLED,
- stableRateModeEnabled: EngineFlags.DISABLED,
borrowableInIsolation: EngineFlags.DISABLED,
withSiloedBorrowing: EngineFlags.DISABLED,
flashloanable: EngineFlags.ENABLED,
@@ -114,13 +108,11 @@ contract AaveV3TestListing is AaveV3Payload {
supplyCap: 0,
borrowCap: 0,
debtCeiling: 0,
- liqProtocolFee: 10_00,
- eModeCategory: 0
+ liqProtocolFee: 10_00
}),
IEngine.TokenImplementations({
aToken: ATOKEN_IMPLEMENTATION,
- vToken: VARIABLE_DEBT_TOKEN_IMPLEMENTATION,
- sToken: STABLE_DEBT_TOKEN_IMPLEMENTATION
+ vToken: VARIABLE_DEBT_TOKEN_IMPLEMENTATION
})
);
@@ -131,7 +123,6 @@ contract AaveV3TestListing is AaveV3Payload {
priceFeed: WETH_MOCK_PRICE_FEED,
rateStrategyParams: rateParams,
enabledToBorrow: EngineFlags.ENABLED,
- stableRateModeEnabled: EngineFlags.DISABLED,
borrowableInIsolation: EngineFlags.DISABLED,
withSiloedBorrowing: EngineFlags.DISABLED,
flashloanable: EngineFlags.ENABLED,
@@ -142,13 +133,11 @@ contract AaveV3TestListing is AaveV3Payload {
supplyCap: 0,
borrowCap: 0,
debtCeiling: 0,
- liqProtocolFee: 10_00,
- eModeCategory: 0
+ liqProtocolFee: 10_00
}),
IEngine.TokenImplementations({
aToken: ATOKEN_IMPLEMENTATION,
- vToken: VARIABLE_DEBT_TOKEN_IMPLEMENTATION,
- sToken: STABLE_DEBT_TOKEN_IMPLEMENTATION
+ vToken: VARIABLE_DEBT_TOKEN_IMPLEMENTATION
})
);
diff --git a/tests/mocks/MockFlashLoanATokenReceiver.sol b/tests/mocks/MockFlashLoanATokenReceiver.sol
index e9711df5..ae8947ec 100644
--- a/tests/mocks/MockFlashLoanATokenReceiver.sol
+++ b/tests/mocks/MockFlashLoanATokenReceiver.sol
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.10;
-import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
-import {IPool} from 'aave-v3-core/contracts/interfaces/IPool.sol';
-import {FlashLoanSimpleReceiverBase} from 'aave-v3-core/contracts/mocks/flashloan/MockSimpleFlashLoanReceiver.sol';
+import {IERC20} from '../../src/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
+import {IPoolAddressesProvider} from '../../src/contracts/interfaces/IPoolAddressesProvider.sol';
+import {IPool} from '../../src/contracts/interfaces/IPool.sol';
+import {FlashLoanSimpleReceiverBase} from '../../src/contracts/mocks/flashloan/MockSimpleFlashLoanReceiver.sol';
/// @dev Helper contract to test donation attacks not possible in the context of a flash loan
contract MockFlashLoanATokenReceiver is FlashLoanSimpleReceiverBase {
diff --git a/tests/periphery/mocks/StakeMock.sol b/tests/mocks/StakeMock.sol
similarity index 100%
rename from tests/periphery/mocks/StakeMock.sol
rename to tests/mocks/StakeMock.sol
diff --git a/tests/core/ACLManager.t.sol b/tests/protocol/configuration/ACLManager.t.sol
similarity index 96%
rename from tests/core/ACLManager.t.sol
rename to tests/protocol/configuration/ACLManager.t.sol
index 373c4ee0..c06e0f7a 100644
--- a/tests/core/ACLManager.t.sol
+++ b/tests/protocol/configuration/ACLManager.t.sol
@@ -3,10 +3,10 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
-import {ACLManager} from 'aave-v3-core/contracts/protocol/configuration/ACLManager.sol';
-import {PoolAddressesProvider} from 'aave-v3-core/contracts/protocol/configuration/PoolAddressesProvider.sol';
+import {TestnetProcedures} from '../../utils/TestnetProcedures.sol';
+import {Errors} from '../../../src/contracts/protocol/libraries/helpers/Errors.sol';
+import {ACLManager} from '../../../src/contracts/protocol/configuration/ACLManager.sol';
+import {PoolAddressesProvider} from '../../../src/contracts/protocol/configuration/PoolAddressesProvider.sol';
contract ACLManagerTest is TestnetProcedures {
address internal immutable deployer;
@@ -235,7 +235,7 @@ contract ACLManagerTest is TestnetProcedures {
*/
function toAsciiString(address x) internal pure returns (string memory) {
bytes memory s = new bytes(40);
- for (uint i = 0; i < 20; i++) {
+ for (uint256 i = 0; i < 20; i++) {
bytes1 b = bytes1(uint8(uint(uint160(x)) / (2 ** (8 * (19 - i)))));
bytes1 hi = bytes1(uint8(b) / 16);
bytes1 lo = bytes1(uint8(b) - 16 * uint8(hi));
diff --git a/tests/core/AddressesProviderRegistry.t.sol b/tests/protocol/configuration/AddressesProviderRegistry.t.sol
similarity index 97%
rename from tests/core/AddressesProviderRegistry.t.sol
rename to tests/protocol/configuration/AddressesProviderRegistry.t.sol
index d1e5bb35..d549d752 100644
--- a/tests/core/AddressesProviderRegistry.t.sol
+++ b/tests/protocol/configuration/AddressesProviderRegistry.t.sol
@@ -3,8 +3,8 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
+import {TestnetProcedures} from '../../utils/TestnetProcedures.sol';
+import {Errors} from '../../../src/contracts/protocol/libraries/helpers/Errors.sol';
contract PoolAddressesProviderRegistryTest is TestnetProcedures {
event AddressesProviderRegistered(address indexed addressesProvider, uint256 indexed id);
diff --git a/tests/core/PoolAddressesProvider.t.sol b/tests/protocol/configuration/PoolAddressesProvider.t.sol
similarity index 95%
rename from tests/core/PoolAddressesProvider.t.sol
rename to tests/protocol/configuration/PoolAddressesProvider.t.sol
index 115219b8..e4003f7c 100644
--- a/tests/core/PoolAddressesProvider.t.sol
+++ b/tests/protocol/configuration/PoolAddressesProvider.t.sol
@@ -3,14 +3,14 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {PoolAddressesProvider, IPoolAddressesProvider} from 'aave-v3-core/contracts/protocol/configuration/PoolAddressesProvider.sol';
-import {PoolInstance} from 'aave-v3-core/instances/PoolInstance.sol';
-import {MockInitializableV1, MockInitializableV2} from 'aave-v3-core/contracts/mocks/upgradeability/MockInitializableImplementation.sol';
-import {PoolConfiguratorInstance} from 'aave-v3-core/instances/PoolConfiguratorInstance.sol';
-import {MockPoolInherited} from 'aave-v3-core/contracts/mocks/helpers/MockPool.sol';
-import {ACLManager} from 'aave-v3-core/contracts/protocol/configuration/ACLManager.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
-import {SlotParser} from '../utils/SlotParser.sol';
+import {PoolAddressesProvider, IPoolAddressesProvider} from '../../../src/contracts/protocol/configuration/PoolAddressesProvider.sol';
+import {PoolInstance} from '../../../src/contracts/instances/PoolInstance.sol';
+import {MockInitializableV1, MockInitializableV2} from '../../../src/contracts/mocks/upgradeability/MockInitializableImplementation.sol';
+import {PoolConfiguratorInstance} from '../../../src/contracts/instances/PoolConfiguratorInstance.sol';
+import {MockPoolInherited} from '../../../src/contracts/mocks/helpers/MockPool.sol';
+import {ACLManager} from '../../../src/contracts/protocol/configuration/ACLManager.sol';
+import {TestnetProcedures} from '../../utils/TestnetProcedures.sol';
+import {SlotParser} from '../../utils/SlotParser.sol';
contract PoolAddressesProviderTests is TestnetProcedures {
using stdStorage for StdStorage;
diff --git a/tests/core/BridgeLogic.t.sol b/tests/protocol/libraries/logic/BridgeLogic.t.sol
similarity index 92%
rename from tests/core/BridgeLogic.t.sol
rename to tests/protocol/libraries/logic/BridgeLogic.t.sol
index db9ddbe5..18660436 100644
--- a/tests/core/BridgeLogic.t.sol
+++ b/tests/protocol/libraries/logic/BridgeLogic.t.sol
@@ -3,15 +3,15 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {MathUtils} from 'aave-v3-core/contracts/protocol/libraries/math/MathUtils.sol';
-import {WadRayMath} from 'aave-v3-core/contracts/protocol/libraries/math/WadRayMath.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
-import {ReserveLogic} from 'aave-v3-core/contracts/protocol/libraries/logic/ReserveLogic.sol';
-import {PercentageMath} from 'aave-v3-core/contracts/protocol/libraries/math/PercentageMath.sol';
-import {SafeCast} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol';
-import {IAToken} from 'aave-v3-core/contracts/interfaces/IAToken.sol';
-import {DataTypes} from 'aave-v3-core/contracts/protocol/libraries/types/DataTypes.sol';
+import {MathUtils} from '../../../../src/contracts/protocol/libraries/math/MathUtils.sol';
+import {WadRayMath} from '../../../../src/contracts/protocol/libraries/math/WadRayMath.sol';
+import {TestnetProcedures} from '../../../utils/TestnetProcedures.sol';
+import {Errors} from '../../../../src/contracts/protocol/libraries/helpers/Errors.sol';
+import {ReserveLogic} from '../../../../src/contracts/protocol/libraries/logic/ReserveLogic.sol';
+import {PercentageMath} from '../../../../src/contracts/protocol/libraries/math/PercentageMath.sol';
+import {SafeCast} from '../../../../src/contracts/dependencies/openzeppelin/contracts/SafeCast.sol';
+import {IAToken} from '../../../../src/contracts/interfaces/IAToken.sol';
+import {DataTypes} from '../../../../src/contracts/protocol/libraries/types/DataTypes.sol';
contract BridgeLogicTests is TestnetProcedures {
using WadRayMath for uint256;
diff --git a/tests/core/PoolLogic.initReserves.edge.t.sol b/tests/protocol/libraries/logic/PoolLogic.initReserves.edge.t.sol
similarity index 89%
rename from tests/core/PoolLogic.initReserves.edge.t.sol
rename to tests/protocol/libraries/logic/PoolLogic.initReserves.edge.t.sol
index d7b6053c..8ba395c8 100644
--- a/tests/core/PoolLogic.initReserves.edge.t.sol
+++ b/tests/protocol/libraries/logic/PoolLogic.initReserves.edge.t.sol
@@ -3,8 +3,8 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {PoolLogic, ReserveLogic} from 'aave-v3-core/contracts/protocol/libraries/logic/PoolLogic.sol';
-import '../utils/TestnetProcedures.sol';
+import {PoolLogic, ReserveLogic} from '../../../../src/contracts/protocol/libraries/logic/PoolLogic.sol';
+import '../../../utils/TestnetProcedures.sol';
contract Mock {
string public constant value = 'MOCK';
@@ -24,7 +24,6 @@ contract PoolLogicInitReservesTests is TestnetProcedures {
DataTypes.InitReserveParams memory params = DataTypes.InitReserveParams(
address(new Mock()),
report.aToken,
- report.stableDebtToken,
report.variableDebtToken,
address(2),
0,
@@ -41,7 +40,6 @@ contract PoolLogicInitReservesTests is TestnetProcedures {
DataTypes.InitReserveParams memory params1 = DataTypes.InitReserveParams(
address(new Mock()),
report.aToken,
- report.stableDebtToken,
report.variableDebtToken,
address(2),
0,
@@ -51,7 +49,6 @@ contract PoolLogicInitReservesTests is TestnetProcedures {
DataTypes.InitReserveParams memory params2 = DataTypes.InitReserveParams(
address(new Mock()),
report.aToken,
- report.stableDebtToken,
report.variableDebtToken,
address(2),
1,
@@ -61,7 +58,6 @@ contract PoolLogicInitReservesTests is TestnetProcedures {
DataTypes.InitReserveParams memory params3 = DataTypes.InitReserveParams(
address(new Mock()),
report.aToken,
- report.stableDebtToken,
report.variableDebtToken,
address(2),
2,
@@ -82,7 +78,6 @@ contract PoolLogicInitReservesTests is TestnetProcedures {
DataTypes.InitReserveParams memory params1 = DataTypes.InitReserveParams(
address(new Mock()),
report.aToken,
- report.stableDebtToken,
report.variableDebtToken,
address(2),
0,
diff --git a/tests/core/MathUtils.t.sol b/tests/protocol/libraries/math/MathUtils.t.sol
similarity index 88%
rename from tests/core/MathUtils.t.sol
rename to tests/protocol/libraries/math/MathUtils.t.sol
index 8f532c8e..ce27b819 100644
--- a/tests/core/MathUtils.t.sol
+++ b/tests/protocol/libraries/math/MathUtils.t.sol
@@ -3,8 +3,8 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {MathUtils} from 'aave-v3-core/contracts/protocol/libraries/math/MathUtils.sol';
-import {MathUtilsWrapper} from 'aave-v3-core/contracts/mocks/tests/MathUtilsWrapper.sol';
+import {MathUtils} from '../../../../src/contracts/protocol/libraries/math/MathUtils.sol';
+import {MathUtilsWrapper} from '../../../../src/contracts/mocks/tests/MathUtilsWrapper.sol';
contract MathUtilsTests is Test {
MathUtilsWrapper internal w;
diff --git a/tests/core/PercentageMath.t.sol b/tests/protocol/libraries/math/PercentageMath.t.sol
similarity index 89%
rename from tests/core/PercentageMath.t.sol
rename to tests/protocol/libraries/math/PercentageMath.t.sol
index 1d6abb8c..47f949d2 100644
--- a/tests/core/PercentageMath.t.sol
+++ b/tests/protocol/libraries/math/PercentageMath.t.sol
@@ -3,8 +3,8 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {PercentageMath} from 'aave-v3-core/contracts/protocol/libraries/math/PercentageMath.sol';
-import {PercentageMathWrapper} from 'aave-v3-core/contracts/mocks/tests/PercentageMathWrapper.sol';
+import {PercentageMath} from '../../../../src/contracts/protocol/libraries/math/PercentageMath.sol';
+import {PercentageMathWrapper} from '../../../../src/contracts/mocks/tests/PercentageMathWrapper.sol';
contract PercentageMathTests is Test {
PercentageMathWrapper internal w;
diff --git a/tests/core/WadRayMath.t.sol b/tests/protocol/libraries/math/WadRayMath.t.sol
similarity index 97%
rename from tests/core/WadRayMath.t.sol
rename to tests/protocol/libraries/math/WadRayMath.t.sol
index 7a582e34..baefd867 100644
--- a/tests/core/WadRayMath.t.sol
+++ b/tests/protocol/libraries/math/WadRayMath.t.sol
@@ -2,7 +2,7 @@
pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {WadRayMathWrapper} from 'aave-v3-core/contracts/mocks/tests/WadRayMathWrapper.sol';
+import {WadRayMathWrapper} from '../../../../src/contracts/mocks/tests/WadRayMathWrapper.sol';
contract WadRayMathTests is Test {
WadRayMathWrapper internal w;
diff --git a/tests/core/L2Pool.t.sol b/tests/protocol/pool/L2Pool.t.sol
similarity index 78%
rename from tests/core/L2Pool.t.sol
rename to tests/protocol/pool/L2Pool.t.sol
index 18f73fd3..f91495b4 100644
--- a/tests/core/L2Pool.t.sol
+++ b/tests/protocol/pool/L2Pool.t.sol
@@ -3,17 +3,17 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {IAaveOracle} from 'aave-v3-core/contracts/interfaces/IAaveOracle.sol';
-import {L2Encoder} from 'aave-v3-core/contracts/misc/L2Encoder.sol';
-import {IL2Pool} from 'aave-v3-core/contracts/interfaces/IL2Pool.sol';
-import {IReserveInterestRateStrategy} from 'aave-v3-core/contracts/interfaces/IReserveInterestRateStrategy.sol';
-import {BorrowLogic} from 'aave-v3-core/contracts/protocol/libraries/logic/BorrowLogic.sol';
-import {SupplyLogic} from 'aave-v3-core/contracts/protocol/libraries/logic/SupplyLogic.sol';
-import {LiquidationLogic} from 'aave-v3-core/contracts/protocol/libraries/logic/LiquidationLogic.sol';
-import {TestnetERC20} from 'aave-v3-periphery/contracts/mocks/testnet-helpers/TestnetERC20.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
+import {IAaveOracle} from '../../../src/contracts/interfaces/IAaveOracle.sol';
+import {L2Encoder} from '../../../src/contracts/helpers/L2Encoder.sol';
+import {IL2Pool} from '../../../src/contracts/interfaces/IL2Pool.sol';
+import {IReserveInterestRateStrategy} from '../../../src/contracts/interfaces/IReserveInterestRateStrategy.sol';
+import {BorrowLogic} from '../../../src/contracts/protocol/libraries/logic/BorrowLogic.sol';
+import {SupplyLogic} from '../../../src/contracts/protocol/libraries/logic/SupplyLogic.sol';
+import {LiquidationLogic} from '../../../src/contracts/protocol/libraries/logic/LiquidationLogic.sol';
+import {TestnetERC20} from '../../../src/contracts/mocks/testnet-helpers/TestnetERC20.sol';
+import {TestnetProcedures} from '../../utils/TestnetProcedures.sol';
import {PoolTests, DataTypes, Errors, IERC20, IPool} from './Pool.t.sol';
-import {EIP712SigUtils} from '../utils/EIP712SigUtils.sol';
+import {EIP712SigUtils} from '../../utils/EIP712SigUtils.sol';
/// @dev All Pool.t.sol tests are run as L2Pool via inheriting PoolTests
contract L2PoolTests is PoolTests {
@@ -28,9 +28,6 @@ contract L2PoolTests is PoolTests {
pool = IPool(report.poolProxy);
l2Pool = IL2Pool(report.poolProxy);
l2Encoder = L2Encoder(report.l2Encoder);
-
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setReserveStableRateBorrowing(tokenList.usdx, true);
}
function test_l2_supply() public {
@@ -111,7 +108,7 @@ contract L2PoolTests is PoolTests {
alice,
0.2e6,
DataTypes.InterestRateMode(2),
- _calculateInterestRates(0.2e6, 2, tokenList.usdx),
+ _calculateInterestRates(0.2e6, tokenList.usdx),
0
);
@@ -182,36 +179,6 @@ contract L2PoolTests is PoolTests {
l2Pool.repayWithATokens(encodedInput);
}
- function test_l2_swap_borrow_rate() public {
- _seedUsdxLiquidity();
-
- vm.startPrank(alice);
-
- pool.supply(tokenList.wbtc, 1e8, alice, 0);
- pool.borrow(tokenList.usdx, 10e6, 2, 0, alice);
-
- bytes32 encodedInput = l2Encoder.encodeSwapBorrowRateMode(tokenList.usdx, 2);
-
- vm.expectRevert(bytes(Errors.OPERATION_NOT_SUPPORTED));
- l2Pool.swapBorrowRateMode(encodedInput);
- vm.stopPrank();
- }
-
- function test_l2_rebalance_borrow() public {
- DataTypes.ReserveDataLegacy memory usdxReserveData = pool.getReserveData(tokenList.usdx);
-
- vm.mockCall(
- address(usdxReserveData.interestRateStrategyAddress),
- abi.encodeWithSelector(IReserveInterestRateStrategy.calculateInterestRates.selector),
- abi.encode(0, 0, 0)
- );
-
- bytes32 encodedInput = l2Encoder.encodeRebalanceStableBorrowRate(tokenList.usdx, alice);
- vm.expectRevert(bytes(Errors.OPERATION_NOT_SUPPORTED));
- l2Pool.rebalanceStableBorrowRate(encodedInput);
- vm.clearMockedCalls();
- }
-
function test_l2_set_user_collateral() public {
test_l2_supply();
diff --git a/tests/core/Pool.Borrow.t.sol b/tests/protocol/pool/Pool.Borrow.t.sol
similarity index 60%
rename from tests/core/Pool.Borrow.t.sol
rename to tests/protocol/pool/Pool.Borrow.t.sol
index c73a30e8..3245feab 100644
--- a/tests/core/Pool.Borrow.t.sol
+++ b/tests/protocol/pool/Pool.Borrow.t.sol
@@ -3,27 +3,25 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {IStableDebtToken} from 'aave-v3-core/contracts/interfaces/IStableDebtToken.sol';
-import {IVariableDebtToken} from 'aave-v3-core/contracts/interfaces/IVariableDebtToken.sol';
-import {IAaveOracle} from 'aave-v3-core/contracts/interfaces/IAaveOracle.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
-import {IReserveInterestRateStrategy} from 'aave-v3-core/contracts/interfaces/IReserveInterestRateStrategy.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
-import {ISequencerOracle} from 'aave-v3-core/contracts/interfaces/ISequencerOracle.sol';
-import {UserConfiguration} from 'aave-v3-core/contracts/protocol/libraries/configuration/UserConfiguration.sol';
-import {PriceOracleSentinel} from 'aave-v3-core/contracts/protocol/configuration/PriceOracleSentinel.sol';
-import {SequencerOracle} from 'aave-v3-core/contracts/mocks/oracle/SequencerOracle.sol';
-import {MockAggregator} from 'aave-v3-core/contracts/mocks/oracle/CLAggregators/MockAggregator.sol';
-import {DataTypes} from 'aave-v3-core/contracts/protocol/libraries/types/DataTypes.sol';
-import {ReserveConfiguration} from 'aave-v3-core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
-import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
+import {IVariableDebtToken} from '../../../src/contracts/interfaces/IVariableDebtToken.sol';
+import {IAaveOracle} from '../../../src/contracts/interfaces/IAaveOracle.sol';
+import {Errors} from '../../../src/contracts/protocol/libraries/helpers/Errors.sol';
+import {IReserveInterestRateStrategy} from '../../../src/contracts/interfaces/IReserveInterestRateStrategy.sol';
+import {IPoolAddressesProvider} from '../../../src/contracts/interfaces/IPoolAddressesProvider.sol';
+import {ISequencerOracle} from '../../../src/contracts/interfaces/ISequencerOracle.sol';
+import {UserConfiguration} from '../../../src/contracts/protocol/libraries/configuration/UserConfiguration.sol';
+import {PriceOracleSentinel} from '../../../src/contracts/misc/PriceOracleSentinel.sol';
+import {SequencerOracle} from '../../../src/contracts/mocks/oracle/SequencerOracle.sol';
+import {MockAggregator} from '../../../src/contracts/mocks/oracle/CLAggregators/MockAggregator.sol';
+import {DataTypes} from '../../../src/contracts/protocol/libraries/types/DataTypes.sol';
+import {ReserveConfiguration} from '../../../src/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
+import {IERC20} from '../../../src/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
+import {TestnetProcedures} from '../../utils/TestnetProcedures.sol';
contract PoolBorrowTests is TestnetProcedures {
using UserConfiguration for DataTypes.UserConfigurationMap;
using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
- IStableDebtToken internal staDebtUSDX;
IVariableDebtToken internal varDebtUSDX;
address internal aUSDX;
@@ -39,31 +37,21 @@ contract PoolBorrowTests is TestnetProcedures {
uint256 borrowRate,
uint16 indexed referralCode
);
- event RebalanceStableBorrowRate(address indexed reserve, address indexed user);
- event SwapBorrowRateMode(
- address indexed reserve,
- address indexed user,
- DataTypes.InterestRateMode interestRateMode
- );
event IsolationModeTotalDebtUpdated(address indexed asset, uint256 totalDebt);
function setUp() public {
initTestEnvironment();
- (address atoken, address stableDebtUSDX, address variableDebtUSDX) = contracts
+ (address atoken, , address variableDebtUSDX) = contracts
.protocolDataProvider
.getReserveTokensAddresses(tokenList.usdx);
aUSDX = atoken;
- staDebtUSDX = IStableDebtToken(stableDebtUSDX);
varDebtUSDX = IVariableDebtToken(variableDebtUSDX);
vm.startPrank(carol);
contracts.poolProxy.supply(tokenList.usdx, 100_000e6, carol, 0);
vm.stopPrank();
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setReserveStableRateBorrowing(tokenList.usdx, true);
-
sequencerOracleMock = new SequencerOracle(poolAdmin);
priceOracleSentinel = new PriceOracleSentinel(
IPoolAddressesProvider(report.poolAddressesProvider),
@@ -95,9 +83,7 @@ contract PoolBorrowTests is TestnetProcedures {
unbacked: 0,
liquidityAdded: 0,
liquidityTaken: 800e6,
- totalStableDebt: 0,
- totalVariableDebt: 800e6,
- averageStableBorrowRate: 0,
+ totalDebt: 800e6,
reserveFactor: 1000,
reserve: tokenList.usdx,
usingVirtualBalance: contracts
@@ -107,7 +93,7 @@ contract PoolBorrowTests is TestnetProcedures {
virtualUnderlyingBalance: contracts.poolProxy.getVirtualUnderlyingBalance(tokenList.usdx)
});
- (, , uint256 expectedVariableBorrowRate) = rateStrategy.calculateInterestRates(input);
+ (, uint256 expectedVariableBorrowRate) = rateStrategy.calculateInterestRates(input);
vm.expectEmit(true, true, true, true, address(contracts.poolProxy));
emit Borrow(
@@ -131,19 +117,6 @@ contract PoolBorrowTests is TestnetProcedures {
assertEq(contracts.poolProxy.getUserConfiguration(alice).isBorrowing(reserveData.id), true);
}
- function test_stable_borrow() public {
- uint256 amount = 1e8;
- uint256 borrowAmount = 800e6;
- vm.startPrank(alice);
-
- contracts.poolProxy.supply(tokenList.wbtc, amount, alice, 0);
-
- vm.expectRevert(bytes(Errors.OPERATION_NOT_SUPPORTED));
-
- contracts.poolProxy.borrow(tokenList.usdx, borrowAmount, 1, 0, alice);
- vm.stopPrank();
- }
-
function test_borrow_variable_in_isolation() public {
uint256 borrowAmount = 100e6;
vm.startPrank(poolAdmin);
@@ -157,7 +130,6 @@ contract PoolBorrowTests is TestnetProcedures {
contracts.poolProxy.setUserUseReserveAsCollateral(tokenList.wbtc, true);
uint256 balanceBefore = usdx.balanceOf(alice);
- uint256 debtBalanceBefore = staDebtUSDX.principalBalanceOf(alice);
DataTypes.ReserveDataLegacy memory reserveData = contracts.poolProxy.getReserveData(
tokenList.usdx
);
@@ -169,9 +141,7 @@ contract PoolBorrowTests is TestnetProcedures {
unbacked: 0,
liquidityAdded: 0,
liquidityTaken: borrowAmount,
- totalStableDebt: 0,
- totalVariableDebt: borrowAmount,
- averageStableBorrowRate: 0,
+ totalDebt: borrowAmount,
reserveFactor: 1000,
reserve: tokenList.usdx,
usingVirtualBalance: contracts
@@ -181,7 +151,7 @@ contract PoolBorrowTests is TestnetProcedures {
virtualUnderlyingBalance: contracts.poolProxy.getVirtualUnderlyingBalance(tokenList.usdx)
});
- (, , uint256 expectedVariableBorrowRate) = rateStrategy.calculateInterestRates(input);
+ (, uint256 expectedVariableBorrowRate) = rateStrategy.calculateInterestRates(input);
vm.expectEmit(address(contracts.poolProxy));
emit IsolationModeTotalDebtUpdated(tokenList.wbtc, 100_00);
@@ -204,7 +174,7 @@ contract PoolBorrowTests is TestnetProcedures {
uint256 debtBalanceAfter = varDebtUSDX.scaledBalanceOf(alice);
assertEq(balanceAfter, balanceBefore + borrowAmount);
- assertEq(debtBalanceAfter, debtBalanceBefore + borrowAmount);
+ assertEq(debtBalanceAfter, borrowAmount);
assertEq(contracts.poolProxy.getUserConfiguration(alice).isBorrowing(reserveData.id), true);
}
@@ -229,6 +199,18 @@ contract PoolBorrowTests is TestnetProcedures {
contracts.poolProxy.borrow(tokenList.usdx, borrowAmount, 2, 0, alice);
}
+ function test_reverts_deprecated_stable_borrow() public {
+ uint256 amount = 2000e6;
+ uint256 borrowAmount = 100;
+ vm.startPrank(alice);
+ contracts.poolProxy.supply(tokenList.usdx, amount, alice, 0);
+ contracts.poolProxy.supply(tokenList.wbtc, borrowAmount, bob, 0);
+
+ vm.expectRevert(bytes(Errors.INVALID_INTEREST_RATE_MODE_SELECTED));
+
+ contracts.poolProxy.borrow(tokenList.wbtc, borrowAmount, 1, 0, alice);
+ }
+
function test_reverts_borrow_invalidAmount() public {
vm.expectRevert(bytes(Errors.INVALID_AMOUNT));
@@ -243,7 +225,7 @@ contract PoolBorrowTests is TestnetProcedures {
vm.expectRevert(bytes(Errors.RESERVE_INACTIVE));
vm.prank(alice);
- contracts.poolProxy.borrow(tokenList.wbtc, 0.2e8, 1, 0, alice);
+ contracts.poolProxy.borrow(tokenList.wbtc, 0.2e8, 2, 0, alice);
}
function test_reverts_borrow_reservePaused() public {
@@ -253,7 +235,7 @@ contract PoolBorrowTests is TestnetProcedures {
vm.expectRevert(bytes(Errors.RESERVE_PAUSED));
vm.prank(alice);
- contracts.poolProxy.borrow(tokenList.wbtc, 0.2e8, 1, 0, alice);
+ contracts.poolProxy.borrow(tokenList.wbtc, 0.2e8, 2, 0, alice);
}
function test_reverts_borrow_reserveFrozen() public {
@@ -263,7 +245,7 @@ contract PoolBorrowTests is TestnetProcedures {
vm.expectRevert(bytes(Errors.RESERVE_FROZEN));
vm.prank(alice);
- contracts.poolProxy.borrow(tokenList.wbtc, 0.2e8, 1, 0, alice);
+ contracts.poolProxy.borrow(tokenList.wbtc, 0.2e8, 2, 0, alice);
}
function test_reverts_borrow_cap() public {
@@ -276,21 +258,7 @@ contract PoolBorrowTests is TestnetProcedures {
vm.expectRevert(bytes(Errors.BORROW_CAP_EXCEEDED));
- contracts.poolProxy.borrow(tokenList.wbtc, 10e8, 1, 0, alice);
- }
-
- function test_reverts_borrow_invalid_rate() public {
- vm.startPrank(alice);
- contracts.poolProxy.supply(tokenList.wbtc, 50e8, alice, 0);
- vm.stopPrank();
-
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setBorrowCap(tokenList.wbtc, 1);
-
- vm.expectRevert(bytes(Errors.INVALID_INTEREST_RATE_MODE_SELECTED));
-
- vm.prank(alice);
- contracts.poolProxy.borrow(tokenList.wbtc, 100, 0, 0, alice);
+ contracts.poolProxy.borrow(tokenList.wbtc, 10e8, 2, 0, alice);
}
function test_reverts_borrow_sentinel_oracle_down() public {
@@ -312,19 +280,6 @@ contract PoolBorrowTests is TestnetProcedures {
contracts.poolProxy.borrow(tokenList.wbtc, 100, 2, 0, alice);
}
- function test_reverts_borrow_stable_borrow_not_enabled() public {
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setReserveStableRateBorrowing(tokenList.usdx, false);
-
- vm.prank(alice);
- contracts.poolProxy.supply(tokenList.wbtc, 50e8, alice, 0);
-
- vm.expectRevert(bytes(Errors.STABLE_BORROWING_NOT_ENABLED));
-
- vm.prank(alice);
- contracts.poolProxy.borrow(tokenList.usdx, 100e6, 1, 0, alice);
- }
-
function test_reverts_borrow_not_borrowable_isolation() public {
uint256 borrowAmount = 100e6;
vm.startPrank(poolAdmin);
@@ -363,15 +318,8 @@ contract PoolBorrowTests is TestnetProcedures {
EModeCategoryInput memory ct = _genCategoryOne();
vm.startPrank(poolAdmin);
- contracts.poolConfiguratorProxy.setEModeCategory(
- ct.id,
- ct.ltv,
- ct.lt,
- ct.lb,
- ct.oracle,
- ct.label
- );
- contracts.poolConfiguratorProxy.setAssetEModeCategory(tokenList.wbtc, ct.id);
+ contracts.poolConfiguratorProxy.setEModeCategory(ct.id, ct.ltv, ct.lt, ct.lb, ct.label);
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.wbtc, ct.id, true);
vm.stopPrank();
vm.startPrank(alice);
@@ -380,7 +328,7 @@ contract PoolBorrowTests is TestnetProcedures {
contracts.poolProxy.supply(tokenList.wbtc, 0.5e8, alice, 0);
- vm.expectRevert(bytes(Errors.INCONSISTENT_EMODE_CATEGORY));
+ vm.expectRevert(bytes(Errors.NOT_BORROWABLE_IN_EMODE));
contracts.poolProxy.borrow(tokenList.usdx, 10001e6, 2, 0, alice);
vm.stopPrank();
}
@@ -389,7 +337,7 @@ contract PoolBorrowTests is TestnetProcedures {
vm.expectRevert(bytes(Errors.COLLATERAL_BALANCE_IS_ZERO));
vm.prank(alice);
- contracts.poolProxy.borrow(tokenList.usdx, 0.2e8, 1, 0, alice);
+ contracts.poolProxy.borrow(tokenList.usdx, 0.2e8, 2, 0, alice);
}
function test_reverts_borrow_collateral_can_not_cover() public {
@@ -425,26 +373,6 @@ contract PoolBorrowTests is TestnetProcedures {
contracts.poolProxy.borrow(tokenList.usdx, 10001e6, 2, 0, alice);
}
- function test_reverts_borrow_stable_collateral_same_borrow() public {
- vm.startPrank(alice);
-
- contracts.poolProxy.supply(tokenList.usdx, 100e6, alice, 0);
-
- vm.expectRevert(bytes(Errors.COLLATERAL_SAME_AS_BORROWING_CURRENCY));
- contracts.poolProxy.borrow(tokenList.usdx, 10e6, 1, 0, alice);
- vm.stopPrank();
- }
-
- function test_reverts_borrow_stable_amount_gt_max_loan_size_stable() public {
- vm.startPrank(alice);
-
- contracts.poolProxy.supply(tokenList.wbtc, 100e8, alice, 0);
-
- vm.expectRevert(bytes(Errors.AMOUNT_BIGGER_THAN_MAX_LOAN_SIZE_STABLE));
- contracts.poolProxy.borrow(tokenList.usdx, 60_000e6, 1, 0, alice);
- vm.stopPrank();
- }
-
function test_reverts_borrow_sioled_borrowing_violation() public {
vm.startPrank(carol);
contracts.poolProxy.supply(tokenList.wbtc, 100e8, carol, 0);
@@ -491,118 +419,4 @@ contract PoolBorrowTests is TestnetProcedures {
contracts.poolProxy.borrow(tokenList.usdx, 10001e6, 2, 0, alice);
vm.stopPrank();
}
-
- function test_reverts_rebalance_borrow_rate_reserve_inactive() public {
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setReserveActive(tokenList.wbtc, false);
-
- vm.expectRevert(bytes(Errors.RESERVE_INACTIVE));
-
- vm.prank(alice);
- contracts.poolProxy.rebalanceStableBorrowRate(tokenList.wbtc, alice);
- }
-
- function test_reverts_rebalance_borrow_rate_reserve_paused() public {
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setReservePause(tokenList.wbtc, true, 0);
-
- vm.expectRevert(bytes(Errors.RESERVE_PAUSED));
- vm.prank(alice);
- contracts.poolProxy.rebalanceStableBorrowRate(tokenList.wbtc, alice);
- }
-
- function test_reverts_rebalance_borrow_rate_conditions_not_met() public {
- vm.startPrank(alice);
-
- contracts.poolProxy.supply(tokenList.wbtc, 1e8, alice, 0);
- contracts.poolProxy.borrow(tokenList.usdx, 15000e6, 2, 0, alice);
-
- vm.expectRevert(bytes(Errors.INTEREST_RATE_REBALANCE_CONDITIONS_NOT_MET));
- contracts.poolProxy.rebalanceStableBorrowRate(tokenList.usdx, alice);
- vm.stopPrank();
- }
-
- function test_rebalance_borrow_rate() public {
- DataTypes.ReserveDataLegacy memory usdxReserveData = contracts.poolProxy.getReserveData(
- tokenList.usdx
- );
-
- vm.mockCall(
- address(usdxReserveData.interestRateStrategyAddress),
- abi.encodeWithSelector(IReserveInterestRateStrategy.calculateInterestRates.selector),
- abi.encode(0, 0, 0)
- );
-
- vm.expectRevert(bytes(Errors.OPERATION_NOT_SUPPORTED));
-
- contracts.poolProxy.rebalanceStableBorrowRate(tokenList.usdx, alice);
- vm.clearMockedCalls();
- }
-
- function test_swap_borrow_rate_from_variable_to_stable() public {
- vm.startPrank(alice);
- contracts.poolProxy.supply(tokenList.wbtc, 100e8, alice, 0);
- contracts.poolProxy.borrow(tokenList.usdx, 2000e6, 2, 0, alice);
-
- vm.expectRevert(bytes(Errors.OPERATION_NOT_SUPPORTED));
-
- contracts.poolProxy.swapBorrowRateMode(tokenList.usdx, 2);
- vm.stopPrank();
- }
-
- function test_reverts_swap_borrow_rate_reserve_inactive() public {
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setReserveActive(tokenList.wbtc, false);
-
- vm.expectRevert(bytes(Errors.RESERVE_INACTIVE));
-
- vm.prank(alice);
- contracts.poolProxy.swapBorrowRateMode(tokenList.wbtc, 1);
- }
-
- function test_reverts_swap_borrow_rate_reserve_paused() public {
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setReservePause(tokenList.usdx, true, 0);
-
- vm.expectRevert(bytes(Errors.RESERVE_PAUSED));
-
- vm.prank(alice);
- contracts.poolProxy.swapBorrowRateMode(tokenList.usdx, 2);
- }
-
- function test_swap_borrow_rate_reserve_frozen() public {
- vm.startPrank(alice);
- contracts.poolProxy.supply(tokenList.wbtc, 100e8, alice, 0);
- contracts.poolProxy.borrow(tokenList.usdx, 2000e6, 2, 0, alice);
- vm.stopPrank();
-
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setReserveFreeze(tokenList.usdx, true);
-
- vm.expectRevert(bytes(Errors.OPERATION_NOT_SUPPORTED));
-
- vm.prank(alice);
- contracts.poolProxy.swapBorrowRateMode(tokenList.usdx, 2);
- }
-
- function test_reverts_swap_borrow_rate_reserve_variable_no_debt() public {
- vm.expectRevert(bytes(Errors.NO_OUTSTANDING_VARIABLE_DEBT));
-
- vm.prank(alice);
- contracts.poolProxy.swapBorrowRateMode(tokenList.usdx, 2);
- }
-
- function test_reverts_swap_borrow_rate_reserve_stable_no_debt() public {
- vm.expectRevert(bytes(Errors.NO_OUTSTANDING_STABLE_DEBT));
-
- vm.prank(alice);
- contracts.poolProxy.swapBorrowRateMode(tokenList.usdx, 1);
- }
-
- function test_reverts_swap_borrow_rate_reserve_invalid_rate_mode() public {
- vm.expectRevert(bytes(Errors.INVALID_INTEREST_RATE_MODE_SELECTED));
-
- vm.prank(alice);
- contracts.poolProxy.swapBorrowRateMode(tokenList.usdx, 0);
- }
}
diff --git a/tests/protocol/pool/Pool.EMode.sol b/tests/protocol/pool/Pool.EMode.sol
new file mode 100644
index 00000000..24c621e9
--- /dev/null
+++ b/tests/protocol/pool/Pool.EMode.sol
@@ -0,0 +1,309 @@
+// SPDX-License-Identifier: BUSL-1.1
+pragma solidity ^0.8.0;
+
+import 'forge-std/Test.sol';
+import 'forge-std/StdStorage.sol';
+
+import {IPriceOracleGetter} from '../../../src/contracts/interfaces/IPriceOracleGetter.sol';
+import {IAToken, IERC20} from '../../../src/contracts/interfaces/IAToken.sol';
+import {IPool, DataTypes} from '../../../src/contracts/interfaces/IPool.sol';
+import {IPoolAddressesProvider} from '../../../src/contracts/interfaces/IPoolAddressesProvider.sol';
+import {PoolInstance} from '../../../src/contracts/instances/PoolInstance.sol';
+import {Errors} from '../../../src/contracts/protocol/libraries/helpers/Errors.sol';
+import {ReserveConfiguration} from '../../../src/contracts/protocol/pool/PoolConfigurator.sol';
+import {WadRayMath} from '../../../src/contracts/protocol/libraries/math/WadRayMath.sol';
+import {PercentageMath} from '../../../src/contracts/protocol/libraries/math/PercentageMath.sol';
+import {IAaveOracle} from '../../../src/contracts/interfaces/IAaveOracle.sol';
+import {TestnetProcedures} from '../../utils/TestnetProcedures.sol';
+import {TestnetERC20} from '../../../src/contracts/mocks/testnet-helpers/TestnetERC20.sol';
+
+contract PoolEModeTests is TestnetProcedures {
+ using stdStorage for StdStorage;
+
+ using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
+ using WadRayMath for uint256;
+ using PercentageMath for uint256;
+
+ event UserEModeSet(address indexed user, uint8 categoryId);
+
+ IPool internal pool;
+
+ function setUp() public virtual {
+ initTestEnvironment(false);
+
+ pool = PoolInstance(report.poolProxy);
+ }
+
+ function test_setUserEMode_shouldRevertForNonExistingEmode() public {
+ vm.prank(alice);
+ vm.expectRevert(bytes(Errors.INCONSISTENT_EMODE_CATEGORY));
+ pool.setUserEMode(1);
+ }
+
+ function test_getUserEMode_shouldReflectEMode() public {
+ vm.startPrank(poolAdmin);
+ EModeCategoryInput memory ct1 = _genCategoryOne();
+ contracts.poolConfiguratorProxy.setEModeCategory(ct1.id, ct1.ltv, ct1.lt, ct1.lb, ct1.label);
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.usdx, ct1.id, true);
+ vm.stopPrank();
+
+ vm.expectEmit(address(pool));
+ emit UserEModeSet(alice, ct1.id);
+ vm.prank(alice);
+ pool.setUserEMode(ct1.id);
+
+ assertEq(pool.getUserEMode(alice), ct1.id);
+ }
+
+ function test_reenterSameEmode_shouldSucceed() public {
+ test_getUserEMode_shouldReflectEMode();
+
+ assertEq(pool.getUserEMode(alice), 1);
+ vm.prank(alice);
+ pool.setUserEMode(1);
+ assertEq(pool.getUserEMode(alice), 1);
+ }
+
+ function test_getUserAccountData_shouldReflectEmodeParams() public {
+ vm.startPrank(poolAdmin);
+ EModeCategoryInput memory ct1 = _genCategoryOne();
+ contracts.poolConfiguratorProxy.setEModeCategory(ct1.id, ct1.ltv, ct1.lt, ct1.lb, ct1.label);
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.usdx, ct1.id, true);
+ vm.stopPrank();
+
+ vm.prank(alice);
+ pool.setUserEMode(ct1.id);
+ // supply some dust so the eMode asset is the only collateral
+ _mintTestnetToken(tokenList.usdx, alice, 1);
+ _supplyToPool(tokenList.usdx, alice, 1);
+
+ (, , , uint256 emodeLT, uint256 emodeLTV, ) = contracts.poolProxy.getUserAccountData(alice);
+ assertEq(emodeLT, ct1.lt);
+ assertEq(emodeLTV, ct1.ltv);
+
+ vm.prank(alice);
+ pool.setUserEMode(0);
+ (, uint256 assetBaseLTV, uint256 assetBaseLT, , , , , , , ) = contracts
+ .protocolDataProvider
+ .getReserveConfigurationData(tokenList.usdx);
+ (, , , uint256 baseLT, uint256 baseLTV, ) = contracts.poolProxy.getUserAccountData(alice);
+ assertEq(assetBaseLTV, baseLTV);
+ assertEq(assetBaseLT, baseLT);
+ }
+
+ function test_getUserAccountData_shouldReflectMixedCollateral() public {
+ vm.startPrank(poolAdmin);
+ EModeCategoryInput memory ct1 = _genCategoryOne();
+ contracts.poolConfiguratorProxy.setEModeCategory(ct1.id, ct1.ltv, ct1.lt, ct1.lb, ct1.label);
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.usdx, ct1.id, true);
+ vm.stopPrank();
+
+ vm.prank(alice);
+ pool.setUserEMode(ct1.id);
+ // supply some dust so the eMode asset is the only collateral
+ _mintTestnetToken(tokenList.usdx, alice, 1e6);
+ _supplyToPool(tokenList.usdx, alice, 1e6);
+ // supply some non eMode asset
+ _mintTestnetToken(tokenList.wbtc, alice, 1e8);
+ _supplyToPool(tokenList.wbtc, alice, 1e8);
+
+ (, , , uint256 realLT, uint256 realLTV, ) = contracts.poolProxy.getUserAccountData(alice);
+ assertLt(realLT, ct1.lt);
+ assertLt(realLTV, ct1.ltv);
+ }
+
+ function test_setUserEMode_shouldAllowSwitchingIfNoBorrows(uint8 eMode) public {
+ uint256 AVAILABLE_EMODES = 2;
+ EModeCategoryInput memory ct1 = _genCategoryOne();
+ EModeCategoryInput memory ct2 = _genCategoryTwo();
+ vm.startPrank(poolAdmin);
+ contracts.poolConfiguratorProxy.setEModeCategory(ct1.id, ct1.ltv, ct1.lt, ct1.lb, ct1.label);
+ contracts.poolConfiguratorProxy.setEModeCategory(ct2.id, ct2.ltv, ct2.lt, ct2.lb, ct2.label);
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.weth, ct1.id, true);
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.wbtc, ct2.id, true);
+ vm.stopPrank();
+
+ eMode = uint8(bound(eMode, 0, AVAILABLE_EMODES));
+ vm.prank(alice);
+ pool.setUserEMode(eMode);
+ eMode = uint8(bound(eMode + 1, 0, AVAILABLE_EMODES));
+ vm.prank(alice);
+ pool.setUserEMode(eMode);
+ assertEq(pool.getUserEMode(alice), eMode);
+ }
+
+ function test_setUserEmode_shouldAllowSwitchingWhenAssetIsBorrowableInEmode(
+ uint104 amount
+ ) public {
+ amount = uint104(bound(amount, 1 ether, type(uint104).max));
+ vm.startPrank(poolAdmin);
+ contracts.poolConfiguratorProxy.setEModeCategory(1, 9000, 9200, 10050, 'usdx eMode low');
+ contracts.poolConfiguratorProxy.setEModeCategory(2, 9000, 9700, 10050, 'usdx eMode high');
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.usdx, 1, true);
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.usdx, 2, true);
+ contracts.poolConfiguratorProxy.setAssetBorrowableInEMode(tokenList.wbtc, 1, true);
+ contracts.poolConfiguratorProxy.setAssetBorrowableInEMode(tokenList.wbtc, 2, true);
+ vm.stopPrank();
+
+ vm.prank(alice);
+ pool.setUserEMode(1);
+ _mintTestnetToken(tokenList.usdx, alice, amount);
+ _supplyToPool(tokenList.usdx, alice, amount);
+ _borrowMaxLt(tokenList.wbtc, alice);
+
+ (, , , , , uint256 hfBefore) = contracts.poolProxy.getUserAccountData(alice);
+ vm.prank(alice);
+ pool.setUserEMode(2);
+ (, , , , , uint256 hfAfter) = contracts.poolProxy.getUserAccountData(alice);
+ assertLt(hfBefore, hfAfter);
+ }
+
+ function test_setUserEmode_shouldRevertIfHfWouldFallBelow1(uint104 amount) public {
+ amount = uint104(bound(amount, 1 ether, type(uint104).max));
+ vm.startPrank(poolAdmin);
+ contracts.poolConfiguratorProxy.setEModeCategory(1, 9000, 9200, 10050, 'usdx eMode low');
+ contracts.poolConfiguratorProxy.setEModeCategory(2, 9000, 9700, 10050, 'usdx eMode high');
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.usdx, 1, true);
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.usdx, 2, true);
+ contracts.poolConfiguratorProxy.setAssetBorrowableInEMode(tokenList.wbtc, 1, true);
+ contracts.poolConfiguratorProxy.setAssetBorrowableInEMode(tokenList.wbtc, 2, true);
+ vm.stopPrank();
+
+ vm.prank(alice);
+ pool.setUserEMode(2);
+ _mintTestnetToken(tokenList.usdx, alice, amount);
+ _supplyToPool(tokenList.usdx, alice, amount);
+ _borrowMaxLt(tokenList.wbtc, alice);
+
+ vm.prank(alice);
+ vm.expectRevert(bytes(Errors.HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD));
+ pool.setUserEMode(1);
+ }
+
+ function test_setUserEmode_shouldRevertIfAssetNoLongerBorrowable(uint104 amount) public {
+ amount = uint104(bound(amount, 1 ether, type(uint104).max));
+ vm.startPrank(poolAdmin);
+ contracts.poolConfiguratorProxy.setEModeCategory(1, 9000, 9200, 10050, 'usdx eMode low');
+ contracts.poolConfiguratorProxy.setEModeCategory(2, 9000, 9700, 10050, 'usdx eMode high');
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.usdx, 1, true);
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.usdx, 2, true);
+ contracts.poolConfiguratorProxy.setAssetBorrowableInEMode(tokenList.wbtc, 1, true);
+ vm.stopPrank();
+
+ vm.prank(alice);
+ pool.setUserEMode(1);
+ _mintTestnetToken(tokenList.usdx, alice, amount);
+ _supplyToPool(tokenList.usdx, alice, amount);
+ _borrowMaxLt(tokenList.wbtc, alice);
+
+ vm.prank(alice);
+ vm.expectRevert(bytes(Errors.NOT_BORROWABLE_IN_EMODE));
+ pool.setUserEMode(2);
+ }
+
+ function test_borrowing_shouldRevert_ifNonBorrowableOutsideEmode(uint256 amount) public {
+ amount = bound(amount, 1 ether, type(uint104).max);
+ vm.startPrank(poolAdmin);
+ uint16 liquidationBonus = 10050;
+ contracts.poolConfiguratorProxy.setEModeCategory(
+ 1,
+ 9000,
+ 9200,
+ liquidationBonus,
+ 'usdx eMode low'
+ );
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.usdx, 1, true);
+ contracts.poolConfiguratorProxy.setReserveBorrowing(tokenList.wbtc, false);
+ contracts.poolConfiguratorProxy.setAssetBorrowableInEMode(tokenList.wbtc, 1, true);
+ vm.stopPrank();
+
+ vm.prank(alice);
+ pool.setUserEMode(1);
+ _mintTestnetToken(tokenList.usdx, alice, amount);
+ _supplyToPool(tokenList.usdx, alice, amount);
+
+ vm.prank(alice);
+ vm.expectRevert(bytes(Errors.BORROWING_NOT_ENABLED));
+ contracts.poolProxy.borrow(tokenList.wbtc, 1, 2, 0, alice);
+ }
+
+ function test_liquidations_shouldApplyEModeLBForEmodeAssets(uint256 amount) public {
+ amount = bound(amount, 1 ether, type(uint104).max);
+ vm.startPrank(poolAdmin);
+ uint16 liquidationBonus = 10050;
+ contracts.poolConfiguratorProxy.setEModeCategory(
+ 1,
+ 9000,
+ 9200,
+ liquidationBonus,
+ 'usdx eMode low'
+ );
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.usdx, 1, true);
+ contracts.poolConfiguratorProxy.setAssetBorrowableInEMode(tokenList.wbtc, 1, true);
+ vm.stopPrank();
+
+ vm.prank(alice);
+ pool.setUserEMode(1);
+ _mintTestnetToken(tokenList.usdx, alice, amount);
+ _supplyToPool(tokenList.usdx, alice, amount);
+ (uint256 totalCollateralBase, , , , , ) = contracts.poolProxy.getUserAccountData(alice);
+ uint256 debtPrice = contracts.aaveOracle.getAssetPrice(tokenList.wbtc);
+ uint256 borrowAmount = (totalCollateralBase * 1e8) / debtPrice;
+ _borrowArbitraryAmount(tokenList.wbtc, alice, borrowAmount);
+
+ address liquidator = address(0x0f0f0f);
+ _mintTestnetToken(tokenList.wbtc, liquidator, borrowAmount);
+ vm.startPrank(liquidator);
+ IERC20(tokenList.wbtc).approve(address(contracts.poolProxy), borrowAmount);
+ contracts.poolProxy.liquidationCall(
+ tokenList.usdx,
+ tokenList.wbtc,
+ alice,
+ type(uint256).max,
+ false
+ );
+
+ DataTypes.ReserveDataLegacy memory reserveData = contracts.poolProxy.getReserveData(
+ tokenList.usdx
+ );
+ uint256 bonus = amount - amount.percentDiv(liquidationBonus);
+ uint256 protocolFee = bonus.percentMul(reserveData.configuration.getLiquidationProtocolFee());
+ assertEq(IERC20(tokenList.usdx).balanceOf(liquidator), amount - protocolFee);
+ }
+
+ function _mintTestnetToken(address erc20, address user, uint256 amount) internal {
+ vm.prank(poolAdmin);
+ TestnetERC20(erc20).mint(user, amount);
+ }
+
+ function _supplyToPool(address erc20, address user, uint256 amount) internal {
+ vm.startPrank(user);
+ IERC20(erc20).approve(address(contracts.poolProxy), amount);
+ contracts.poolProxy.supply(erc20, amount, user, 0);
+ vm.stopPrank();
+ }
+
+ function _borrowMaxLt(address erc20, address user) internal {
+ (uint256 totalCollateralBase, , , uint256 currentLt, , ) = contracts
+ .poolProxy
+ .getUserAccountData(user);
+ uint256 maxBorrowInBase = (totalCollateralBase * currentLt) / 1e4;
+ uint256 debtPrice = contracts.aaveOracle.getAssetPrice(erc20);
+ uint256 borrowAmount = (maxBorrowInBase / debtPrice) * 10 ** TestnetERC20(erc20).decimals();
+ _borrowArbitraryAmount(erc20, user, borrowAmount);
+ }
+
+ function _borrowArbitraryAmount(address erc20, address user, uint256 amount) internal {
+ _mintTestnetToken(erc20, bob, amount); // todo: better not bob
+ _supplyToPool(erc20, bob, amount);
+
+ vm.mockCall(
+ address(contracts.aaveOracle),
+ abi.encodeWithSelector(IPriceOracleGetter.getAssetPrice.selector, address(erc20)),
+ abi.encode(0)
+ );
+ vm.prank(user);
+ contracts.poolProxy.borrow(erc20, amount, 2, 0, user);
+ vm.clearMockedCalls();
+ }
+}
diff --git a/tests/core/Pool.FlashLoans.t.sol b/tests/protocol/pool/Pool.FlashLoans.t.sol
similarity index 88%
rename from tests/core/Pool.FlashLoans.t.sol
rename to tests/protocol/pool/Pool.FlashLoans.t.sol
index 60985f9f..d30f87a5 100644
--- a/tests/core/Pool.FlashLoans.t.sol
+++ b/tests/protocol/pool/Pool.FlashLoans.t.sol
@@ -3,20 +3,20 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
-import {TestnetERC20} from 'aave-v3-periphery/contracts/mocks/testnet-helpers/TestnetERC20.sol';
-import {ReserveConfiguration} from 'aave-v3-core/contracts/protocol/pool/PoolConfigurator.sol';
-import {WadRayMath} from 'aave-v3-core/contracts/protocol/libraries/math/WadRayMath.sol';
-import {FlashLoanLogic} from 'aave-v3-core/contracts/protocol/libraries/logic/FlashLoanLogic.sol';
-import {BorrowLogic} from 'aave-v3-core/contracts/protocol/libraries/logic/BorrowLogic.sol';
-import {PercentageMath} from 'aave-v3-core/contracts/protocol/libraries/math/PercentageMath.sol';
-import {MockFlashLoanReceiver} from 'aave-v3-core/contracts/mocks/flashloan/MockFlashLoanReceiver.sol';
-import {MockFlashLoanSimpleReceiver} from 'aave-v3-core/contracts/mocks/flashloan/MockSimpleFlashLoanReceiver.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
-import {DataTypes} from 'aave-v3-core/contracts/protocol/libraries/types/DataTypes.sol';
-import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
-import {MockFlashLoanATokenReceiver} from '../mocks/MockFlashLoanATokenReceiver.sol';
-import {TestnetProcedures, TestReserveConfig} from '../utils/TestnetProcedures.sol';
+import {Errors} from '../../../src/contracts/protocol/libraries/helpers/Errors.sol';
+import {TestnetERC20} from '../../../src/contracts/mocks/testnet-helpers/TestnetERC20.sol';
+import {ReserveConfiguration} from '../../../src/contracts/protocol/pool/PoolConfigurator.sol';
+import {WadRayMath} from '../../../src/contracts/protocol/libraries/math/WadRayMath.sol';
+import {FlashLoanLogic} from '../../../src/contracts/protocol/libraries/logic/FlashLoanLogic.sol';
+import {BorrowLogic} from '../../../src/contracts/protocol/libraries/logic/BorrowLogic.sol';
+import {PercentageMath} from '../../../src/contracts/protocol/libraries/math/PercentageMath.sol';
+import {MockFlashLoanReceiver} from '../../../src/contracts/mocks/flashloan/MockFlashLoanReceiver.sol';
+import {MockFlashLoanSimpleReceiver} from '../../../src/contracts/mocks/flashloan/MockSimpleFlashLoanReceiver.sol';
+import {IPoolAddressesProvider} from '../../../src/contracts/interfaces/IPoolAddressesProvider.sol';
+import {DataTypes} from '../../../src/contracts/protocol/libraries/types/DataTypes.sol';
+import {IERC20} from '../../../src/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
+import {MockFlashLoanATokenReceiver} from '../../mocks/MockFlashLoanATokenReceiver.sol';
+import {TestnetProcedures, TestReserveConfig} from '../../utils/TestnetProcedures.sol';
contract PoolFlashLoansTests is TestnetProcedures {
using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
@@ -419,6 +419,27 @@ contract PoolFlashLoansTests is TestnetProcedures {
);
}
+ function test_revert_flashloan_borrow_stable() public {
+ (
+ address[] memory assets,
+ uint256[] memory amounts,
+ uint256[] memory modes,
+ bytes memory emptyParams
+ ) = _defaultInput(false, 1);
+
+ vm.prank(alice);
+ vm.expectRevert(bytes(Errors.INVALID_INTEREST_RATE_MODE_SELECTED));
+ contracts.poolProxy.flashLoan(
+ address(mockFlashReceiver),
+ assets,
+ amounts,
+ modes,
+ alice,
+ emptyParams,
+ 0
+ );
+ }
+
function _defaultInput()
internal
returns (address[] memory, uint256[] memory, uint256[] memory, bytes memory)
@@ -438,13 +459,12 @@ contract PoolFlashLoansTests is TestnetProcedures {
assets[0] = tokenList.usdx;
amounts[0] = 12e6;
modes[0] = mode;
+ for (uint8 x; x < assets.length; x++) {
+ vm.prank(poolAdmin);
+ TestnetERC20(assets[x]).transferOwnership(address(mockFlashReceiver));
+ }
if (checkEvents) {
- for (uint8 x; x < assets.length; x++) {
- vm.prank(poolAdmin);
- TestnetERC20(assets[x]).transferOwnership(address(mockFlashReceiver));
- }
-
_checkFlashLoanEvents(assets, amounts, modes);
}
return (assets, amounts, modes, emptyParams);
@@ -493,7 +513,7 @@ contract PoolFlashLoansTests is TestnetProcedures {
alice,
amounts[x],
DataTypes.InterestRateMode(modes[x]),
- _calculateInterestRates(amounts[x], modes[x], assets[x]),
+ _calculateInterestRates(amounts[x], assets[x]),
0
);
}
diff --git a/tests/core/Pool.Liquidations.t.sol b/tests/protocol/pool/Pool.Liquidations.t.sol
similarity index 88%
rename from tests/core/Pool.Liquidations.t.sol
rename to tests/protocol/pool/Pool.Liquidations.t.sol
index 65391f74..66dfc23e 100644
--- a/tests/core/Pool.Liquidations.t.sol
+++ b/tests/protocol/pool/Pool.Liquidations.t.sol
@@ -3,23 +3,22 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {IStableDebtToken} from 'aave-v3-core/contracts/interfaces/IStableDebtToken.sol';
-import {IVariableDebtToken} from 'aave-v3-core/contracts/interfaces/IVariableDebtToken.sol';
-import {IAaveOracle} from 'aave-v3-core/contracts/interfaces/IAaveOracle.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
-import {IAToken} from 'aave-v3-core/contracts/interfaces/IAToken.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
-import {UserConfiguration} from 'aave-v3-core/contracts/protocol/libraries/configuration/UserConfiguration.sol';
-import {ReserveLogic, IERC20} from 'aave-v3-core/contracts/protocol/libraries/logic/ReserveLogic.sol';
-import {ReserveConfiguration} from 'aave-v3-core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
-import {PriceOracleSentinel} from 'aave-v3-core/contracts/protocol/configuration/PriceOracleSentinel.sol';
-import {SequencerOracle, ISequencerOracle} from 'aave-v3-core/contracts/mocks/oracle/SequencerOracle.sol';
-import {MockAggregator} from 'aave-v3-core/contracts/mocks/oracle/CLAggregators/MockAggregator.sol';
-import {LiquidationLogic} from 'aave-v3-core/contracts/protocol/libraries/logic/LiquidationLogic.sol';
-import {DataTypes} from 'aave-v3-core/contracts/protocol/libraries/types/DataTypes.sol';
-import {PercentageMath} from 'aave-v3-core/contracts/protocol/libraries/math/PercentageMath.sol';
-import {WadRayMath} from 'aave-v3-core/contracts/protocol/libraries/math/WadRayMath.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
+import {IVariableDebtToken} from '../../../src/contracts/interfaces/IVariableDebtToken.sol';
+import {IAaveOracle} from '../../../src/contracts/interfaces/IAaveOracle.sol';
+import {IPoolAddressesProvider} from '../../../src/contracts/interfaces/IPoolAddressesProvider.sol';
+import {IAToken} from '../../../src/contracts/interfaces/IAToken.sol';
+import {Errors} from '../../../src/contracts/protocol/libraries/helpers/Errors.sol';
+import {UserConfiguration} from '../../../src/contracts/protocol/libraries/configuration/UserConfiguration.sol';
+import {ReserveLogic, IERC20} from '../../../src/contracts/protocol/libraries/logic/ReserveLogic.sol';
+import {ReserveConfiguration} from '../../../src/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
+import {PriceOracleSentinel} from '../../../src/contracts/misc/PriceOracleSentinel.sol';
+import {SequencerOracle, ISequencerOracle} from '../../../src/contracts/mocks/oracle/SequencerOracle.sol';
+import {MockAggregator} from '../../../src/contracts/mocks/oracle/CLAggregators/MockAggregator.sol';
+import {LiquidationLogic} from '../../../src/contracts/protocol/libraries/logic/LiquidationLogic.sol';
+import {DataTypes} from '../../../src/contracts/protocol/libraries/types/DataTypes.sol';
+import {PercentageMath} from '../../../src/contracts/protocol/libraries/math/PercentageMath.sol';
+import {WadRayMath} from '../../../src/contracts/protocol/libraries/math/WadRayMath.sol';
+import {TestnetProcedures} from '../../utils/TestnetProcedures.sol';
contract PoolLiquidationTests is TestnetProcedures {
using stdStorage for StdStorage;
@@ -31,7 +30,6 @@ contract PoolLiquidationTests is TestnetProcedures {
using ReserveLogic for DataTypes.ReserveCache;
using ReserveLogic for DataTypes.ReserveData;
- IStableDebtToken internal staDebtUSDX;
IVariableDebtToken internal varDebtUSDX;
address internal aUSDX;
@@ -45,11 +43,10 @@ contract PoolLiquidationTests is TestnetProcedures {
function setUp() public {
initTestEnvironment();
- (address atoken, address stableDebtUSDX, address variableDebtUSDX) = contracts
+ (address atoken, , address variableDebtUSDX) = contracts
.protocolDataProvider
.getReserveTokensAddresses(tokenList.usdx);
aUSDX = atoken;
- staDebtUSDX = IStableDebtToken(stableDebtUSDX);
varDebtUSDX = IVariableDebtToken(variableDebtUSDX);
vm.startPrank(carol);
@@ -57,9 +54,6 @@ contract PoolLiquidationTests is TestnetProcedures {
contracts.poolProxy.supply(tokenList.weth, 100e18, carol, 0);
vm.stopPrank();
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setReserveStableRateBorrowing(tokenList.usdx, true);
-
sequencerOracleMock = new SequencerOracle(poolAdmin);
priceOracleSentinel = new PriceOracleSentinel(
IPoolAddressesProvider(report.poolAddressesProvider),
@@ -621,16 +615,10 @@ contract PoolLiquidationTests is TestnetProcedures {
EModeCategoryInput memory ct = _genCategoryOne();
vm.startPrank(poolAdmin);
- contracts.poolConfiguratorProxy.setEModeCategory(
- ct.id,
- ct.ltv,
- ct.lt,
- ct.lb,
- ct.oracle,
- ct.label
- );
- contracts.poolConfiguratorProxy.setAssetEModeCategory(tokenList.wbtc, ct.id);
- contracts.poolConfiguratorProxy.setAssetEModeCategory(tokenList.weth, ct.id);
+ contracts.poolConfiguratorProxy.setEModeCategory(ct.id, ct.ltv, ct.lt, ct.lb, ct.label);
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.wbtc, ct.id, true);
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.weth, ct.id, true);
+ contracts.poolConfiguratorProxy.setAssetBorrowableInEMode(tokenList.weth, ct.id, true);
vm.stopPrank();
uint256 amount = 1e8;
@@ -690,80 +678,6 @@ contract PoolLiquidationTests is TestnetProcedures {
_afterLiquidationChecksVariable(params, bob, liquidatorBalanceBefore, userDebtBefore);
}
- function test_liquidate_emode_position_with_emode_oracle() public {
- EModeCategoryInput memory ct = _genCategoryOne();
-
- vm.startPrank(poolAdmin);
- contracts.poolConfiguratorProxy.setEModeCategory(
- ct.id,
- ct.ltv,
- ct.lt,
- ct.lb,
- tokenList.wbtc,
- ct.label
- );
- contracts.poolConfiguratorProxy.setAssetEModeCategory(tokenList.wbtc, ct.id);
- contracts.poolConfiguratorProxy.setAssetEModeCategory(tokenList.weth, ct.id);
- vm.stopPrank();
-
- uint256 amount = 1e8;
- uint256 borrowAmount = 0.94e18;
-
- vm.startPrank(alice);
- contracts.poolProxy.setUserEMode(ct.id);
-
- contracts.poolProxy.supply(tokenList.wbtc, amount, alice, 0);
- contracts.poolProxy.borrow(tokenList.weth, borrowAmount, 2, 0, alice);
- vm.stopPrank();
-
- vm.warp(block.timestamp + 20000 days);
-
- LiquidationInput memory params = _loadLiquidationInput(
- alice,
- tokenList.wbtc,
- tokenList.weth,
- UINT256_MAX,
- tokenList.wbtc,
- 0
- );
- (, , address varDebtToken) = contracts.protocolDataProvider.getReserveTokensAddresses(
- params.debtAsset
- );
- uint256 userDebtBefore = IERC20(varDebtToken).balanceOf(params.user);
- uint256 liquidatorBalanceBefore;
- if (params.receiveAToken) {
- (address atoken, , ) = contracts.protocolDataProvider.getReserveTokensAddresses(
- params.collateralAsset
- );
- liquidatorBalanceBefore = IERC20(atoken).balanceOf(bob);
- } else {
- liquidatorBalanceBefore = IERC20(params.collateralAsset).balanceOf(bob);
- }
-
- vm.expectEmit(address(contracts.poolProxy));
- emit LiquidationLogic.LiquidationCall(
- params.collateralAsset,
- params.debtAsset,
- params.user,
- params.actualDebtToLiquidate,
- params.actualCollateralToLiquidate,
- bob,
- params.receiveAToken
- );
-
- // Liquidate
- vm.prank(bob);
- contracts.poolProxy.liquidationCall(
- params.collateralAsset,
- params.debtAsset,
- params.user,
- params.liquidationAmountInput,
- params.receiveAToken
- );
-
- _afterLiquidationChecksVariable(params, bob, liquidatorBalanceBefore, userDebtBefore);
- }
-
function _loadLiquidationInput(
address user,
address collateralAsset,
@@ -1095,12 +1009,10 @@ contract PoolLiquidationTests is TestnetProcedures {
) internal view returns (uint256, address, address) {
uint256 id = contracts.poolProxy.getUserEMode(user);
if (id != 0) {
- DataTypes.EModeCategory memory cat = contracts.poolProxy.getEModeCategoryData(uint8(id));
- if (cat.priceSource != address(0)) {
- return (cat.liquidationBonus, cat.priceSource, cat.priceSource);
- } else {
- return (cat.liquidationBonus, collateralAsset, debtAsset);
- }
+ DataTypes.CollateralConfig memory cfg = contracts.poolProxy.getEModeCategoryCollateralConfig(
+ uint8(id)
+ );
+ return (cfg.liquidationBonus, collateralAsset, debtAsset);
} else {
DataTypes.ReserveConfigurationMap memory conf = contracts.poolProxy.getConfiguration(
debtAsset
@@ -1152,11 +1064,9 @@ contract PoolLiquidationTests is TestnetProcedures {
tempReserveData.currentLiquidityRate = reserveDataLegacy.currentLiquidityRate;
tempReserveData.variableBorrowIndex = reserveDataLegacy.variableBorrowIndex;
tempReserveData.currentVariableBorrowRate = reserveDataLegacy.currentVariableBorrowRate;
- tempReserveData.currentStableBorrowRate = reserveDataLegacy.currentStableBorrowRate;
tempReserveData.lastUpdateTimestamp = reserveDataLegacy.lastUpdateTimestamp;
tempReserveData.id = reserveDataLegacy.id;
tempReserveData.aTokenAddress = reserveDataLegacy.aTokenAddress;
- tempReserveData.stableDebtTokenAddress = reserveDataLegacy.stableDebtTokenAddress;
tempReserveData.variableDebtTokenAddress = reserveDataLegacy.variableDebtTokenAddress;
tempReserveData.interestRateStrategyAddress = reserveDataLegacy.interestRateStrategyAddress;
tempReserveData.accruedToTreasury = reserveDataLegacy.accruedToTreasury;
diff --git a/tests/core/Pool.Repay.t.sol b/tests/protocol/pool/Pool.Repay.t.sol
similarity index 92%
rename from tests/core/Pool.Repay.t.sol
rename to tests/protocol/pool/Pool.Repay.t.sol
index 25530d81..84a39ccb 100644
--- a/tests/core/Pool.Repay.t.sol
+++ b/tests/protocol/pool/Pool.Repay.t.sol
@@ -3,24 +3,22 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {IStableDebtToken} from 'aave-v3-core/contracts/interfaces/IStableDebtToken.sol';
-import {IVariableDebtToken} from 'aave-v3-core/contracts/interfaces/IVariableDebtToken.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
-import {ISequencerOracle} from 'aave-v3-core/contracts/interfaces/ISequencerOracle.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
-import {TestnetERC20} from 'aave-v3-periphery/contracts/mocks/testnet-helpers/TestnetERC20.sol';
-import {UserConfiguration} from 'aave-v3-core/contracts/protocol/libraries/configuration/UserConfiguration.sol';
-import {PriceOracleSentinel} from 'aave-v3-core/contracts/protocol/configuration/PriceOracleSentinel.sol';
-import {SequencerOracle} from 'aave-v3-core/contracts/mocks/oracle/SequencerOracle.sol';
-import {BorrowLogic, IERC20} from 'aave-v3-core/contracts/protocol/libraries/logic/BorrowLogic.sol';
-import {DataTypes} from 'aave-v3-core/contracts/protocol/libraries/types/DataTypes.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
-import {EIP712SigUtils} from '../utils/EIP712SigUtils.sol';
+import {IVariableDebtToken} from '../../../src/contracts/interfaces/IVariableDebtToken.sol';
+import {IPoolAddressesProvider} from '../../../src/contracts/interfaces/IPoolAddressesProvider.sol';
+import {ISequencerOracle} from '../../../src/contracts/interfaces/ISequencerOracle.sol';
+import {Errors} from '../../../src/contracts/protocol/libraries/helpers/Errors.sol';
+import {TestnetERC20} from '../../../src/contracts/mocks/testnet-helpers/TestnetERC20.sol';
+import {UserConfiguration} from '../../../src/contracts/protocol/libraries/configuration/UserConfiguration.sol';
+import {PriceOracleSentinel} from '../../../src/contracts/misc/PriceOracleSentinel.sol';
+import {SequencerOracle} from '../../../src/contracts/mocks/oracle/SequencerOracle.sol';
+import {BorrowLogic, IERC20} from '../../../src/contracts/protocol/libraries/logic/BorrowLogic.sol';
+import {DataTypes} from '../../../src/contracts/protocol/libraries/types/DataTypes.sol';
+import {TestnetProcedures} from '../../utils/TestnetProcedures.sol';
+import {EIP712SigUtils} from '../../utils/EIP712SigUtils.sol';
contract PoolRepayTests is TestnetProcedures {
using UserConfiguration for DataTypes.UserConfigurationMap;
- IStableDebtToken internal staDebtUSDX;
IVariableDebtToken internal varDebtUSDX;
address internal aUSDX;
@@ -32,20 +30,16 @@ contract PoolRepayTests is TestnetProcedures {
function setUp() public {
initTestEnvironment();
- (address atoken, address stableDebtUSDX, address variableDebtUSDX) = contracts
+ (address atoken, , address variableDebtUSDX) = contracts
.protocolDataProvider
.getReserveTokensAddresses(tokenList.usdx);
aUSDX = atoken;
- staDebtUSDX = IStableDebtToken(stableDebtUSDX);
varDebtUSDX = IVariableDebtToken(variableDebtUSDX);
vm.startPrank(carol);
contracts.poolProxy.supply(tokenList.usdx, 100_000e6, carol, 0);
vm.stopPrank();
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setReserveStableRateBorrowing(tokenList.usdx, true);
-
sequencerOracleMock = new SequencerOracle(poolAdmin);
priceOracleSentinel = new PriceOracleSentinel(
IPoolAddressesProvider(report.poolAddressesProvider),
@@ -94,6 +88,20 @@ contract PoolRepayTests is TestnetProcedures {
);
}
+ function test_revert_repay_full_stable_borrow() public {
+ uint256 amount = 2000e6;
+ uint256 borrowAmount = 800e6;
+ vm.startPrank(alice);
+
+ contracts.poolProxy.supply(tokenList.usdx, amount, alice, 0);
+ contracts.poolProxy.borrow(tokenList.usdx, borrowAmount, 2, 0, alice);
+ vm.warp(block.timestamp + 10 days);
+
+ vm.expectRevert(bytes(Errors.INVALID_INTEREST_RATE_MODE_SELECTED));
+ contracts.poolProxy.repay(tokenList.usdx, UINT256_MAX, 1, alice);
+ vm.stopPrank();
+ }
+
function test_repayWithATokens_full_variable_borrow() public {
uint256 amount = 2000e6;
uint256 borrowAmount = 800e6;
diff --git a/tests/core/Pool.Supply.t.sol b/tests/protocol/pool/Pool.Supply.t.sol
similarity index 95%
rename from tests/core/Pool.Supply.t.sol
rename to tests/protocol/pool/Pool.Supply.t.sol
index 507c4da9..12cc4135 100644
--- a/tests/core/Pool.Supply.t.sol
+++ b/tests/protocol/pool/Pool.Supply.t.sol
@@ -3,12 +3,12 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {IPool} from 'aave-v3-core/contracts/interfaces/IPool.sol';
-import {IAToken, IERC20} from 'aave-v3-core/contracts/interfaces/IAToken.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
-import {TestnetERC20, IERC20WithPermit} from 'aave-v3-periphery/contracts/mocks/testnet-helpers/TestnetERC20.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
-import {EIP712SigUtils} from '../utils/EIP712SigUtils.sol';
+import {IPool} from '../../../src/contracts/interfaces/IPool.sol';
+import {IAToken, IERC20} from '../../../src/contracts/interfaces/IAToken.sol';
+import {Errors} from '../../../src/contracts/protocol/libraries/helpers/Errors.sol';
+import {TestnetERC20, IERC20WithPermit} from '../../../src/contracts/mocks/testnet-helpers/TestnetERC20.sol';
+import {TestnetProcedures} from '../../utils/TestnetProcedures.sol';
+import {EIP712SigUtils} from '../../utils/EIP712SigUtils.sol';
contract PoolSupplyTests is TestnetProcedures {
IPool internal pool;
diff --git a/tests/core/Pool.Withdraw.t.sol b/tests/protocol/pool/Pool.Withdraw.t.sol
similarity index 97%
rename from tests/core/Pool.Withdraw.t.sol
rename to tests/protocol/pool/Pool.Withdraw.t.sol
index bb5fc57f..05598338 100644
--- a/tests/core/Pool.Withdraw.t.sol
+++ b/tests/protocol/pool/Pool.Withdraw.t.sol
@@ -3,9 +3,9 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {IAToken, IERC20} from 'aave-v3-core/contracts/interfaces/IAToken.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
+import {IAToken, IERC20} from '../../../src/contracts/interfaces/IAToken.sol';
+import {Errors} from '../../../src/contracts/protocol/libraries/helpers/Errors.sol';
+import {TestnetProcedures} from '../../utils/TestnetProcedures.sol';
contract PoolWithdrawTests is TestnetProcedures {
address internal aUSDX;
diff --git a/tests/core/Pool.t.sol b/tests/protocol/pool/Pool.t.sol
similarity index 86%
rename from tests/core/Pool.t.sol
rename to tests/protocol/pool/Pool.t.sol
index 3f982b2b..6aec766a 100644
--- a/tests/core/Pool.t.sol
+++ b/tests/protocol/pool/Pool.t.sol
@@ -4,15 +4,15 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
import 'forge-std/StdStorage.sol';
-import {IAToken, IERC20} from 'aave-v3-core/contracts/interfaces/IAToken.sol';
-import {IPool, DataTypes} from 'aave-v3-core/contracts/interfaces/IPool.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
-import {PoolInstance} from 'aave-v3-core/instances/PoolInstance.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
-import {ReserveConfiguration} from 'aave-v3-core/contracts/protocol/pool/PoolConfigurator.sol';
-import {WadRayMath} from 'aave-v3-core/contracts/protocol/libraries/math/WadRayMath.sol';
-import {IAaveOracle} from 'aave-v3-core/contracts/interfaces/IAaveOracle.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
+import {IAToken, IERC20} from '../../../src/contracts/interfaces/IAToken.sol';
+import {IPool, DataTypes} from '../../../src/contracts/interfaces/IPool.sol';
+import {IPoolAddressesProvider} from '../../../src/contracts/interfaces/IPoolAddressesProvider.sol';
+import {PoolInstance} from '../../../src/contracts/instances/PoolInstance.sol';
+import {Errors} from '../../../src/contracts/protocol/libraries/helpers/Errors.sol';
+import {ReserveConfiguration} from '../../../src/contracts/protocol/pool/PoolConfigurator.sol';
+import {WadRayMath} from '../../../src/contracts/protocol/libraries/math/WadRayMath.sol';
+import {IAaveOracle} from '../../../src/contracts/interfaces/IAaveOracle.sol';
+import {TestnetProcedures} from '../../utils/TestnetProcedures.sol';
contract PoolTests is TestnetProcedures {
using stdStorage for StdStorage;
@@ -60,12 +60,6 @@ contract PoolTests is TestnetProcedures {
bool useATokens
);
- event SwapBorrowRateMode(
- address indexed reserve,
- address indexed user,
- DataTypes.InterestRateMode interestRateMode
- );
-
event IsolationModeTotalDebtUpdated(address indexed asset, uint256 totalDebt);
event UserEModeSet(address indexed user, uint8 categoryId);
@@ -74,8 +68,6 @@ contract PoolTests is TestnetProcedures {
event ReserveUsedAsCollateralDisabled(address indexed reserve, address indexed user);
- event RebalanceStableBorrowRate(address indexed reserve, address indexed user);
-
event FlashLoan(
address indexed target,
address initiator,
@@ -116,7 +108,6 @@ contract PoolTests is TestnetProcedures {
p.initialize(IPoolAddressesProvider(report.poolAddressesProvider));
// Default values after deployment and initialized
- assertEq(p.MAX_STABLE_RATE_BORROW_SIZE_PERCENT(), 2500);
assertEq(p.MAX_NUMBER_RESERVES(), 128);
assertEq(address(p.ADDRESSES_PROVIDER()), report.poolAddressesProvider);
assertEq(p.FLASHLOAN_PREMIUM_TOTAL(), 0);
@@ -129,7 +120,7 @@ contract PoolTests is TestnetProcedures {
vm.expectRevert(bytes(Errors.CALLER_NOT_POOL_CONFIGURATOR));
vm.prank(caller);
- pool.initReserve(address(0), address(0), address(0), address(0), address(0));
+ pool.initReserve(address(0), address(0), address(0), address(0));
}
function test_setUserUseReserveAsCollateral_false() public {
@@ -248,10 +239,10 @@ contract PoolTests is TestnetProcedures {
DataTypes.ReserveConfigurationMap memory configuration;
- DataTypes.EModeCategory memory category;
+ DataTypes.EModeCategoryBaseConfiguration memory category;
vm.expectRevert(bytes(Errors.CALLER_NOT_POOL_CONFIGURATOR));
- pool.initReserve(address(0), address(0), address(0), address(0), address(0));
+ pool.initReserve(address(0), address(0), address(0), address(0));
vm.expectRevert(bytes(Errors.CALLER_NOT_POOL_CONFIGURATOR));
pool.dropReserve(address(0));
@@ -283,7 +274,7 @@ contract PoolTests is TestnetProcedures {
tokenList.usdx
);
assertTrue(pA != address(0));
- assertTrue(pS != address(0));
+ assertTrue(pS == address(0));
assertTrue(pV != address(0));
vm.prank(report.poolConfiguratorProxy);
@@ -301,7 +292,7 @@ contract PoolTests is TestnetProcedures {
uint256 reserveFactor,
bool usageAsCollateralEnabled,
bool borrowingEnabled,
- bool stableBorrowRateEnabled,
+ ,
bool isActive,
bool isFrozen
) = contracts.protocolDataProvider.getReserveConfigurationData(tokenList.usdx);
@@ -316,7 +307,6 @@ contract PoolTests is TestnetProcedures {
assertEq(reserveFactor, 0);
assertEq(usageAsCollateralEnabled, false);
assertEq(borrowingEnabled, false);
- assertEq(stableBorrowRateEnabled, false);
assertEq(isActive, false);
assertEq(isFrozen, false);
}
@@ -375,7 +365,7 @@ contract PoolTests is TestnetProcedures {
address strategy
) public {
address[] memory listedAssets = contracts.poolProxy.getReservesList();
- for (uint i = 0; i < listedAssets.length; i++) {
+ for (uint256 i = 0; i < listedAssets.length; i++) {
vm.assume(asset != listedAssets[i]);
}
@@ -505,16 +495,9 @@ contract PoolTests is TestnetProcedures {
function test_setUserEmode() public {
EModeCategoryInput memory ct = _genCategoryOne();
vm.startPrank(poolAdmin);
- contracts.poolConfiguratorProxy.setEModeCategory(
- ct.id,
- ct.ltv,
- ct.lt,
- ct.lb,
- ct.oracle,
- ct.label
- );
- contracts.poolConfiguratorProxy.setAssetEModeCategory(tokenList.wbtc, ct.id);
- contracts.poolConfiguratorProxy.setAssetEModeCategory(tokenList.weth, ct.id);
+ contracts.poolConfiguratorProxy.setEModeCategory(ct.id, ct.ltv, ct.lt, ct.lb, ct.label);
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.wbtc, ct.id, true);
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.weth, ct.id, true);
vm.stopPrank();
vm.expectEmit(address(contracts.poolProxy));
emit UserEModeSet(alice, ct.id);
@@ -527,27 +510,13 @@ contract PoolTests is TestnetProcedures {
EModeCategoryInput memory ct1 = _genCategoryOne();
EModeCategoryInput memory ct2 = _genCategoryTwo();
vm.startPrank(poolAdmin);
- contracts.poolConfiguratorProxy.setEModeCategory(
- ct1.id,
- ct1.ltv,
- ct1.lt,
- ct1.lb,
- ct1.oracle,
- ct1.label
- );
- contracts.poolConfiguratorProxy.setEModeCategory(
- ct2.id,
- ct2.ltv,
- ct2.lt,
- ct2.lb,
- ct2.oracle,
- ct2.label
- );
+ contracts.poolConfiguratorProxy.setEModeCategory(ct1.id, ct1.ltv, ct1.lt, ct1.lb, ct1.label);
+ contracts.poolConfiguratorProxy.setEModeCategory(ct2.id, ct2.ltv, ct2.lt, ct2.lb, ct2.label);
- contracts.poolConfiguratorProxy.setAssetEModeCategory(tokenList.wbtc, ct1.id);
- contracts.poolConfiguratorProxy.setAssetEModeCategory(tokenList.weth, ct1.id);
- contracts.poolConfiguratorProxy.setAssetEModeCategory(tokenList.wbtc, ct2.id);
- contracts.poolConfiguratorProxy.setAssetEModeCategory(tokenList.usdx, ct2.id);
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.wbtc, ct1.id, true);
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.weth, ct1.id, true);
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.wbtc, ct2.id, true);
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.usdx, ct2.id, true);
vm.stopPrank();
vm.expectEmit(address(contracts.poolProxy));
@@ -572,27 +541,14 @@ contract PoolTests is TestnetProcedures {
EModeCategoryInput memory ct1 = _genCategoryOne();
EModeCategoryInput memory ct2 = _genCategoryTwo();
vm.startPrank(poolAdmin);
- contracts.poolConfiguratorProxy.setEModeCategory(
- ct1.id,
- ct1.ltv,
- ct1.lt,
- ct1.lb,
- ct1.oracle,
- ct1.label
- );
- contracts.poolConfiguratorProxy.setEModeCategory(
- ct2.id,
- ct2.ltv,
- ct2.lt,
- ct2.lb,
- ct2.oracle,
- ct2.label
- );
-
- contracts.poolConfiguratorProxy.setAssetEModeCategory(tokenList.wbtc, ct1.id);
- contracts.poolConfiguratorProxy.setAssetEModeCategory(tokenList.weth, ct1.id);
- contracts.poolConfiguratorProxy.setAssetEModeCategory(tokenList.wbtc, ct2.id);
- contracts.poolConfiguratorProxy.setAssetEModeCategory(tokenList.usdx, ct2.id);
+ contracts.poolConfiguratorProxy.setEModeCategory(ct1.id, ct1.ltv, ct1.lt, ct1.lb, ct1.label);
+ contracts.poolConfiguratorProxy.setEModeCategory(ct2.id, ct2.ltv, ct2.lt, ct2.lb, ct2.label);
+
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.wbtc, ct1.id, true);
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.weth, ct1.id, true);
+ contracts.poolConfiguratorProxy.setAssetBorrowableInEMode(tokenList.weth, ct1.id, true);
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.wbtc, ct2.id, true);
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.usdx, ct2.id, true);
vm.stopPrank();
vm.expectEmit(address(contracts.poolProxy));
@@ -607,7 +563,7 @@ contract PoolTests is TestnetProcedures {
pool.supply(tokenList.wbtc, amount, alice, 0);
pool.borrow(tokenList.weth, borrowAmount, 2, 0, alice);
- vm.expectRevert(bytes(Errors.INCONSISTENT_EMODE_CATEGORY));
+ vm.expectRevert(bytes(Errors.NOT_BORROWABLE_IN_EMODE));
pool.setUserEMode(ct2.id);
vm.stopPrank();
@@ -621,17 +577,11 @@ contract PoolTests is TestnetProcedures {
EModeCategoryInput memory ct1 = _genCategoryOne();
vm.startPrank(poolAdmin);
- contracts.poolConfiguratorProxy.setEModeCategory(
- ct1.id,
- ct1.ltv,
- ct1.lt,
- ct1.lb,
- address(0),
- ct1.label
- );
+ contracts.poolConfiguratorProxy.setEModeCategory(ct1.id, ct1.ltv, ct1.lt, ct1.lb, ct1.label);
- contracts.poolConfiguratorProxy.setAssetEModeCategory(tokenList.wbtc, ct1.id);
- contracts.poolConfiguratorProxy.setAssetEModeCategory(tokenList.weth, ct1.id);
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.wbtc, ct1.id, true);
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.weth, ct1.id, true);
+ contracts.poolConfiguratorProxy.setAssetBorrowableInEMode(tokenList.weth, ct1.id, true);
vm.stopPrank();
vm.prank(alice);
diff --git a/tests/core/PoolConfigurator.ACLModifiers.t.sol b/tests/protocol/pool/pool-configurator/PoolConfigurator.ACLModifiers.t.sol
similarity index 88%
rename from tests/core/PoolConfigurator.ACLModifiers.t.sol
rename to tests/protocol/pool/pool-configurator/PoolConfigurator.ACLModifiers.t.sol
index 4a20bb75..e3dfdfe3 100644
--- a/tests/core/PoolConfigurator.ACLModifiers.t.sol
+++ b/tests/protocol/pool/pool-configurator/PoolConfigurator.ACLModifiers.t.sol
@@ -3,17 +3,22 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
-import {ConfiguratorInputTypes} from 'aave-v3-core/contracts/protocol/pool/PoolConfigurator.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
+import {Errors} from '../../../../src/contracts/protocol/libraries/helpers/Errors.sol';
+import {ConfiguratorInputTypes} from '../../../../src/contracts/protocol/pool/PoolConfigurator.sol';
+import {TestnetProcedures, TestVars} from '../../../utils/TestnetProcedures.sol';
contract PoolConfiguratorACLModifiersTest is TestnetProcedures {
function setUp() public {
initTestEnvironment();
}
- function test_reverts_notAdmin_initReserves(address caller) public {
- ConfiguratorInputTypes.InitReserveInput[] memory input;
+ function test_reverts_notAdmin_initReserves(TestVars memory t, address caller) public {
+ ConfiguratorInputTypes.InitReserveInput[] memory input = _generateInitConfig(
+ t,
+ report,
+ poolAdmin,
+ true
+ );
vm.assume(
!contracts.aclManager.isPoolAdmin(caller) &&
!contracts.aclManager.isAssetListingAdmin(caller) &&
@@ -64,19 +69,6 @@ contract PoolConfiguratorACLModifiersTest is TestnetProcedures {
contracts.poolConfiguratorProxy.updateVariableDebtToken(input);
}
- function test_reverts_notAdmin_updateStableDebtToken(address caller) public {
- ConfiguratorInputTypes.UpdateDebtTokenInput memory input;
- vm.assume(
- !contracts.aclManager.isPoolAdmin(caller) &&
- caller != address(contracts.poolAddressesProvider)
- );
-
- vm.expectRevert(bytes(Errors.CALLER_NOT_POOL_ADMIN));
-
- vm.prank(caller);
- contracts.poolConfiguratorProxy.updateStableDebtToken(input);
- }
-
function test_reverts_notAdmin_setReserveActive(address caller) public {
vm.assume(
!contracts.aclManager.isPoolAdmin(caller) &&
@@ -139,19 +131,6 @@ contract PoolConfiguratorACLModifiersTest is TestnetProcedures {
contracts.poolConfiguratorProxy.configureReserveAsCollateral(address(0), 1, 1, 1);
}
- function test_reverts_notRiskAdmin_setReserveStableRateBorrowing(address caller) public {
- vm.assume(
- !contracts.aclManager.isPoolAdmin(caller) &&
- !contracts.aclManager.isRiskAdmin(caller) &&
- caller != address(contracts.poolAddressesProvider)
- );
-
- vm.expectRevert(bytes(Errors.CALLER_NOT_RISK_OR_POOL_ADMIN));
-
- vm.prank(caller);
- contracts.poolConfiguratorProxy.setReserveStableRateBorrowing(address(0), true);
- }
-
function test_reverts_notRiskOrPoolOrEmergencyAdmin_setReserveFreeze(address caller) public {
vm.assume(
!contracts.aclManager.isPoolAdmin(caller) &&
@@ -244,14 +223,13 @@ contract PoolConfiguratorACLModifiersTest is TestnetProcedures {
!contracts.aclManager.isRiskAdmin(caller) &&
caller != address(contracts.poolAddressesProvider)
);
-
vm.expectRevert(bytes(Errors.CALLER_NOT_RISK_OR_POOL_ADMIN));
vm.prank(caller);
- contracts.poolConfiguratorProxy.setEModeCategory(1, 1, 1, 1, address(0), '');
+ contracts.poolConfiguratorProxy.setEModeCategory(1, 1, 1, 1, '');
}
- function test_reverts_notRiskAdmin_setAssetEModeCategory(address caller) public {
+ function test_reverts_notRiskAdmin_setAssetCollateralInEMode(address caller) public {
vm.assume(
!contracts.aclManager.isPoolAdmin(caller) &&
!contracts.aclManager.isRiskAdmin(caller) &&
@@ -261,7 +239,7 @@ contract PoolConfiguratorACLModifiersTest is TestnetProcedures {
vm.expectRevert(bytes(Errors.CALLER_NOT_RISK_OR_POOL_ADMIN));
vm.prank(caller);
- contracts.poolConfiguratorProxy.setAssetEModeCategory(address(0), 1);
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(address(0), 1, true);
}
function test_reverts_setDebtCeiling(address caller) public {
@@ -290,7 +268,6 @@ contract PoolConfiguratorACLModifiersTest is TestnetProcedures {
);
vm.prank(caller);
-
vm.expectRevert(bytes(Errors.CALLER_NOT_POOL_OR_EMERGENCY_ADMIN));
contracts.poolConfiguratorProxy.setReservePause(asset, paused, gracePeriod);
}
diff --git a/tests/core/PoolConfigurator.borrowCaps.t.sol b/tests/protocol/pool/pool-configurator/PoolConfigurator.borrowCaps.t.sol
similarity index 87%
rename from tests/core/PoolConfigurator.borrowCaps.t.sol
rename to tests/protocol/pool/pool-configurator/PoolConfigurator.borrowCaps.t.sol
index 6f347905..59bba274 100644
--- a/tests/core/PoolConfigurator.borrowCaps.t.sol
+++ b/tests/protocol/pool/pool-configurator/PoolConfigurator.borrowCaps.t.sol
@@ -3,10 +3,10 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
-import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
-import {DataTypes} from 'aave-v3-core/contracts/protocol/libraries/types/DataTypes.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
+import {Errors} from '../../../../src/contracts/protocol/libraries/helpers/Errors.sol';
+import {IERC20} from '../../../../src/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
+import {DataTypes} from '../../../../src/contracts/protocol/libraries/types/DataTypes.sol';
+import {TestnetProcedures} from '../../../utils/TestnetProcedures.sol';
contract PoolConfiguratorBorrowCapTests is TestnetProcedures {
address internal aUSDX;
@@ -92,11 +92,10 @@ contract PoolConfiguratorBorrowCapTests is TestnetProcedures {
tokenList.usdx
);
- uint256 stableDebt = IERC20(reserveData.stableDebtTokenAddress).totalSupply();
uint256 variableDebt = IERC20(reserveData.variableDebtTokenAddress).totalSupply();
assertEq(
- stableDebt + variableDebt,
+ variableDebt,
borrowCapUsdx * 10 ** 6,
'Borrow Cap should match same amount than total debt'
);
@@ -119,16 +118,11 @@ contract PoolConfiguratorBorrowCapTests is TestnetProcedures {
tokenList.usdx
);
- uint256 stableDebt = IERC20(reserveData.stableDebtTokenAddress).totalSupply();
uint256 variableDebt = IERC20(reserveData.variableDebtTokenAddress).totalSupply();
(uint256 borrowCapUsdx, ) = contracts.protocolDataProvider.getReserveCaps(tokenList.usdx);
- assertGt(
- stableDebt + variableDebt,
- borrowCapUsdx * 10 ** 6,
- 'Total debt should be greater than cap'
- );
+ assertGt(variableDebt, borrowCapUsdx * 10 ** 6, 'Total debt should be greater than cap');
}
function test_setBorrowCap_them_setBorrowCap_zero() public {
diff --git a/tests/protocol/pool/pool-configurator/PoolConfigurator.eMode.sol b/tests/protocol/pool/pool-configurator/PoolConfigurator.eMode.sol
new file mode 100644
index 00000000..b15dfc4a
--- /dev/null
+++ b/tests/protocol/pool/pool-configurator/PoolConfigurator.eMode.sol
@@ -0,0 +1,273 @@
+// SPDX-License-Identifier: BUSL-1.1
+pragma solidity ^0.8.0;
+
+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;
+
+ event EModeCategoryAdded(
+ uint8 indexed categoryId,
+ uint256 ltv,
+ uint256 liquidationThreshold,
+ uint256 liquidationBonus,
+ address oracle,
+ string label
+ );
+
+ event AssetCollateralInEModeChanged(address indexed asset, uint8 categoryId, bool allowed);
+ event AssetBorrowableInEModeChanged(address indexed asset, uint8 categoryId, bool borrowable);
+
+ function setUp() public {
+ initTestEnvironment();
+ }
+
+ function test_configureEmodeCategory() public {
+ EModeCategoryInput memory ct = _genCategoryOne();
+ vm.expectEmit(address(contracts.poolConfiguratorProxy));
+ emit EModeCategoryAdded(ct.id, ct.ltv, ct.lt, ct.lb, address(0), ct.label);
+
+ vm.prank(poolAdmin);
+ contracts.poolConfiguratorProxy.setEModeCategory(ct.id, ct.ltv, ct.lt, ct.lb, ct.label);
+
+ DataTypes.EModeCategory memory emodeConfig = _getFullEMode(ct.id);
+ assertEq(emodeConfig.ltv, ct.ltv);
+ assertEq(emodeConfig.liquidationThreshold, ct.lt);
+ assertEq(emodeConfig.liquidationBonus, ct.lb);
+ assertEq(emodeConfig.label, ct.label);
+ assertEq(emodeConfig.collateralBitmap, 0);
+ assertEq(emodeConfig.borrowableBitmap, 0);
+ }
+
+ function test_updateEModeCategory() public {
+ test_configureEmodeCategory();
+ EModeCategoryInput memory ct = _genCategoryOne();
+ vm.prank(poolAdmin);
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.wbtc, 1, true);
+ DataTypes.EModeCategory memory ogCategory = _getFullEMode(ct.id);
+ EModeCategoryInput memory updatedCategory = EModeCategoryInput(
+ ct.id,
+ 90_00,
+ 92_00,
+ 101_00,
+ 'GROUP_B'
+ );
+
+ vm.prank(poolAdmin);
+ vm.expectEmit(address(contracts.poolConfiguratorProxy));
+ emit EModeCategoryAdded(
+ ct.id,
+ updatedCategory.ltv,
+ updatedCategory.lt,
+ updatedCategory.lb,
+ address(0),
+ updatedCategory.label
+ );
+
+ contracts.poolConfiguratorProxy.setEModeCategory(
+ ct.id,
+ updatedCategory.ltv,
+ updatedCategory.lt,
+ updatedCategory.lb,
+ updatedCategory.label
+ );
+
+ DataTypes.EModeCategory memory emodeConfig = _getFullEMode(ct.id);
+ assertEq(emodeConfig.ltv, updatedCategory.ltv);
+ assertEq(emodeConfig.liquidationThreshold, updatedCategory.lt);
+ assertEq(emodeConfig.liquidationBonus, updatedCategory.lb);
+ assertEq(emodeConfig.label, updatedCategory.label);
+ assertEq(emodeConfig.collateralBitmap, ogCategory.collateralBitmap);
+ assertEq(emodeConfig.borrowableBitmap, ogCategory.borrowableBitmap);
+ }
+
+ function test_reverts_setEmodeCategory_zero_ltv() public {
+ vm.expectRevert(bytes(Errors.INVALID_EMODE_CATEGORY_PARAMS));
+
+ vm.prank(poolAdmin);
+ contracts.poolConfiguratorProxy.setEModeCategory(1, 0, 80_00, 105_00, 'LABEL');
+ }
+
+ function test_reverts_setEmodeCategory_zero_liqThreshold() public {
+ vm.expectRevert(bytes(Errors.INVALID_EMODE_CATEGORY_PARAMS));
+
+ vm.prank(poolAdmin);
+ contracts.poolConfiguratorProxy.setEModeCategory(1, 80_00, 0, 105_00, 'LABEL');
+ }
+
+ function test_reverts_setEmodeCategory_ltv_gt_liqThreshold() public {
+ vm.expectRevert(bytes(Errors.INVALID_EMODE_CATEGORY_PARAMS));
+
+ vm.prank(poolAdmin);
+ contracts.poolConfiguratorProxy.setEModeCategory(1, 80_00, 79_00, 105_00, 'LABEL');
+ }
+
+ function test_reverts_setEmodeCategory_lb_lte_percentageFactor() public {
+ vm.expectRevert(bytes(Errors.INVALID_EMODE_CATEGORY_PARAMS));
+
+ vm.prank(poolAdmin);
+ contracts.poolConfiguratorProxy.setEModeCategory(1, 80_00, 81_00, 100_00, 'LABEL');
+
+ vm.expectRevert(bytes(Errors.INVALID_EMODE_CATEGORY_PARAMS));
+
+ vm.prank(poolAdmin);
+ contracts.poolConfiguratorProxy.setEModeCategory(1, 80_00, 81_00, 99_00, 'LABEL');
+ }
+
+ function test_reverts_setEmodeCategory_liquidation_threshold_doesnt_match_bonus() public {
+ uint16 liquidationThreshold = 98_00;
+ uint16 liquidationBonus = 120_00;
+ uint256 isBonusNotCovered = uint256(liquidationThreshold).percentMul(liquidationBonus);
+ assertGt(
+ isBonusNotCovered,
+ PercentageMath.PERCENTAGE_FACTOR,
+ 'Input should be gt than percentage factor to revert at "threshold * bonus is required to be less than PERCENTAGE_FACTOR"'
+ );
+ vm.expectRevert(bytes(Errors.INVALID_EMODE_CATEGORY_PARAMS));
+ vm.prank(poolAdmin);
+ contracts.poolConfiguratorProxy.setEModeCategory(
+ 1,
+ 90_00,
+ liquidationThreshold,
+ liquidationBonus,
+ 'LABEL'
+ );
+ }
+
+ function test_setAssetCollateralInEMode() public {
+ EModeCategoryInput memory input = _genCategoryOne();
+ test_configureEmodeCategory();
+ vm.expectEmit(address(contracts.poolConfiguratorProxy));
+ emit AssetCollateralInEModeChanged(tokenList.usdx, input.id, true);
+ vm.prank(poolAdmin);
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.usdx, input.id, true);
+ DataTypes.EModeCategory memory config = _getFullEMode(input.id);
+ DataTypes.ReserveDataLegacy memory reserveData = contracts.poolProxy.getReserveData(
+ tokenList.usdx
+ );
+ assertEq(
+ EModeConfiguration.isReserveEnabledOnBitmap(config.collateralBitmap, reserveData.id),
+ true
+ );
+ }
+
+ function test_addAnotherAssetCollateralInEMode() public {
+ EModeCategoryInput memory input = _genCategoryOne();
+ test_setAssetCollateralInEMode();
+
+ vm.prank(poolAdmin);
+ contracts.poolConfiguratorProxy.setAssetCollateralInEMode(tokenList.wbtc, input.id, true);
+ DataTypes.EModeCategory memory config = _getFullEMode(input.id);
+ DataTypes.ReserveDataLegacy memory reserveDataUSDX = contracts.poolProxy.getReserveData(
+ tokenList.usdx
+ );
+ DataTypes.ReserveDataLegacy memory reserveDataWBTC = contracts.poolProxy.getReserveData(
+ tokenList.wbtc
+ );
+ assertEq(
+ EModeConfiguration.isReserveEnabledOnBitmap(config.collateralBitmap, reserveDataUSDX.id),
+ true
+ );
+ assertEq(
+ EModeConfiguration.isReserveEnabledOnBitmap(config.collateralBitmap, reserveDataWBTC.id),
+ true
+ );
+ }
+
+ 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);
+
+ DataTypes.EModeCategory memory config = _getFullEMode(prevCt.id);
+ DataTypes.ReserveDataLegacy memory reserveData = contracts.poolProxy.getReserveData(
+ tokenList.usdx
+ );
+ assertEq(
+ EModeConfiguration.isReserveEnabledOnBitmap(config.collateralBitmap, 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);
+ DataTypes.EModeCategory memory config = _getFullEMode(input.id);
+ DataTypes.ReserveDataLegacy memory reserveData = contracts.poolProxy.getReserveData(
+ tokenList.usdx
+ );
+ assertEq(
+ EModeConfiguration.isReserveEnabledOnBitmap(config.borrowableBitmap, reserveData.id),
+ true
+ );
+ }
+
+ function test_addAnotherAssetBorrowableInEMode() public {
+ EModeCategoryInput memory input = _genCategoryOne();
+ test_setAssetBorrowableInEMode();
+
+ vm.prank(poolAdmin);
+ contracts.poolConfiguratorProxy.setAssetBorrowableInEMode(tokenList.wbtc, input.id, true);
+ DataTypes.EModeCategory memory config = _getFullEMode(input.id);
+ DataTypes.ReserveDataLegacy memory reserveDataUSDX = contracts.poolProxy.getReserveData(
+ tokenList.usdx
+ );
+ DataTypes.ReserveDataLegacy memory reserveDataWBTC = contracts.poolProxy.getReserveData(
+ tokenList.wbtc
+ );
+ assertEq(
+ EModeConfiguration.isReserveEnabledOnBitmap(config.borrowableBitmap, reserveDataUSDX.id),
+ true
+ );
+ assertEq(
+ EModeConfiguration.isReserveEnabledOnBitmap(config.borrowableBitmap, reserveDataWBTC.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);
+ DataTypes.EModeCategory memory config = _getFullEMode(input.id);
+ DataTypes.ReserveDataLegacy memory reserveData = contracts.poolProxy.getReserveData(
+ tokenList.usdx
+ );
+ assertEq(
+ EModeConfiguration.isReserveEnabledOnBitmap(config.borrowableBitmap, reserveData.id),
+ false
+ );
+ }
+
+ function _getFullEMode(uint8 eMode) internal view returns (DataTypes.EModeCategory memory) {
+ DataTypes.EModeCategory memory eModeCategory;
+ DataTypes.CollateralConfig memory cfg = contracts.poolProxy.getEModeCategoryCollateralConfig(
+ eMode
+ );
+ eModeCategory.ltv = cfg.ltv;
+ eModeCategory.liquidationThreshold = cfg.liquidationThreshold;
+ eModeCategory.liquidationBonus = cfg.liquidationBonus;
+ (eModeCategory.label) = contracts.poolProxy.getEModeCategoryLabel(eMode);
+ (eModeCategory.collateralBitmap) = contracts.poolProxy.getEModeCategoryCollateralBitmap(eMode);
+ (eModeCategory.borrowableBitmap) = contracts.poolProxy.getEModeCategoryBorrowableBitmap(eMode);
+ return eModeCategory;
+ }
+}
diff --git a/tests/protocol/pool/pool-configurator/PoolConfigurator.initReserves.t.sol b/tests/protocol/pool/pool-configurator/PoolConfigurator.initReserves.t.sol
new file mode 100644
index 00000000..672f8291
--- /dev/null
+++ b/tests/protocol/pool/pool-configurator/PoolConfigurator.initReserves.t.sol
@@ -0,0 +1,152 @@
+// SPDX-License-Identifier: BUSL-1.1
+pragma solidity ^0.8.0;
+
+import 'forge-std/Test.sol';
+
+import {AToken} from '../../../../src/contracts/protocol/tokenization/AToken.sol';
+import {Errors} from '../../../../src/contracts/protocol/libraries/helpers/Errors.sol';
+import {TestnetERC20} from '../../../../src/contracts/mocks/testnet-helpers/TestnetERC20.sol';
+import {ConfiguratorInputTypes} from '../../../../src/contracts/protocol/pool/PoolConfigurator.sol';
+import {IDefaultInterestRateStrategyV2} from '../../../../src/contracts/misc/DefaultReserveInterestRateStrategyV2.sol';
+import {TestnetProcedures, TestVars, TestReserveConfig} from '../../../utils/TestnetProcedures.sol';
+
+contract PoolConfiguratorInitReservesTest is TestnetProcedures {
+ event ReserveInitialized(
+ address indexed asset,
+ address indexed aToken,
+ address stableDebtToken,
+ address variableDebtToken,
+ address interestRateStrategyAddress
+ );
+
+ function setUp() public {
+ initTestEnvironment();
+ }
+
+ function test_initReserves_validNumberOfAssets(TestVars[128] memory t, uint8 length) public {
+ vm.assume(length > 0 && length < 128);
+
+ uint256 previousListedAssets = contracts.poolProxy.getReservesList().length;
+ uint256 maxListings = contracts.poolProxy.MAX_NUMBER_RESERVES() - previousListedAssets + 1;
+ vm.assume(length < maxListings);
+
+ ConfiguratorInputTypes.InitReserveInput[]
+ memory input = new ConfiguratorInputTypes.InitReserveInput[](length);
+ for (uint256 i = 0; i < length; i++) {
+ input[i] = _generateInitReserveInput(t[i], report, poolAdmin, true);
+
+ vm.expectEmit(true, false, false, false, address(contracts.poolConfiguratorProxy));
+ emit ReserveInitialized(
+ input[i].underlyingAsset,
+ address(0),
+ address(0),
+ address(0),
+ input[i].interestRateStrategyAddress
+ );
+ }
+ // Perform action
+ vm.prank(poolAdmin);
+ contracts.poolConfiguratorProxy.initReserves(input);
+
+ for (uint256 i = 0; i < length; i++) {
+ ConfiguratorInputTypes.InitReserveInput memory initConfig = input[i];
+ // Perform assertions
+ {
+ (address aTokenProxy, , address variableDebtProxy) = contracts
+ .protocolDataProvider
+ .getReserveTokensAddresses(initConfig.underlyingAsset);
+
+ assertEq(AToken(aTokenProxy).name(), initConfig.aTokenName);
+ assertEq(AToken(aTokenProxy).symbol(), initConfig.aTokenSymbol);
+ assertEq(
+ AToken(aTokenProxy).decimals(),
+ TestnetERC20(initConfig.underlyingAsset).decimals()
+ );
+ assertEq(AToken(aTokenProxy).RESERVE_TREASURY_ADDRESS(), initConfig.treasury);
+ assertEq(AToken(aTokenProxy).UNDERLYING_ASSET_ADDRESS(), initConfig.underlyingAsset);
+ assertEq(
+ address(AToken(aTokenProxy).getIncentivesController()),
+ initConfig.incentivesController
+ );
+
+ assertEq(AToken(variableDebtProxy).name(), initConfig.variableDebtTokenName);
+ assertEq(AToken(variableDebtProxy).symbol(), initConfig.variableDebtTokenSymbol);
+ assertEq(
+ AToken(variableDebtProxy).decimals(),
+ TestnetERC20(initConfig.underlyingAsset).decimals()
+ );
+ assertEq(AToken(variableDebtProxy).UNDERLYING_ASSET_ADDRESS(), initConfig.underlyingAsset);
+ assertEq(
+ address(AToken(variableDebtProxy).getIncentivesController()),
+ initConfig.incentivesController
+ );
+ }
+ // Perform default asset checks
+ TestReserveConfig memory c = _getReserveConfig(
+ initConfig.underlyingAsset,
+ report.protocolDataProvider
+ );
+
+ assertEq(c.isActive, true);
+ assertEq(c.isFrozen, false);
+ assertEq(c.isPaused, false);
+ assertEq(c.decimals, TestnetERC20(initConfig.underlyingAsset).decimals());
+
+ assertEq(c.ltv, 0);
+ assertEq(c.liquidationThreshold, 0);
+ assertEq(c.liquidationBonus, 0);
+ assertEq(c.reserveFactor, 0);
+ assertEq(c.usageAsCollateralEnabled, false);
+ assertEq(c.borrowingEnabled, false);
+ assertEq(c.isVirtualAccActive, initConfig.useVirtualBalance);
+ }
+ assertEq(contracts.poolProxy.getReservesList().length, previousListedAssets + length);
+ }
+
+ function test_initReserves_zeroAssets() public {
+ uint256 previousListedAssets = contracts.poolProxy.getReservesList().length;
+
+ ConfiguratorInputTypes.InitReserveInput[] memory input;
+
+ // Perform action, does not revert but does nothing due empty array, no-op
+ vm.prank(poolAdmin);
+ contracts.poolConfiguratorProxy.initReserves(input);
+
+ assertEq(contracts.poolProxy.getReservesList().length, previousListedAssets);
+ }
+
+ function test_reverts_initReserves_maxAssets(TestVars memory t, uint8 lengthSeed) public {
+ uint256 previousListedAssets = contracts.poolProxy.getReservesList().length;
+
+ uint256 maxListings = contracts.poolProxy.MAX_NUMBER_RESERVES() - previousListedAssets + 1;
+ uint256 length = maxListings + lengthSeed;
+
+ ConfiguratorInputTypes.InitReserveInput[]
+ memory input = new ConfiguratorInputTypes.InitReserveInput[](length);
+ for (uint256 i = 0; i < length; i++)
+ input[i] = _generateInitReserveInput(t, report, poolAdmin, true);
+
+ vm.expectRevert(bytes(Errors.NO_MORE_RESERVES_ALLOWED));
+ vm.prank(poolAdmin);
+ contracts.poolConfiguratorProxy.initReserves(input);
+
+ assertEq(contracts.poolProxy.getReservesList().length, previousListedAssets);
+ }
+
+ function test_initReserves_notEnoughDecimal(TestVars memory t) public {
+ vm.assume(t.underlyingDecimals < 6);
+
+ ConfiguratorInputTypes.InitReserveInput[] memory input = _generateInitConfig(
+ t,
+ report,
+ poolAdmin,
+ false
+ );
+
+ vm.expectRevert(bytes(Errors.INVALID_DECIMALS));
+
+ // Perform action
+ vm.prank(poolAdmin);
+ contracts.poolConfiguratorProxy.initReserves(input);
+ }
+}
diff --git a/tests/core/PoolConfigurator.liquidationFee.t.sol b/tests/protocol/pool/pool-configurator/PoolConfigurator.liquidationFee.t.sol
similarity index 94%
rename from tests/core/PoolConfigurator.liquidationFee.t.sol
rename to tests/protocol/pool/pool-configurator/PoolConfigurator.liquidationFee.t.sol
index d509d49d..628485bb 100644
--- a/tests/core/PoolConfigurator.liquidationFee.t.sol
+++ b/tests/protocol/pool/pool-configurator/PoolConfigurator.liquidationFee.t.sol
@@ -3,8 +3,8 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
-import '../utils/TestnetProcedures.sol';
+import {Errors} from '../../../../src/contracts/protocol/libraries/helpers/Errors.sol';
+import '../../../utils/TestnetProcedures.sol';
contract PoolConfiguratorLiquidationFeeTests is TestnetProcedures {
address internal aUSDX;
diff --git a/tests/core/PoolConfigurator.pendingLTV.t.sol b/tests/protocol/pool/pool-configurator/PoolConfigurator.pendingLTV.t.sol
similarity index 92%
rename from tests/core/PoolConfigurator.pendingLTV.t.sol
rename to tests/protocol/pool/pool-configurator/PoolConfigurator.pendingLTV.t.sol
index 828db0d4..3ce52781 100644
--- a/tests/core/PoolConfigurator.pendingLTV.t.sol
+++ b/tests/protocol/pool/pool-configurator/PoolConfigurator.pendingLTV.t.sol
@@ -3,10 +3,10 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
-import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
-import {DataTypes} from 'aave-v3-core/contracts/protocol/libraries/types/DataTypes.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
+import {Errors} from '../../../../src/contracts/protocol/libraries/helpers/Errors.sol';
+import {IERC20} from '../../../../src/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
+import {DataTypes} from '../../../../src/contracts/protocol/libraries/types/DataTypes.sol';
+import {TestnetProcedures} from '../../../utils/TestnetProcedures.sol';
contract PoolConfiguratorPendingLtvTests is TestnetProcedures {
event PendingLtvChanged(address indexed asset, uint256 ltv);
diff --git a/tests/core/PoolConfigurator.reserveRiskConfig.t.sol b/tests/protocol/pool/pool-configurator/PoolConfigurator.reserveRiskConfig.t.sol
similarity index 88%
rename from tests/core/PoolConfigurator.reserveRiskConfig.t.sol
rename to tests/protocol/pool/pool-configurator/PoolConfigurator.reserveRiskConfig.t.sol
index 002a6cea..bcd62e00 100644
--- a/tests/core/PoolConfigurator.reserveRiskConfig.t.sol
+++ b/tests/protocol/pool/pool-configurator/PoolConfigurator.reserveRiskConfig.t.sol
@@ -3,9 +3,9 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
-import {ReserveLogic} from 'aave-v3-core/contracts/protocol/libraries/logic/ReserveLogic.sol';
-import '../utils/TestnetProcedures.sol';
+import {Errors} from '../../../../src/contracts/protocol/libraries/helpers/Errors.sol';
+import {ReserveLogic} from '../../../../src/contracts/protocol/libraries/logic/ReserveLogic.sol';
+import '../../../utils/TestnetProcedures.sol';
contract PoolConfiguratorReserveRiskConfigs is TestnetProcedures {
using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
@@ -22,7 +22,6 @@ contract PoolConfiguratorReserveRiskConfigs is TestnetProcedures {
uint256 liquidationThreshold,
uint256 liquidationBonus
);
- event ReserveStableRateBorrowing(address indexed asset, bool enabled);
event ReserveFrozen(address indexed asset, bool frozen);
event ReservePaused(address indexed asset, bool paused);
event ReserveDropped(address indexed asset);
@@ -58,18 +57,18 @@ contract PoolConfiguratorReserveRiskConfigs is TestnetProcedures {
vm.startPrank(poolAdmin);
wbtc.mint(bob, 100e8);
- contracts.poolConfiguratorProxy.setReserveStableRateBorrowing(tokenList.wbtc, true);
vm.stopPrank();
vm.prank(bob);
contracts.poolProxy.supply(tokenList.wbtc, 100e8, bob, 0);
}
- function test_enableBorrowing() public {
- ConfiguratorInputTypes.InitReserveInput[] memory input = _generateListingInput(
- 1,
+ function test_enableBorrowing(TestVars memory t) public {
+ ConfiguratorInputTypes.InitReserveInput[] memory input = _generateInitConfig(
+ t,
report,
- poolAdmin
+ poolAdmin,
+ true
);
// Perform action
@@ -103,11 +102,12 @@ contract PoolConfiguratorReserveRiskConfigs is TestnetProcedures {
assertEq(borrowingConfigAfter, false);
}
- function test_enableFlashBorrow() public {
- ConfiguratorInputTypes.InitReserveInput[] memory input = _generateListingInput(
- 1,
+ function test_enableFlashBorrow(TestVars memory t) public {
+ ConfiguratorInputTypes.InitReserveInput[] memory input = _generateInitConfig(
+ t,
report,
- poolAdmin
+ poolAdmin,
+ true
);
// Perform action
@@ -130,15 +130,16 @@ contract PoolConfiguratorReserveRiskConfigs is TestnetProcedures {
assertEq(valueAfter, false);
}
- function test_setCollateralConfig() public {
+ function test_setCollateralConfig(TestVars memory t) public {
uint256 ltv = 80_00;
uint256 liquidationThreshold = 85_00;
uint256 liquidationBonus = 105_00;
- ConfiguratorInputTypes.InitReserveInput[] memory input = _generateListingInput(
- 1,
+ ConfiguratorInputTypes.InitReserveInput[] memory input = _generateInitConfig(
+ t,
report,
- poolAdmin
+ poolAdmin,
+ true
);
// Perform action
@@ -169,11 +170,12 @@ contract PoolConfiguratorReserveRiskConfigs is TestnetProcedures {
assertEq(liqBonus, liquidationBonus);
}
- function test_reverts_setCollateralConfig_invalidParams() public {
- ConfiguratorInputTypes.InitReserveInput[] memory input = _generateListingInput(
- 1,
+ function test_reverts_setCollateralConfig_invalidParams(TestVars memory t) public {
+ ConfiguratorInputTypes.InitReserveInput[] memory input = _generateInitConfig(
+ t,
report,
- poolAdmin
+ poolAdmin,
+ true
);
// Perform action
@@ -234,68 +236,6 @@ contract PoolConfiguratorReserveRiskConfigs is TestnetProcedures {
contracts.poolConfiguratorProxy.configureReserveAsCollateral(tokenList.usdx, 0, 0, 0);
}
- function test_enableStableBorrowing() public {
- ConfiguratorInputTypes.InitReserveInput[] memory input = _generateListingInput(
- 1,
- report,
- poolAdmin
- );
-
- // Perform action
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.initReserves(input);
-
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setReserveBorrowing(input[0].underlyingAsset, true);
-
- (, , , , , , , bool borrowingEnabledDefault, , ) = contracts
- .protocolDataProvider
- .getReserveConfigurationData(input[0].underlyingAsset);
- assertEq(borrowingEnabledDefault, false);
-
- vm.expectEmit(address(contracts.poolConfiguratorProxy));
- emit ReserveStableRateBorrowing(input[0].underlyingAsset, true);
-
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setReserveStableRateBorrowing(input[0].underlyingAsset, true);
-
- (, , , , , , , bool borrowingEnabledAfter, , ) = contracts
- .protocolDataProvider
- .getReserveConfigurationData(input[0].underlyingAsset);
- assertEq(borrowingEnabledAfter, true);
-
- vm.expectEmit(address(contracts.poolConfiguratorProxy));
- emit ReserveStableRateBorrowing(input[0].underlyingAsset, false);
-
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setReserveStableRateBorrowing(input[0].underlyingAsset, false);
-
- (, , , , , , , bool borrowingConfigAfter, , ) = contracts
- .protocolDataProvider
- .getReserveConfigurationData(input[0].underlyingAsset);
- assertEq(borrowingConfigAfter, false);
- }
-
- function test_reverts_enableStableBorrowing_borrowNotEnabled() public {
- ConfiguratorInputTypes.InitReserveInput[] memory input = _generateListingInput(
- 1,
- report,
- poolAdmin
- );
-
- // Perform action
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.initReserves(input);
-
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setReserveBorrowing(input[0].underlyingAsset, false);
-
- vm.expectRevert(bytes(Errors.BORROWING_NOT_ENABLED));
-
- vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setReserveStableRateBorrowing(input[0].underlyingAsset, true);
- }
-
function test_reverts_setReserveActive_false_if_suppliers() public {
// Revert due for LQT == 0 there should be no suppliers
vm.prank(alice);
@@ -608,7 +548,7 @@ contract PoolConfiguratorReserveRiskConfigs is TestnetProcedures {
emit ReservePaused(reserves[x], true);
}
vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setPoolPause(true, 0);
+ contracts.poolConfiguratorProxy.setPoolPause(true);
for (uint16 x; x < reserves.length; ++x) {
bool isPaused = contracts.protocolDataProvider.getPaused(reserves[x]);
@@ -624,7 +564,7 @@ contract PoolConfiguratorReserveRiskConfigs is TestnetProcedures {
emit ReservePaused(reserves[x], false);
}
vm.prank(poolAdmin);
- contracts.poolConfiguratorProxy.setPoolPause(false, 0);
+ contracts.poolConfiguratorProxy.setPoolPause(false);
for (uint16 x; x < reserves.length; ++x) {
bool isPaused = contracts.protocolDataProvider.getPaused(reserves[x]);
@@ -691,7 +631,7 @@ contract PoolConfiguratorReserveRiskConfigs is TestnetProcedures {
tokenList.usdx
);
assertTrue(pA != address(0));
- assertTrue(pS != address(0));
+ assertTrue(pS == address(0));
assertTrue(pV != address(0));
vm.prank(poolAdmin);
@@ -709,7 +649,7 @@ contract PoolConfiguratorReserveRiskConfigs is TestnetProcedures {
uint256 reserveFactor,
bool usageAsCollateralEnabled,
bool borrowingEnabled,
- bool stableBorrowRateEnabled,
+ ,
bool isActive,
bool isFrozen
) = contracts.protocolDataProvider.getReserveConfigurationData(tokenList.usdx);
@@ -724,7 +664,6 @@ contract PoolConfiguratorReserveRiskConfigs is TestnetProcedures {
assertEq(reserveFactor, 0);
assertEq(usageAsCollateralEnabled, false);
assertEq(borrowingEnabled, false);
- assertEq(stableBorrowRateEnabled, false);
assertEq(isActive, false);
assertEq(isFrozen, false);
}
@@ -767,7 +706,7 @@ contract PoolConfiguratorReserveRiskConfigs is TestnetProcedures {
}
function test_setLiquidationGracePeriodReserve(uint40 gracePeriod) public {
- vm.assume(gracePeriod < contracts.poolConfiguratorProxy.MAX_GRACE_PERIOD() && gracePeriod != 0);
+ gracePeriod = uint40(bound(gracePeriod, 1, contracts.poolConfiguratorProxy.MAX_GRACE_PERIOD()));
address asset = tokenList.usdx;
@@ -782,19 +721,19 @@ contract PoolConfiguratorReserveRiskConfigs is TestnetProcedures {
assertEq(contracts.poolProxy.getLiquidationGracePeriod(asset), until);
// reserve unpause -> pause, liquidationGracePeriod would not be set
- contracts.poolConfiguratorProxy.setReservePause(asset, true, gracePeriod + 1);
+ contracts.poolConfiguratorProxy.setReservePause(asset, true, gracePeriod);
assertEq(contracts.poolProxy.getLiquidationGracePeriod(asset), until);
assertTrue(contracts.protocolDataProvider.getPaused(asset));
// reserve pause -> pause, liquidationGracePeriod would not be set
- contracts.poolConfiguratorProxy.setReservePause(asset, true, gracePeriod + 1);
+ contracts.poolConfiguratorProxy.setReservePause(asset, true, gracePeriod);
assertEq(contracts.poolProxy.getLiquidationGracePeriod(asset), until);
// reserve pause -> unpause, liquidationGracePeriod would be set
vm.expectEmit(address(contracts.poolConfiguratorProxy));
- emit LiquidationGracePeriodChanged(asset, until + 1);
- contracts.poolConfiguratorProxy.setReservePause(asset, false, gracePeriod + 1);
- assertEq(contracts.poolProxy.getLiquidationGracePeriod(asset), until + 1);
+ emit LiquidationGracePeriodChanged(asset, until);
+ contracts.poolConfiguratorProxy.setReservePause(asset, false, gracePeriod);
+ assertEq(contracts.poolProxy.getLiquidationGracePeriod(asset), until);
vm.stopPrank();
}
diff --git a/tests/core/PoolConfigurator.supplyCaps.t.sol b/tests/protocol/pool/pool-configurator/PoolConfigurator.supplyCaps.t.sol
similarity index 94%
rename from tests/core/PoolConfigurator.supplyCaps.t.sol
rename to tests/protocol/pool/pool-configurator/PoolConfigurator.supplyCaps.t.sol
index a1f7c01f..151d29fe 100644
--- a/tests/core/PoolConfigurator.supplyCaps.t.sol
+++ b/tests/protocol/pool/pool-configurator/PoolConfigurator.supplyCaps.t.sol
@@ -3,9 +3,9 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
-import {IERC20} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
+import {Errors} from '../../../../src/contracts/protocol/libraries/helpers/Errors.sol';
+import {IERC20} from '../../../../src/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
+import {TestnetProcedures} from '../../../utils/TestnetProcedures.sol';
contract PoolConfiguratorSupplyCapTests is TestnetProcedures {
address internal aUSDX;
diff --git a/tests/core/PoolConfigurator.upgradeabilty.t.sol b/tests/protocol/pool/pool-configurator/PoolConfigurator.upgradeabilty.t.sol
similarity index 72%
rename from tests/core/PoolConfigurator.upgradeabilty.t.sol
rename to tests/protocol/pool/pool-configurator/PoolConfigurator.upgradeabilty.t.sol
index 840a4fff..f6bb692a 100644
--- a/tests/core/PoolConfigurator.upgradeabilty.t.sol
+++ b/tests/protocol/pool/pool-configurator/PoolConfigurator.upgradeabilty.t.sol
@@ -3,18 +3,17 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {AToken} from 'aave-v3-core/contracts/protocol/tokenization/AToken.sol';
-import {VariableDebtToken} from 'aave-v3-core/contracts/protocol/tokenization/VariableDebtToken.sol';
-import {StableDebtToken} from 'aave-v3-core/contracts/protocol/tokenization/StableDebtToken.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
-import {ConfiguratorInputTypes, IPool, IPoolAddressesProvider} from 'aave-v3-core/contracts/protocol/pool/PoolConfigurator.sol';
-import {MockATokenRepayment} from 'aave-v3-core/contracts/mocks/tokens/MockATokenRepayment.sol';
-import {MockVariableDebtToken, MockStableDebtToken} from 'aave-v3-core/contracts/mocks/tokens/MockDebtTokens.sol';
-import {DataTypes} from 'aave-v3-core/contracts/protocol/libraries/types/DataTypes.sol';
-import {ReserveLogic} from 'aave-v3-core/contracts/protocol/libraries/logic/ReserveLogic.sol';
-
-import {SlotParser} from '../utils/SlotParser.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
+import {AToken} from '../../../../src/contracts/protocol/tokenization/AToken.sol';
+import {VariableDebtToken} from '../../../../src/contracts/protocol/tokenization/VariableDebtToken.sol';
+import {Errors} from '../../../../src/contracts/protocol/libraries/helpers/Errors.sol';
+import {ConfiguratorInputTypes, IPool, IPoolAddressesProvider} from '../../../../src/contracts/protocol/pool/PoolConfigurator.sol';
+import {MockATokenRepayment} from '../../../../src/contracts/mocks/tokens/MockATokenRepayment.sol';
+import {MockVariableDebtToken} from '../../../../src/contracts/mocks/tokens/MockDebtTokens.sol';
+import {DataTypes} from '../../../../src/contracts/protocol/libraries/types/DataTypes.sol';
+import {ReserveLogic} from '../../../../src/contracts/protocol/libraries/logic/ReserveLogic.sol';
+
+import {SlotParser} from '../../../utils/SlotParser.sol';
+import {TestnetProcedures} from '../../../utils/TestnetProcedures.sol';
contract PoolConfiguratorUpgradeabilityTests is TestnetProcedures {
using stdStorage for StdStorage;
@@ -31,13 +30,9 @@ contract PoolConfiguratorUpgradeabilityTests is TestnetProcedures {
address newStrategy
);
- event ATokenUpgraded(
- address indexed asset,
- address indexed proxy,
- address indexed implementation
- );
+ event ReserveInterestRateDataChanged(address indexed asset, address indexed strategy, bytes data);
- event StableDebtTokenUpgraded(
+ event ATokenUpgraded(
address indexed asset,
address indexed proxy,
address indexed implementation
@@ -85,6 +80,32 @@ contract PoolConfiguratorUpgradeabilityTests is TestnetProcedures {
assertEq(newInterestRateStrategy, updatedInterestsRateStrategy);
}
+ function test_setReserveInterestRateData() public {
+ address currentInterestRateStrategy = contracts
+ .protocolDataProvider
+ .getInterestRateStrategyAddress(tokenList.usdx);
+
+ bytes memory newInterestRateData = _getDefaultInterestRatesStrategyData();
+
+ vm.expectEmit(address(contracts.poolConfiguratorProxy));
+ emit ReserveInterestRateDataChanged(
+ tokenList.usdx,
+ currentInterestRateStrategy,
+ newInterestRateData
+ );
+
+ vm.prank(poolAdmin);
+ contracts.poolConfiguratorProxy.setReserveInterestRateData(
+ tokenList.usdx,
+ _getDefaultInterestRatesStrategyData()
+ );
+
+ address newInterestRateStrategy = contracts.protocolDataProvider.getInterestRateStrategyAddress(
+ tokenList.usdx
+ );
+ assertEq(currentInterestRateStrategy, newInterestRateStrategy);
+ }
+
function test_interestRateStrategy_update() public {
vm.prank(carol);
contracts.poolProxy.supply(tokenList.usdx, 100_000e6, carol, 0);
@@ -131,6 +152,7 @@ contract PoolConfiguratorUpgradeabilityTests is TestnetProcedures {
assertEq(updatedCache.currVariableBorrowRate, 107585394738663515131637198);
}
+ // TODO: deduplicate, reuse in vTokenUpdate too
function test_updateAToken() public {
ConfiguratorInputTypes.UpdateATokenInput memory input = ConfiguratorInputTypes
.UpdateATokenInput({
@@ -215,47 +237,4 @@ contract PoolConfiguratorUpgradeabilityTests is TestnetProcedures {
input.incentivesController
);
}
-
- function test_updateStableDebtToken() public {
- (, address stableDebtToken, ) = contracts.protocolDataProvider.getReserveTokensAddresses(
- tokenList.usdx
- );
- ConfiguratorInputTypes.UpdateDebtTokenInput memory input = ConfiguratorInputTypes
- .UpdateDebtTokenInput({
- asset: tokenList.usdx,
- incentivesController: report.rewardsControllerProxy,
- name: 'New Stable Debt Test USDX',
- symbol: 'newTestStaDebtUSDX',
- implementation: address(new MockStableDebtToken(IPool(report.poolProxy))),
- params: bytes('')
- });
-
- address previousImplementation = SlotParser.loadAddressFromSlot(
- stableDebtToken,
- bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)
- );
-
- vm.startPrank(poolAdmin);
-
- vm.expectEmit(address(contracts.poolConfiguratorProxy));
- emit StableDebtTokenUpgraded(tokenList.usdx, stableDebtToken, input.implementation);
-
- // Perform upgrade
- contracts.poolConfiguratorProxy.updateStableDebtToken(input);
- vm.stopPrank();
-
- address upgradedImplementation = SlotParser.loadAddressFromSlot(
- stableDebtToken,
- bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)
- );
-
- assertTrue(upgradedImplementation != previousImplementation);
- assertEq(upgradedImplementation, input.implementation);
- assertEq(StableDebtToken(stableDebtToken).name(), input.name);
- assertEq(StableDebtToken(stableDebtToken).symbol(), input.symbol);
- assertEq(
- address(StableDebtToken(stableDebtToken).getIncentivesController()),
- input.incentivesController
- );
- }
}
diff --git a/tests/core/ATokenEdgeCases.t.sol b/tests/protocol/tokenization/ATokenEdgeCases.t.sol
similarity index 95%
rename from tests/core/ATokenEdgeCases.t.sol
rename to tests/protocol/tokenization/ATokenEdgeCases.t.sol
index ddce0cac..247ed6fd 100644
--- a/tests/core/ATokenEdgeCases.t.sol
+++ b/tests/protocol/tokenization/ATokenEdgeCases.t.sol
@@ -3,10 +3,10 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {ATokenInstance} from 'aave-v3-core/instances/ATokenInstance.sol';
-import {IAaveIncentivesController} from 'aave-v3-core/contracts/interfaces/IAaveIncentivesController.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
+import {ATokenInstance} from '../../../src/contracts/instances/ATokenInstance.sol';
+import {IAaveIncentivesController} from '../../../src/contracts/interfaces/IAaveIncentivesController.sol';
+import {TestnetProcedures} from '../../utils/TestnetProcedures.sol';
+import {Errors} from '../../../src/contracts/protocol/libraries/helpers/Errors.sol';
contract ATokenEdgeCasesTests is TestnetProcedures {
ATokenInstance public aToken;
diff --git a/tests/core/ATokenEvents.t.sol b/tests/protocol/tokenization/ATokenEvents.t.sol
similarity index 96%
rename from tests/core/ATokenEvents.t.sol
rename to tests/protocol/tokenization/ATokenEvents.t.sol
index 6911d439..9ba61ceb 100644
--- a/tests/core/ATokenEvents.t.sol
+++ b/tests/protocol/tokenization/ATokenEvents.t.sol
@@ -3,12 +3,12 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {IAToken} from 'aave-v3-core/contracts/interfaces/IAToken.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
-import {ReserveLogic} from 'aave-v3-core/contracts/protocol/libraries/logic/ReserveLogic.sol';
-import {MathUtils} from 'aave-v3-core/contracts/protocol/libraries/math/MathUtils.sol';
-import {WadRayMath} from 'aave-v3-core/contracts/protocol/libraries/math/WadRayMath.sol';
-import {DataTypes} from 'aave-v3-core/contracts/protocol/libraries/types/DataTypes.sol';
+import {IAToken} from '../../../src/contracts/interfaces/IAToken.sol';
+import {TestnetProcedures} from '../../utils/TestnetProcedures.sol';
+import {ReserveLogic} from '../../../src/contracts/protocol/libraries/logic/ReserveLogic.sol';
+import {MathUtils} from '../../../src/contracts/protocol/libraries/math/MathUtils.sol';
+import {WadRayMath} from '../../../src/contracts/protocol/libraries/math/WadRayMath.sol';
+import {DataTypes} from '../../../src/contracts/protocol/libraries/types/DataTypes.sol';
contract ATokenEventsTests is TestnetProcedures {
using WadRayMath for uint256;
diff --git a/tests/core/ATokenModifiers.t.sol b/tests/protocol/tokenization/ATokenModifiers.t.sol
similarity index 85%
rename from tests/core/ATokenModifiers.t.sol
rename to tests/protocol/tokenization/ATokenModifiers.t.sol
index e29cb4dc..b29988bb 100644
--- a/tests/core/ATokenModifiers.t.sol
+++ b/tests/protocol/tokenization/ATokenModifiers.t.sol
@@ -3,9 +3,9 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {IAToken} from 'aave-v3-core/contracts/interfaces/IAToken.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
+import {IAToken} from '../../../src/contracts/interfaces/IAToken.sol';
+import {TestnetProcedures} from '../../utils/TestnetProcedures.sol';
+import {Errors} from '../../../src/contracts/protocol/libraries/helpers/Errors.sol';
contract ATokenModifiersTests is TestnetProcedures {
IAToken public aToken;
diff --git a/tests/core/ATokenPermit.t.sol b/tests/protocol/tokenization/ATokenPermit.t.sol
similarity index 96%
rename from tests/core/ATokenPermit.t.sol
rename to tests/protocol/tokenization/ATokenPermit.t.sol
index e7d90084..a1f708e4 100644
--- a/tests/core/ATokenPermit.t.sol
+++ b/tests/protocol/tokenization/ATokenPermit.t.sol
@@ -3,10 +3,10 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {IAToken} from 'aave-v3-core/contracts/interfaces/IAToken.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
-import {EIP712SigUtils} from '../utils/EIP712SigUtils.sol';
+import {IAToken} from '../../../src/contracts/interfaces/IAToken.sol';
+import {Errors} from '../../../src/contracts/protocol/libraries/helpers/Errors.sol';
+import {TestnetProcedures} from '../../utils/TestnetProcedures.sol';
+import {EIP712SigUtils} from '../../utils/EIP712SigUtils.sol';
interface IATokenWithMetadata is IAToken {
function name() external view returns (string memory);
diff --git a/tests/core/ATokenRepay.t.sol b/tests/protocol/tokenization/ATokenRepay.t.sol
similarity index 91%
rename from tests/core/ATokenRepay.t.sol
rename to tests/protocol/tokenization/ATokenRepay.t.sol
index eb650f78..1aee8136 100644
--- a/tests/core/ATokenRepay.t.sol
+++ b/tests/protocol/tokenization/ATokenRepay.t.sol
@@ -3,10 +3,10 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {IAToken} from 'aave-v3-core/contracts/interfaces/IAToken.sol';
-import {IVariableDebtToken} from 'aave-v3-core/contracts/interfaces/IVariableDebtToken.sol';
-import {IERC20Detailed} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
+import {IAToken} from '../../../src/contracts/interfaces/IAToken.sol';
+import {IVariableDebtToken} from '../../../src/contracts/interfaces/IVariableDebtToken.sol';
+import {IERC20Detailed} from '../../../src/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol';
+import {TestnetProcedures} from '../../utils/TestnetProcedures.sol';
interface IVariableDebtTokenWithERC20 is IVariableDebtToken, IERC20Detailed {}
diff --git a/tests/core/ATokenRescueTokens.sol b/tests/protocol/tokenization/ATokenRescueTokens.sol
similarity index 90%
rename from tests/core/ATokenRescueTokens.sol
rename to tests/protocol/tokenization/ATokenRescueTokens.sol
index 19592b12..870b3f9f 100644
--- a/tests/core/ATokenRescueTokens.sol
+++ b/tests/protocol/tokenization/ATokenRescueTokens.sol
@@ -3,9 +3,9 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {IAToken} from 'aave-v3-core/contracts/interfaces/IAToken.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
+import {IAToken} from '../../../src/contracts/interfaces/IAToken.sol';
+import {Errors} from '../../../src/contracts/protocol/libraries/helpers/Errors.sol';
+import {TestnetProcedures} from '../../utils/TestnetProcedures.sol';
contract ATokenRescueTokensTests is TestnetProcedures {
IAToken public aTokenUSDX;
diff --git a/tests/core/ATokenTransfers.t.sol b/tests/protocol/tokenization/ATokenTransfers.t.sol
similarity index 95%
rename from tests/core/ATokenTransfers.t.sol
rename to tests/protocol/tokenization/ATokenTransfers.t.sol
index dbf49542..1304da8b 100644
--- a/tests/core/ATokenTransfers.t.sol
+++ b/tests/protocol/tokenization/ATokenTransfers.t.sol
@@ -3,14 +3,14 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {IAToken, IERC20} from 'aave-v3-core/contracts/interfaces/IAToken.sol';
-import {IVariableDebtToken} from 'aave-v3-core/contracts/interfaces/IVariableDebtToken.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
-import {SupplyLogic} from 'aave-v3-core/contracts/protocol/libraries/logic/SupplyLogic.sol';
-import {MathUtils} from 'aave-v3-core/contracts/protocol/libraries/math/MathUtils.sol';
-import {WadRayMath} from 'aave-v3-core/contracts/protocol/libraries/math/WadRayMath.sol';
-import {DataTypes} from 'aave-v3-core/contracts/protocol/libraries/types/DataTypes.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
+import {IAToken, IERC20} from '../../../src/contracts/interfaces/IAToken.sol';
+import {IVariableDebtToken} from '../../../src/contracts/interfaces/IVariableDebtToken.sol';
+import {Errors} from '../../../src/contracts/protocol/libraries/helpers/Errors.sol';
+import {SupplyLogic} from '../../../src/contracts/protocol/libraries/logic/SupplyLogic.sol';
+import {MathUtils} from '../../../src/contracts/protocol/libraries/math/MathUtils.sol';
+import {WadRayMath} from '../../../src/contracts/protocol/libraries/math/WadRayMath.sol';
+import {DataTypes} from '../../../src/contracts/protocol/libraries/types/DataTypes.sol';
+import {TestnetProcedures} from '../../utils/TestnetProcedures.sol';
contract ATokenTransferTests is TestnetProcedures {
using WadRayMath for uint256;
diff --git a/tests/core/ScaledBalanceTokenBase.t.sol b/tests/protocol/tokenization/ScaledBalanceTokenBase.t.sol
similarity index 94%
rename from tests/core/ScaledBalanceTokenBase.t.sol
rename to tests/protocol/tokenization/ScaledBalanceTokenBase.t.sol
index aab5cfc5..cff2dd15 100644
--- a/tests/core/ScaledBalanceTokenBase.t.sol
+++ b/tests/protocol/tokenization/ScaledBalanceTokenBase.t.sol
@@ -1,10 +1,9 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
-import {WadRayMath} from 'aave-v3-core/contracts/protocol/libraries/math/WadRayMath.sol';
-import {MockScaledToken} from 'aave-v3-core/contracts/mocks/tokens/MockScaledToken.sol';
-
-import '../utils/TestnetProcedures.sol';
+import {WadRayMath} from '../../../src/contracts/protocol/libraries/math/WadRayMath.sol';
+import {MockScaledToken} from '../../../src/contracts/mocks/tokens/MockScaledToken.sol';
+import '../../utils/TestnetProcedures.sol';
contract ScaledBalanceTokenBaseEdgeTests is TestnetProcedures {
using WadRayMath for uint256;
diff --git a/tests/core/VariableDebtToken.t.sol b/tests/protocol/tokenization/VariableDebtToken.t.sol
similarity index 89%
rename from tests/core/VariableDebtToken.t.sol
rename to tests/protocol/tokenization/VariableDebtToken.t.sol
index 9435b543..ffe6ca5e 100644
--- a/tests/core/VariableDebtToken.t.sol
+++ b/tests/protocol/tokenization/VariableDebtToken.t.sol
@@ -3,15 +3,15 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {VariableDebtTokenHarness as VariableDebtTokenInstance} from '../harness/VariableDebtToken.sol';
-import {IAaveIncentivesController} from 'aave-v3-core/contracts/interfaces/IAaveIncentivesController.sol';
-import {Errors} from 'aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol';
-import {TestnetERC20} from 'aave-v3-periphery/contracts/mocks/testnet-helpers/TestnetERC20.sol';
-import {ReserveLogic, DataTypes} from 'aave-v3-core/contracts/protocol/libraries/logic/ReserveLogic.sol';
-import {WadRayMath} from 'aave-v3-core/contracts/protocol/libraries/math/WadRayMath.sol';
-import {ConfiguratorInputTypes, IPool} from 'aave-v3-core/contracts/protocol/pool/PoolConfigurator.sol';
-import {EIP712SigUtils} from '../utils/EIP712SigUtils.sol';
-import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
+import {VariableDebtTokenHarness as VariableDebtTokenInstance} from '../../harness/VariableDebtToken.sol';
+import {IAaveIncentivesController} from '../../../src/contracts/interfaces/IAaveIncentivesController.sol';
+import {Errors} from '../../../src/contracts/protocol/libraries/helpers/Errors.sol';
+import {TestnetERC20} from '../../../src/contracts/mocks/testnet-helpers/TestnetERC20.sol';
+import {ReserveLogic, DataTypes} from '../../../src/contracts/protocol/libraries/logic/ReserveLogic.sol';
+import {WadRayMath} from '../../../src/contracts/protocol/libraries/math/WadRayMath.sol';
+import {ConfiguratorInputTypes, IPool} from '../../../src/contracts/protocol/pool/PoolConfigurator.sol';
+import {EIP712SigUtils} from '../../utils/EIP712SigUtils.sol';
+import {TestnetProcedures, TestVars} from '../../utils/TestnetProcedures.sol';
contract VariableDebtTokenEventsTests is TestnetProcedures {
using WadRayMath for uint256;
@@ -82,17 +82,22 @@ contract VariableDebtTokenEventsTests is TestnetProcedures {
return varDebtToken;
}
- function test_initialize_VariableDebtToken() public returns (VariableDebtTokenInstance) {
+ function test_initialize_VariableDebtToken(
+ TestVars memory t
+ ) public returns (VariableDebtTokenInstance) {
VariableDebtTokenInstance varDebtToken = test_new_VariableDebtToken_implementation();
- ConfiguratorInputTypes.InitReserveInput memory listing = (
- _generateListingInput(1, report, poolAdmin)
- )[0];
+ ConfiguratorInputTypes.InitReserveInput memory listing = _generateInitReserveInput(
+ t,
+ report,
+ poolAdmin,
+ true
+ );
vm.expectEmit(address(varDebtToken));
emit Initialized(
listing.underlyingAsset,
report.poolProxy,
- report.rewardsControllerProxy,
+ listing.incentivesController,
TestnetERC20(listing.underlyingAsset).decimals(),
listing.variableDebtTokenName,
listing.variableDebtTokenSymbol,
@@ -120,11 +125,14 @@ contract VariableDebtTokenEventsTests is TestnetProcedures {
return varDebtToken;
}
- function test_reverts_initialize_twice() public {
- VariableDebtTokenInstance varDebtToken = test_initialize_VariableDebtToken();
- ConfiguratorInputTypes.InitReserveInput memory listing = (
- _generateListingInput(1, report, poolAdmin)
- )[0];
+ function test_reverts_initialize_twice(TestVars memory t) public {
+ VariableDebtTokenInstance varDebtToken = test_initialize_VariableDebtToken(t);
+ ConfiguratorInputTypes.InitReserveInput memory listing = _generateInitReserveInput(
+ t,
+ report,
+ poolAdmin,
+ true
+ );
uint8 decimals = TestnetERC20(listing.underlyingAsset).decimals();
@@ -141,11 +149,14 @@ contract VariableDebtTokenEventsTests is TestnetProcedures {
);
}
- function test_reverts_initialize_pool_do_not_match() public {
+ function test_reverts_initialize_pool_do_not_match(TestVars memory t) public {
VariableDebtTokenInstance varDebtToken = test_new_VariableDebtToken_implementation();
- ConfiguratorInputTypes.InitReserveInput memory listing = (
- _generateListingInput(1, report, poolAdmin)
- )[0];
+ ConfiguratorInputTypes.InitReserveInput memory listing = _generateInitReserveInput(
+ t,
+ report,
+ poolAdmin,
+ true
+ );
uint8 decimals = TestnetERC20(listing.underlyingAsset).decimals();
@@ -162,13 +173,8 @@ contract VariableDebtTokenEventsTests is TestnetProcedures {
);
}
- function test_default_revision() public {
- VariableDebtTokenInstance varDebtToken = new VariableDebtTokenInstance(IPool(report.poolProxy));
- assertEq(varDebtToken._getRevision(), varDebtToken.DEBT_TOKEN_REVISION());
- }
-
- function test_mint_variableDebt_caller_alice() public {
- VariableDebtTokenInstance debtToken = test_initialize_VariableDebtToken();
+ function test_mint_variableDebt_caller_alice(TestVars memory t) public {
+ VariableDebtTokenInstance debtToken = test_initialize_VariableDebtToken(t);
TestnetERC20 asset = TestnetERC20(debtToken.UNDERLYING_ASSET_ADDRESS());
uint8 decimals = asset.decimals();
uint256 amount = 1200 * 10 ** decimals;
@@ -182,8 +188,8 @@ contract VariableDebtTokenEventsTests is TestnetProcedures {
assertEq(debtToken.scaledBalanceOf(alice), amount);
}
- function test_mint_variableDebt_caller_bob_onBehalf_alice() public {
- VariableDebtTokenInstance debtToken = test_initialize_VariableDebtToken();
+ function test_mint_variableDebt_caller_bob_onBehalf_alice(TestVars memory t) public {
+ VariableDebtTokenInstance debtToken = test_initialize_VariableDebtToken(t);
TestnetERC20 asset = TestnetERC20(debtToken.UNDERLYING_ASSET_ADDRESS());
uint8 decimals = asset.decimals();
uint256 amount = 1200 * 10 ** decimals;
@@ -203,8 +209,8 @@ contract VariableDebtTokenEventsTests is TestnetProcedures {
assertEq(debtToken.scaledBalanceOf(alice), amount);
}
- function test_partial_burn_variableDebt() public {
- VariableDebtTokenInstance debtToken = test_initialize_VariableDebtToken();
+ function test_partial_burn_variableDebt(TestVars memory t) public {
+ VariableDebtTokenInstance debtToken = test_initialize_VariableDebtToken(t);
TestnetERC20 asset = TestnetERC20(debtToken.UNDERLYING_ASSET_ADDRESS());
uint8 decimals = asset.decimals();
uint256 amount = 1200 * 10 ** decimals;
@@ -229,8 +235,8 @@ contract VariableDebtTokenEventsTests is TestnetProcedures {
assertEq(debtToken.scaledBalanceOf(alice), balanceScaled - repaymentScaled);
}
- function test_total_burn_variableDebt() public {
- VariableDebtTokenInstance debtToken = test_initialize_VariableDebtToken();
+ function test_total_burn_variableDebt(TestVars memory t) public {
+ VariableDebtTokenInstance debtToken = test_initialize_VariableDebtToken(t);
TestnetERC20 asset = TestnetERC20(debtToken.UNDERLYING_ASSET_ADDRESS());
uint8 decimals = asset.decimals();
uint256 amount = 1200 * 10 ** decimals;
diff --git a/tests/periphery/EmissionsManager.t.sol b/tests/rewards/EmissionsManager.t.sol
similarity index 76%
rename from tests/periphery/EmissionsManager.t.sol
rename to tests/rewards/EmissionsManager.t.sol
index 2ebc7afd..9c157af1 100644
--- a/tests/periphery/EmissionsManager.t.sol
+++ b/tests/rewards/EmissionsManager.t.sol
@@ -1,16 +1,15 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
-import 'forge-std/Test.sol';
-import {MockAggregator} from 'aave-v3-core/contracts/mocks/oracle/CLAggregators/MockAggregator.sol';
-import {RewardsController} from 'aave-v3-periphery/contracts/rewards/RewardsController.sol';
-import {EmissionManager} from 'aave-v3-periphery/contracts/rewards/EmissionManager.sol';
-import {DataTypes} from 'aave-v3-core/contracts/protocol/libraries/types/DataTypes.sol';
-import {IPool} from 'aave-v3-core/contracts/interfaces/IPool.sol';
-import {ITransferStrategyBase} from 'aave-v3-periphery/contracts/rewards/interfaces/ITransferStrategyBase.sol';
-import {IEACAggregatorProxy} from 'aave-v3-periphery/contracts/misc/interfaces/IEACAggregatorProxy.sol';
-import {RewardsDataTypes} from 'aave-v3-periphery/contracts/rewards/libraries/RewardsDataTypes.sol';
-import {PullRewardsTransferStrategy} from 'aave-v3-periphery/contracts/rewards/transfer-strategies/PullRewardsTransferStrategy.sol';
+import {MockAggregator} from '../../src/contracts/mocks/oracle/CLAggregators/MockAggregator.sol';
+import {RewardsController} from '../../src/contracts/rewards/RewardsController.sol';
+import {EmissionManager} from '../../src/contracts/rewards/EmissionManager.sol';
+import {DataTypes} from '../../src/contracts/protocol/libraries/types/DataTypes.sol';
+import {IPool} from '../../src/contracts/interfaces/IPool.sol';
+import {ITransferStrategyBase} from '../../src/contracts/rewards/interfaces/ITransferStrategyBase.sol';
+import {IEACAggregatorProxy} from '../../src/contracts/helpers/interfaces/IEACAggregatorProxy.sol';
+import {RewardsDataTypes} from '../../src/contracts/rewards/libraries/RewardsDataTypes.sol';
+import {PullRewardsTransferStrategy} from '../../src/contracts/rewards/transfer-strategies/PullRewardsTransferStrategy.sol';
import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
contract EmissionManagerTest is TestnetProcedures {
diff --git a/tests/periphery/RewardsController.t.sol b/tests/rewards/RewardsController.t.sol
similarity index 94%
rename from tests/periphery/RewardsController.t.sol
rename to tests/rewards/RewardsController.t.sol
index 38dae8cd..26d206ef 100644
--- a/tests/periphery/RewardsController.t.sol
+++ b/tests/rewards/RewardsController.t.sol
@@ -1,16 +1,15 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
-import 'forge-std/Test.sol';
-import {MockAggregator} from 'aave-v3-core/contracts/mocks/oracle/CLAggregators/MockAggregator.sol';
-import {RewardsController, RewardsDistributor} from 'aave-v3-periphery/contracts/rewards/RewardsController.sol';
-import {EmissionManager} from 'aave-v3-periphery/contracts/rewards/EmissionManager.sol';
-import {DataTypes} from 'aave-v3-core/contracts/protocol/libraries/types/DataTypes.sol';
-import {IAToken, IERC20} from 'aave-v3-core/contracts/protocol/tokenization/AToken.sol';
-import {ITransferStrategyBase} from 'aave-v3-periphery/contracts/rewards/interfaces/ITransferStrategyBase.sol';
-import {IEACAggregatorProxy} from 'aave-v3-periphery/contracts/misc/interfaces/IEACAggregatorProxy.sol';
-import {RewardsDataTypes} from 'aave-v3-periphery/contracts/rewards/libraries/RewardsDataTypes.sol';
-import {PullRewardsTransferStrategy} from 'aave-v3-periphery/contracts/rewards/transfer-strategies/PullRewardsTransferStrategy.sol';
+import {MockAggregator} from '../../src/contracts/mocks/oracle/CLAggregators/MockAggregator.sol';
+import {RewardsController, RewardsDistributor} from '../../src/contracts/rewards/RewardsController.sol';
+import {EmissionManager} from '../../src/contracts/rewards/EmissionManager.sol';
+import {DataTypes} from '../../src/contracts/protocol/libraries/types/DataTypes.sol';
+import {IAToken, IERC20} from '../../src/contracts/protocol/tokenization/AToken.sol';
+import {ITransferStrategyBase} from '../../src/contracts/rewards/interfaces/ITransferStrategyBase.sol';
+import {IEACAggregatorProxy} from '../../src/contracts/helpers/interfaces/IEACAggregatorProxy.sol';
+import {RewardsDataTypes} from '../../src/contracts/rewards/libraries/RewardsDataTypes.sol';
+import {PullRewardsTransferStrategy} from '../../src/contracts/rewards/transfer-strategies/PullRewardsTransferStrategy.sol';
import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
contract RewardsControllerTest is TestnetProcedures {
diff --git a/tests/periphery/StakedTokenTransferStrategy.t.sol b/tests/rewards/StakedTokenTransferStrategy.t.sol
similarity index 94%
rename from tests/periphery/StakedTokenTransferStrategy.t.sol
rename to tests/rewards/StakedTokenTransferStrategy.t.sol
index cbb78767..1c3b2775 100644
--- a/tests/periphery/StakedTokenTransferStrategy.t.sol
+++ b/tests/rewards/StakedTokenTransferStrategy.t.sol
@@ -3,8 +3,8 @@ pragma solidity ^0.8.0;
import 'forge-std/Test.sol';
-import {StakedTokenTransferStrategy, IERC20, IStakedToken} from 'aave-v3-periphery/contracts/rewards/transfer-strategies/StakedTokenTransferStrategy.sol';
-import {StakeMock} from './mocks/StakeMock.sol';
+import {StakedTokenTransferStrategy, IERC20, IStakedToken} from '../../src/contracts/rewards/transfer-strategies/StakedTokenTransferStrategy.sol';
+import {StakeMock} from '../mocks/StakeMock.sol';
import {TestnetProcedures} from '../utils/TestnetProcedures.sol';
contract StakedTokenTransferStrategyTest is TestnetProcedures {
diff --git a/tests/utils/BatchTestProcedures.sol b/tests/utils/BatchTestProcedures.sol
index eb1f7d07..03a26043 100644
--- a/tests/utils/BatchTestProcedures.sol
+++ b/tests/utils/BatchTestProcedures.sol
@@ -11,14 +11,14 @@ import {AaveV3SetupBatch} from '../../src/deployments/projects/aave-v3-batched/b
import {FfiUtils} from '../../src/deployments/contracts/utilities/FfiUtils.sol';
import {DefaultMarketInput} from '../../src/deployments/inputs/DefaultMarketInput.sol';
import {AaveV3BatchOrchestration} from '../../src/deployments/projects/aave-v3-batched/AaveV3BatchOrchestration.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
-import {IRewardsController} from 'aave-v3-periphery/contracts/rewards/interfaces/IRewardsController.sol';
-import {ACLManager} from 'aave-v3-core/contracts/protocol/configuration/ACLManager.sol';
-import {WETH9} from 'aave-v3-core/contracts/dependencies/weth/WETH9.sol';
-import 'aave-v3-periphery/contracts/mocks/testnet-helpers/TestnetERC20.sol';
-import 'aave-v3-core/contracts/protocol/pool/PoolConfigurator.sol';
-import 'aave-v3-core/contracts/protocol/libraries/math/PercentageMath.sol';
-import 'aave-v3-core/contracts/misc/AaveProtocolDataProvider.sol';
+import {IPoolAddressesProvider} from '../../src/contracts/interfaces/IPoolAddressesProvider.sol';
+import {ACLManager} from '../../src/contracts/protocol/configuration/ACLManager.sol';
+import {WETH9} from '../../src/contracts/dependencies/weth/WETH9.sol';
+import {IRewardsController} from '../../src/contracts/rewards/interfaces/IRewardsController.sol';
+import '../../src/contracts/mocks/testnet-helpers/TestnetERC20.sol';
+import '../../src/contracts/protocol/pool/PoolConfigurator.sol';
+import '../../src/contracts/protocol/libraries/math/PercentageMath.sol';
+import '../../src/contracts/helpers/AaveProtocolDataProvider.sol';
import {MarketReportUtils} from '../../src/deployments/contracts/utilities/MarketReportUtils.sol';
struct TestVars {
@@ -213,8 +213,6 @@ contract BatchTestProcedures is Test, DeployUtils, FfiUtils, DefaultMarketInput
assertTrue(r.aToken != address(0), 'report.aToken');
assertTrue(r.variableDebtToken != address(0), 'report.variableDebtToken');
- assertTrue(r.stableDebtToken != address(0), 'report.stableDebtToken');
-
assertTrue(r.emissionManager != address(0), 'report.emissionManager');
assertTrue(r.rewardsControllerProxy != address(0), 'report.rewardsControllerProxy');
@@ -317,8 +315,6 @@ contract BatchTestProcedures is Test, DeployUtils, FfiUtils, DefaultMarketInput
t.aTokenName = _concatStr('a ', x);
t.variableDebtName = _concatStr('Variable Debt Misc', x);
t.variableDebtSymbol = _concatStr('varDebtMISC ', x);
- t.stableDebtName = _concatStr('Stable Debt Misc ', x);
- t.stableDebtSymbol = _concatStr('stableDebtMISC ', x);
t.rateStrategy = r.defaultInterestRateStrategy;
t.interestRateData = abi.encode(
IDefaultInterestRateStrategyV2.InterestRateData({
@@ -331,7 +327,6 @@ contract BatchTestProcedures is Test, DeployUtils, FfiUtils, DefaultMarketInput
input[x] = ConfiguratorInputTypes.InitReserveInput(
r.aToken,
- r.stableDebtToken,
r.variableDebtToken,
true,
t.rateStrategy,
@@ -342,8 +337,6 @@ contract BatchTestProcedures is Test, DeployUtils, FfiUtils, DefaultMarketInput
t.aTokenSymbol,
t.variableDebtName,
t.variableDebtSymbol,
- t.stableDebtName,
- t.stableDebtSymbol,
t.emptyParams,
t.interestRateData
);
diff --git a/tests/utils/DiffUtils.sol b/tests/utils/DiffUtils.sol
index 23008fb5..c4fef55d 100644
--- a/tests/utils/DiffUtils.sol
+++ b/tests/utils/DiffUtils.sol
@@ -22,7 +22,7 @@ contract DiffUtils is Test {
string[] memory inputs = new string[](7);
inputs[0] = 'npx';
- inputs[1] = '@bgd-labs/aave-cli@^0.16.4';
+ inputs[1] = '@bgd-labs/aave-cli@^1.0.0';
inputs[2] = 'diff-snapshots';
inputs[3] = beforePath;
inputs[4] = afterPath;
diff --git a/tests/utils/ProtocolV3TestBase.sol b/tests/utils/ProtocolV3TestBase.sol
index 1572ad7e..dbfbea39 100644
--- a/tests/utils/ProtocolV3TestBase.sol
+++ b/tests/utils/ProtocolV3TestBase.sol
@@ -1,21 +1,20 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.7.5 <0.9.0;
-import {IERC20Detailed} from 'aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol';
-import {IDefaultInterestRateStrategyV2} from 'aave-v3-core/contracts/interfaces/IDefaultInterestRateStrategyV2.sol';
-import {ReserveConfiguration} from 'aave-v3-core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
-import {IPoolDataProvider} from 'aave-v3-core/contracts/interfaces/IPoolDataProvider.sol';
-import {IPool} from 'aave-v3-core/contracts/interfaces/IPool.sol';
-import {IAaveOracle} from 'aave-v3-core/contracts/interfaces/IAaveOracle.sol';
-import {DataTypes} from 'aave-v3-core/contracts/protocol/libraries/types/DataTypes.sol';
-import {IPoolConfigurator} from 'aave-v3-core/contracts/interfaces/IPoolConfigurator.sol';
+import {IERC20Detailed} from '../../src/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol';
+import {IDefaultInterestRateStrategyV2} from '../../src/contracts/interfaces/IDefaultInterestRateStrategyV2.sol';
+import {ReserveConfiguration} from '../../src/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
+import {IPoolAddressesProvider} from '../../src/contracts/interfaces/IPoolAddressesProvider.sol';
+import {IPoolDataProvider} from '../../src/contracts/interfaces/IPoolDataProvider.sol';
+import {IPool} from '../../src/contracts/interfaces/IPool.sol';
+import {IAaveOracle} from '../../src/contracts/interfaces/IAaveOracle.sol';
+import {DataTypes} from '../../src/contracts/protocol/libraries/types/DataTypes.sol';
+import {IPoolConfigurator} from '../../src/contracts/interfaces/IPoolConfigurator.sol';
import {ProxyHelpers} from './ProxyHelpers.sol';
import {DiffUtils} from './DiffUtils.sol';
struct ReserveTokens {
address aToken;
- address stableDebtToken;
address variableDebtToken;
}
@@ -81,7 +80,6 @@ struct ReserveConfig {
string symbol;
address underlying;
address aToken;
- address stableDebtToken;
address variableDebtToken;
uint256 decimals;
uint256 ltv;
@@ -92,7 +90,6 @@ struct ReserveConfig {
bool usageAsCollateralEnabled;
bool borrowingEnabled;
address interestRateStrategy;
- bool stableBorrowRateEnabled;
bool isPaused;
bool isActive;
bool isFrozen;
@@ -102,7 +99,6 @@ struct ReserveConfig {
uint256 supplyCap;
uint256 borrowCap;
uint256 debtCeiling;
- uint256 eModeCategory;
bool virtualAccActive;
uint256 virtualBalance;
uint256 aTokenUnderlyingBalance;
@@ -150,36 +146,42 @@ contract ProtocolV3TestBase is DiffUtils {
ReserveConfig[] memory configs = _getReservesConfigs(pool);
if (reserveConfigs) _writeReserveConfigs(path, configs, pool);
if (strategyConfigs) _writeStrategyConfigs(path, configs);
- if (eModeConigs) _writeEModeConfigs(path, configs, pool);
+ if (eModeConigs) _writeEModeConfigs(path, pool);
if (poolConfigs) _writePoolConfiguration(path, pool);
return configs;
}
- function _writeEModeConfigs(
- string memory path,
- ReserveConfig[] memory configs,
- IPool pool
- ) internal virtual {
+ function _writeEModeConfigs(string memory path, IPool pool) internal virtual {
// keys for json stringification
string memory eModesKey = 'emodes';
string memory content = '{}';
-
- uint256[] memory usedCategories = new uint256[](configs.length);
- for (uint256 i = 0; i < configs.length; i++) {
- if (!_isInUint256Array(usedCategories, configs[i].eModeCategory)) {
- usedCategories[i] = configs[i].eModeCategory;
- DataTypes.EModeCategory memory category = pool.getEModeCategoryData(
- uint8(configs[i].eModeCategory)
+ vm.serializeJson(eModesKey, '{}');
+ uint8 emptyCounter = 0;
+ for (uint8 i = 0; i < 256; i++) {
+ DataTypes.CollateralConfig memory cfg = pool.getEModeCategoryCollateralConfig(i);
+ if (cfg.liquidationThreshold == 0) {
+ if (++emptyCounter > 2) break;
+ } else {
+ string memory key = vm.toString(i);
+ vm.serializeJson(key, '{}');
+ vm.serializeUint(key, 'eModeCategory', i);
+ vm.serializeString(key, 'label', pool.getEModeCategoryLabel(i));
+ vm.serializeUint(key, 'ltv', cfg.ltv);
+ vm.serializeString(
+ key,
+ 'collateralBitmap',
+ vm.toString(pool.getEModeCategoryCollateralBitmap(i))
);
- string memory key = vm.toString(configs[i].eModeCategory);
- vm.serializeUint(key, 'eModeCategory', configs[i].eModeCategory);
- vm.serializeString(key, 'label', category.label);
- vm.serializeUint(key, 'ltv', category.ltv);
- vm.serializeUint(key, 'liquidationThreshold', category.liquidationThreshold);
- vm.serializeUint(key, 'liquidationBonus', category.liquidationBonus);
- string memory object = vm.serializeAddress(key, 'priceSource', category.priceSource);
+ vm.serializeString(
+ key,
+ 'borrowableBitmap',
+ vm.toString(pool.getEModeCategoryBorrowableBitmap(i))
+ );
+ vm.serializeUint(key, 'liquidationThreshold', cfg.liquidationThreshold);
+ string memory object = vm.serializeUint(key, 'liquidationBonus', cfg.liquidationBonus);
content = vm.serializeString(eModesKey, key, object);
+ emptyCounter = 0;
}
}
string memory output = vm.serializeString('root', 'eModes', content);
@@ -256,6 +258,7 @@ contract ProtocolV3TestBase is DiffUtils {
string memory key = vm.toString(config.underlying);
vm.serializeJson(key, '{}');
vm.serializeString(key, 'symbol', config.symbol);
+ vm.serializeUint(key, 'id', i);
vm.serializeUint(key, 'ltv', config.ltv);
vm.serializeUint(key, 'liquidationThreshold', config.liquidationThreshold);
vm.serializeUint(key, 'liquidationBonus', config.liquidationBonus);
@@ -265,10 +268,8 @@ contract ProtocolV3TestBase is DiffUtils {
vm.serializeUint(key, 'borrowCap', config.borrowCap);
vm.serializeUint(key, 'supplyCap', config.supplyCap);
vm.serializeUint(key, 'debtCeiling', config.debtCeiling);
- vm.serializeUint(key, 'eModeCategory', config.eModeCategory);
vm.serializeBool(key, 'usageAsCollateralEnabled', config.usageAsCollateralEnabled);
vm.serializeBool(key, 'borrowingEnabled', config.borrowingEnabled);
- vm.serializeBool(key, 'stableBorrowRateEnabled', config.stableBorrowRateEnabled);
vm.serializeBool(key, 'isPaused', config.isPaused);
vm.serializeBool(key, 'isActive', config.isActive);
vm.serializeBool(key, 'isFrozen', config.isFrozen);
@@ -278,7 +279,6 @@ contract ProtocolV3TestBase is DiffUtils {
vm.serializeAddress(key, 'interestRateStrategy', config.interestRateStrategy);
vm.serializeAddress(key, 'underlying', config.underlying);
vm.serializeAddress(key, 'aToken', config.aToken);
- vm.serializeAddress(key, 'stableDebtToken', config.stableDebtToken);
vm.serializeAddress(key, 'variableDebtToken', config.variableDebtToken);
vm.serializeAddress(
key,
@@ -287,20 +287,6 @@ contract ProtocolV3TestBase is DiffUtils {
);
vm.serializeString(key, 'aTokenSymbol', IERC20Detailed(config.aToken).symbol());
vm.serializeString(key, 'aTokenName', IERC20Detailed(config.aToken).name());
- vm.serializeAddress(
- key,
- 'stableDebtTokenImpl',
- ProxyHelpers.getInitializableAdminUpgradeabilityProxyImplementation(
- vm,
- config.stableDebtToken
- )
- );
- vm.serializeString(
- key,
- 'stableDebtTokenSymbol',
- IERC20Detailed(config.stableDebtToken).symbol()
- );
- vm.serializeString(key, 'stableDebtTokenName', IERC20Detailed(config.stableDebtToken).name());
vm.serializeAddress(
key,
'variableDebtTokenImpl',
@@ -338,13 +324,17 @@ contract ProtocolV3TestBase is DiffUtils {
}
vm.serializeBool(key, 'virtualAccountingActive', config.virtualAccActive);
- vm.serializeUint(key, 'virtualBalance', config.virtualBalance);
- vm.serializeUint(key, 'aTokenUnderlyingBalance', config.aTokenUnderlyingBalance);
+ vm.serializeString(key, 'virtualBalance', vm.toString(config.virtualBalance));
+ vm.serializeString(
+ key,
+ 'aTokenUnderlyingBalance',
+ vm.toString(config.aTokenUnderlyingBalance)
+ );
- string memory out = vm.serializeUint(
+ string memory out = vm.serializeString(
key,
'oracleLatestAnswer',
- uint256(oracle.getAssetPrice(config.underlying))
+ vm.toString(uint256(oracle.getAssetPrice(config.underlying)))
);
content = vm.serializeString(reservesKey, key, out);
}
@@ -414,8 +404,9 @@ contract ProtocolV3TestBase is DiffUtils {
address underlyingAddress
) internal view virtual returns (ReserveTokens memory) {
ReserveTokens memory reserveTokens;
- (reserveTokens.aToken, reserveTokens.stableDebtToken, reserveTokens.variableDebtToken) = pdp
- .getReserveTokensAddresses(underlyingAddress);
+ (reserveTokens.aToken, , reserveTokens.variableDebtToken) = pdp.getReserveTokensAddresses(
+ underlyingAddress
+ );
return reserveTokens;
}
@@ -437,7 +428,6 @@ contract ProtocolV3TestBase is DiffUtils {
);
localConfig.aToken = reserveTokens.aToken;
localConfig.variableDebtToken = reserveTokens.variableDebtToken;
- localConfig.stableDebtToken = reserveTokens.stableDebtToken;
localConfig.interestRateStrategy = pool
.getReserveData(reserve.tokenAddress)
.interestRateStrategyAddress;
@@ -446,14 +436,12 @@ contract ProtocolV3TestBase is DiffUtils {
localConfig.liquidationThreshold,
localConfig.liquidationBonus,
localConfig.decimals,
- localConfig.reserveFactor,
- localConfig.eModeCategory
+ localConfig.reserveFactor
) = configuration.getParams();
(
localConfig.isActive,
localConfig.isFrozen,
localConfig.borrowingEnabled,
- localConfig.stableBorrowRateEnabled,
localConfig.isPaused
) = configuration.getFlags();
localConfig.symbol = reserve.symbol;
@@ -488,7 +476,6 @@ contract ProtocolV3TestBase is DiffUtils {
symbol: config.symbol,
underlying: config.underlying,
aToken: config.aToken,
- stableDebtToken: config.stableDebtToken,
variableDebtToken: config.variableDebtToken,
decimals: config.decimals,
ltv: config.ltv,
@@ -499,7 +486,6 @@ contract ProtocolV3TestBase is DiffUtils {
usageAsCollateralEnabled: config.usageAsCollateralEnabled,
borrowingEnabled: config.borrowingEnabled,
interestRateStrategy: config.interestRateStrategy,
- stableBorrowRateEnabled: config.stableBorrowRateEnabled,
isPaused: config.isPaused,
isActive: config.isActive,
isFrozen: config.isFrozen,
@@ -509,7 +495,6 @@ contract ProtocolV3TestBase is DiffUtils {
supplyCap: config.supplyCap,
borrowCap: config.borrowCap,
debtCeiling: config.debtCeiling,
- eModeCategory: config.eModeCategory,
virtualAccActive: config.virtualAccActive,
virtualBalance: config.virtualBalance,
aTokenUnderlyingBalance: config.aTokenUnderlyingBalance
@@ -584,10 +569,6 @@ contract ProtocolV3TestBase is DiffUtils {
config.borrowingEnabled == expectedConfig.borrowingEnabled,
'_validateReserveConfig: INVALID_BORROWING_ENABLED'
);
- require(
- config.stableBorrowRateEnabled == expectedConfig.stableBorrowRateEnabled,
- '_validateReserveConfig: INVALID_STABLE_BORROW_ENABLED'
- );
require(
config.isActive == expectedConfig.isActive,
'_validateReserveConfig: INVALID_IS_ACTIVE'
@@ -620,10 +601,6 @@ contract ProtocolV3TestBase is DiffUtils {
config.debtCeiling == expectedConfig.debtCeiling,
'_validateReserveConfig: INVALID_DEBT_CEILING'
);
- require(
- config.eModeCategory == expectedConfig.eModeCategory,
- '_validateReserveConfig: INVALID_EMODE_CATEGORY'
- );
require(
config.interestRateStrategy == expectedConfig.interestRateStrategy,
'_validateReserveConfig: INVALID_INTEREST_RATE_STRATEGY'
@@ -724,10 +701,6 @@ contract ProtocolV3TestBase is DiffUtils {
config1.aToken == config2.aToken,
'_noReservesConfigsChangesApartNewListings() : UNEXPECTED_A_TOKEN_CHANGED'
);
- require(
- config1.stableDebtToken == config2.stableDebtToken,
- '_noReservesConfigsChangesApartNewListings() : UNEXPECTED_STABLE_DEBT_TOKEN_CHANGED'
- );
require(
config1.variableDebtToken == config2.variableDebtToken,
'_noReservesConfigsChangesApartNewListings() : UNEXPECTED_VARIABLE_DEBT_TOKEN_CHANGED'
@@ -768,10 +741,6 @@ contract ProtocolV3TestBase is DiffUtils {
config1.interestRateStrategy == config2.interestRateStrategy,
'_noReservesConfigsChangesApartNewListings() : UNEXPECTED_INTEREST_RATE_STRATEGY_CHANGED'
);
- require(
- config1.stableBorrowRateEnabled == config2.stableBorrowRateEnabled,
- '_noReservesConfigsChangesApartNewListings() : UNEXPECTED_STABLE_BORROWING_CHANGED'
- );
require(
config1.isActive == config2.isActive,
'_noReservesConfigsChangesApartNewListings() : UNEXPECTED_IS_ACTIVE_CHANGED'
@@ -804,10 +773,6 @@ contract ProtocolV3TestBase is DiffUtils {
config1.debtCeiling == config2.debtCeiling,
'_noReservesConfigsChangesApartNewListings() : UNEXPECTED_DEBT_CEILING_CHANGED'
);
- require(
- config1.eModeCategory == config2.eModeCategory,
- '_noReservesConfigsChangesApartNewListings() : UNEXPECTED_E_MODE_CATEGORY_CHANGED'
- );
}
function _validateCountOfListings(
@@ -837,13 +802,6 @@ contract ProtocolV3TestBase is DiffUtils {
) == expectedImpls.variableDebtToken,
'_validateReserveTokensImpls() : INVALID_ATOKEN_IMPL'
);
- require(
- ProxyHelpers.getInitializableAdminUpgradeabilityProxyImplementation(
- vm,
- config.stableDebtToken
- ) == expectedImpls.stableDebtToken,
- '_validateReserveTokensImpls() : INVALID_STABLE_DEBT_IMPL'
- );
vm.stopPrank();
}
@@ -860,61 +818,38 @@ contract ProtocolV3TestBase is DiffUtils {
);
}
- function _validateAssetsOnEmodeCategory(
- uint256 category,
- ReserveConfig[] memory assetsConfigs,
- string[] memory expectedAssets
- ) internal pure {
- string[] memory assetsInCategory = new string[](assetsConfigs.length);
-
- uint256 countCategory;
- for (uint256 i = 0; i < assetsConfigs.length; i++) {
- if (assetsConfigs[i].eModeCategory == category) {
- assetsInCategory[countCategory] = assetsConfigs[i].symbol;
- require(
- keccak256(bytes(assetsInCategory[countCategory])) ==
- keccak256(bytes(expectedAssets[countCategory])),
- '_getAssetOnEmodeCategory(): INCONSISTENT_ASSETS'
- );
- countCategory++;
- if (countCategory > expectedAssets.length) {
- revert('_getAssetOnEmodeCategory(): MORE_ASSETS_IN_CATEGORY_THAN_EXPECTED');
- }
- }
- }
- if (countCategory < expectedAssets.length) {
- revert('_getAssetOnEmodeCategory(): LESS_ASSETS_IN_CATEGORY_THAN_EXPECTED');
- }
- }
-
function _validateEmodeCategory(
IPoolAddressesProvider addressesProvider,
uint256 category,
DataTypes.EModeCategory memory expectedCategoryData
) internal view {
address poolAddress = addressesProvider.getPool();
- DataTypes.EModeCategory memory currentCategoryData = IPool(poolAddress).getEModeCategoryData(
+ DataTypes.CollateralConfig memory cfg = IPool(poolAddress).getEModeCategoryCollateralConfig(
uint8(category)
);
require(
- keccak256(bytes(currentCategoryData.label)) == keccak256(bytes(expectedCategoryData.label)),
+ keccak256(bytes(IPool(poolAddress).getEModeCategoryLabel(uint8(category)))) ==
+ keccak256(bytes(expectedCategoryData.label)),
'_validateEmodeCategory(): INVALID_LABEL'
);
+ require(cfg.ltv == expectedCategoryData.ltv, '_validateEmodeCategory(): INVALID_LTV');
require(
- currentCategoryData.ltv == expectedCategoryData.ltv,
- '_validateEmodeCategory(): INVALID_LTV'
+ cfg.liquidationThreshold == expectedCategoryData.liquidationThreshold,
+ '_validateEmodeCategory(): INVALID_LT'
);
require(
- currentCategoryData.liquidationThreshold == expectedCategoryData.liquidationThreshold,
- '_validateEmodeCategory(): INVALID_LT'
+ cfg.liquidationBonus == expectedCategoryData.liquidationBonus,
+ '_validateEmodeCategory(): INVALID_LB'
);
require(
- currentCategoryData.liquidationBonus == expectedCategoryData.liquidationBonus,
+ IPool(poolAddress).getEModeCategoryCollateralBitmap(uint8(category)) ==
+ expectedCategoryData.collateralBitmap,
'_validateEmodeCategory(): INVALID_LB'
);
require(
- currentCategoryData.priceSource == expectedCategoryData.priceSource,
- '_validateEmodeCategory(): INVALID_PRICE_SOURCE'
+ IPool(poolAddress).getEModeCategoryBorrowableBitmap(uint8(category)) ==
+ expectedCategoryData.borrowableBitmap,
+ '_validateEmodeCategory(): INVALID_LB'
);
}
diff --git a/tests/utils/SigUtils.sol b/tests/utils/SigUtils.sol
index a41339fd..7f6ecb65 100644
--- a/tests/utils/SigUtils.sol
+++ b/tests/utils/SigUtils.sol
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.10;
-import {IERC20AaveLM} from '../../src/periphery/contracts/static-a-token/interfaces/IERC20AaveLM.sol';
+import {IERC20AaveLM} from '../../src/contracts/extensions/static-a-token/interfaces/IERC20AaveLM.sol';
library SigUtils {
bytes32 internal constant PERMIT_TYPEHASH =
diff --git a/tests/utils/TestnetProcedures.sol b/tests/utils/TestnetProcedures.sol
index cbf778e3..7f12bc76 100644
--- a/tests/utils/TestnetProcedures.sol
+++ b/tests/utils/TestnetProcedures.sol
@@ -8,31 +8,31 @@ import {DeployUtils} from '../../src/deployments/contracts/utilities/DeployUtils
import {FfiUtils} from '../../src/deployments/contracts/utilities/FfiUtils.sol';
import {DefaultMarketInput} from '../../src/deployments/inputs/DefaultMarketInput.sol';
import {AaveV3BatchOrchestration} from '../../src/deployments/projects/aave-v3-batched/AaveV3BatchOrchestration.sol';
-import {IPoolAddressesProvider} from 'aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol';
+import {IPoolAddressesProvider} from '../../src/contracts/interfaces/IPoolAddressesProvider.sol';
import {AaveV3TestListing} from '../mocks/AaveV3TestListing.sol';
-import {ACLManager, Errors} from 'aave-v3-core/contracts/protocol/configuration/ACLManager.sol';
-import {WETH9} from 'aave-v3-core/contracts/dependencies/weth/WETH9.sol';
-import {TestnetERC20} from 'aave-v3-periphery/contracts/mocks/testnet-helpers/TestnetERC20.sol';
-import {PoolConfigurator} from 'aave-v3-core/contracts/protocol/pool/PoolConfigurator.sol';
-import {DefaultReserveInterestRateStrategyV2} from 'aave-v3-core/contracts/protocol/pool/DefaultReserveInterestRateStrategyV2.sol';
-import {ReserveConfiguration} from 'aave-v3-core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
-import {PercentageMath} from 'aave-v3-core/contracts/protocol/libraries/math/PercentageMath.sol';
-import {AaveProtocolDataProvider} from 'aave-v3-core/contracts/misc/AaveProtocolDataProvider.sol';
+import {ACLManager, Errors} from '../../src/contracts/protocol/configuration/ACLManager.sol';
+import {WETH9} from '../../src/contracts/dependencies/weth/WETH9.sol';
+import {TestnetERC20} from '../../src/contracts/mocks/testnet-helpers/TestnetERC20.sol';
+import {PoolConfigurator} from '../../src/contracts/protocol/pool/PoolConfigurator.sol';
+import {DefaultReserveInterestRateStrategyV2} from '../../src/contracts/misc/DefaultReserveInterestRateStrategyV2.sol';
+import {ReserveConfiguration} from '../../src/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
+import {PercentageMath} from '../../src/contracts/protocol/libraries/math/PercentageMath.sol';
+import {AaveProtocolDataProvider} from '../../src/contracts/helpers/AaveProtocolDataProvider.sol';
import {MarketReportUtils} from '../../src/deployments/contracts/utilities/MarketReportUtils.sol';
-import {AaveV3ConfigEngine, IAaveV3ConfigEngine} from 'aave-v3-periphery/contracts/v3-config-engine/AaveV3ConfigEngine.sol';
+import {AaveV3ConfigEngine, IAaveV3ConfigEngine} from '../../src/contracts/extensions/v3-config-engine/AaveV3ConfigEngine.sol';
struct TestVars {
+ uint8 underlyingDecimals;
string aTokenName;
string aTokenSymbol;
string variableDebtName;
string variableDebtSymbol;
- string stableDebtName;
- string stableDebtSymbol;
address rateStrategy;
- bytes interestRateData;
- bytes emptyParams;
- uint256 previousReservesLength;
+ address incentivesController;
+ address treasury;
+ bool useVirtualBalance;
}
+
struct TestReserveConfig {
uint256 decimals;
uint256 ltv;
@@ -41,7 +41,6 @@ struct TestReserveConfig {
uint256 reserveFactor;
bool usageAsCollateralEnabled;
bool borrowingEnabled;
- bool stableBorrowRateEnabled;
bool isActive;
bool isFrozen;
bool isPaused;
@@ -84,7 +83,6 @@ contract TestnetProcedures is Test, DeployUtils, FfiUtils, DefaultMarketInput {
uint16 ltv;
uint16 lt;
uint16 lb;
- address oracle;
string label;
}
@@ -254,7 +252,7 @@ contract TestnetProcedures is Test, DeployUtils, FfiUtils, DefaultMarketInput {
uint256 reserveFactor,
bool usageAsCollateralEnabled,
bool borrowingEnabled,
- bool stableBorrowRateEnabled,
+ ,
bool isActive,
bool isFrozen
) = IPoolDataProvider(dataProvider).getReserveConfigurationData(reserve);
@@ -265,7 +263,6 @@ contract TestnetProcedures is Test, DeployUtils, FfiUtils, DefaultMarketInput {
c.reserveFactor = reserveFactor;
c.usageAsCollateralEnabled = usageAsCollateralEnabled;
c.borrowingEnabled = borrowingEnabled;
- c.stableBorrowRateEnabled = stableBorrowRateEnabled;
c.isActive = isActive;
c.isFrozen = isFrozen;
c.isPaused = IPoolDataProvider(dataProvider).getPaused(reserve);
@@ -278,58 +275,67 @@ contract TestnetProcedures is Test, DeployUtils, FfiUtils, DefaultMarketInput {
return string(abi.encodePacked(a, vm.toString(b)));
}
- function _generateListingInput(
- uint256 listings,
+ function _generateInitConfig(
+ TestVars memory t,
+ MarketReport memory r,
+ address poolAdminUser,
+ bool isValidDecimals
+ ) internal returns (ConfiguratorInputTypes.InitReserveInput[] memory) {
+ TestVars[] memory tArray = new TestVars[](1);
+ tArray[0] = t;
+ return _generateInitConfig(tArray, r, poolAdminUser, isValidDecimals);
+ }
+
+ function _generateInitConfig(
+ TestVars[] memory t,
MarketReport memory r,
- address poolAdminUser
+ address poolAdminUser,
+ bool isValidDecimals
) internal returns (ConfiguratorInputTypes.InitReserveInput[] memory) {
ConfiguratorInputTypes.InitReserveInput[]
- memory input = new ConfiguratorInputTypes.InitReserveInput[](listings);
-
- for (uint256 x; x < listings; ++x) {
- TestnetERC20 listingToken = new TestnetERC20(
- _concatStr('Token', x),
- _concatStr('T', x),
- uint8(10 + x),
- poolAdminUser
- );
- TestVars memory t;
- t.aTokenName = _concatStr('AToken ', x);
- t.aTokenName = _concatStr('a ', x);
- t.variableDebtName = _concatStr('Variable Debt Misc', x);
- t.variableDebtSymbol = _concatStr('varDebtMISC ', x);
- t.stableDebtName = _concatStr('Stable Debt Misc ', x);
- t.stableDebtSymbol = _concatStr('stableDebtMISC ', x);
- t.rateStrategy = r.defaultInterestRateStrategy;
- t.interestRateData = abi.encode(
- IDefaultInterestRateStrategyV2.InterestRateData({
- optimalUsageRatio: 80_00,
- baseVariableBorrowRate: 1_00,
- variableRateSlope1: 4_00,
- variableRateSlope2: 60_00
- })
- );
+ memory configurations = new ConfiguratorInputTypes.InitReserveInput[](t.length);
+ for (uint256 i = 0; i < t.length; i++) {
+ configurations[i] = _generateInitReserveInput(t[i], r, poolAdminUser, isValidDecimals);
+ }
+ return configurations;
+ }
- input[x] = ConfiguratorInputTypes.InitReserveInput(
- r.aToken,
- r.stableDebtToken,
- r.variableDebtToken,
- true,
- t.rateStrategy,
- address(listingToken),
- r.treasury,
- r.rewardsControllerProxy,
- t.aTokenName,
- t.aTokenSymbol,
- t.variableDebtName,
- t.variableDebtSymbol,
- t.stableDebtName,
- t.stableDebtSymbol,
- t.emptyParams,
- t.interestRateData
- );
+ function _generateInitReserveInput(
+ TestVars memory t,
+ MarketReport memory r,
+ address poolAdminUser,
+ bool isValidDecimals
+ ) internal returns (ConfiguratorInputTypes.InitReserveInput memory) {
+ if (isValidDecimals) {
+ t.underlyingDecimals = uint8(bound(t.underlyingDecimals, 6, 25));
+ } else {
+ t.underlyingDecimals = uint8(bound(t.underlyingDecimals, 0, 5));
}
+ ConfiguratorInputTypes.InitReserveInput memory input;
+ input.aTokenImpl = r.aToken;
+ input.underlyingAsset = address(
+ new TestnetERC20('Misc Token', 'MISC', t.underlyingDecimals, poolAdminUser)
+ );
+ input.variableDebtTokenImpl = r.variableDebtToken;
+ input.useVirtualBalance = t.useVirtualBalance;
+ input.interestRateStrategyAddress = r.defaultInterestRateStrategy;
+ input.treasury = t.treasury;
+ input.incentivesController = r.rewardsControllerProxy;
+ input.aTokenName = t.aTokenName;
+ input.aTokenSymbol = t.aTokenSymbol;
+ input.variableDebtTokenName = t.variableDebtName;
+ input.variableDebtTokenSymbol = t.variableDebtSymbol;
+ input.params = bytes('');
+ input.interestRateData = abi.encode(
+ IDefaultInterestRateStrategyV2.InterestRateData({
+ optimalUsageRatio: 80_00,
+ baseVariableBorrowRate: 1_00,
+ variableRateSlope1: 4_00,
+ variableRateSlope2: 60_00
+ })
+ );
+
return input;
}
@@ -338,11 +344,11 @@ contract TestnetProcedures is Test, DeployUtils, FfiUtils, DefaultMarketInput {
}
function _genCategoryOne() internal pure returns (EModeCategoryInput memory) {
- return EModeCategoryInput(1, 95_00, 96_00, 101_00, address(0x0), 'GROUP_A');
+ return EModeCategoryInput(1, 95_00, 96_00, 101_00, 'GROUP_A');
}
function _genCategoryTwo() internal pure returns (EModeCategoryInput memory) {
- return EModeCategoryInput(2, 96_00, 97_00, 101_50, address(0x0), 'GROUP_B');
+ return EModeCategoryInput(2, 96_00, 97_00, 101_50, 'GROUP_B');
}
function _calcPrice(uint256 price, uint256 percent) public pure returns (uint256) {
@@ -353,7 +359,6 @@ contract TestnetProcedures is Test, DeployUtils, FfiUtils, DefaultMarketInput {
function _calculateInterestRates(
uint256 borrowAmount,
- uint256 borrowMode,
address token
) internal view returns (uint256) {
DataTypes.ReserveDataLegacy memory reserveData = IPool(report.poolProxy).getReserveData(token);
@@ -366,22 +371,15 @@ contract TestnetProcedures is Test, DeployUtils, FfiUtils, DefaultMarketInput {
unbacked: 0,
liquidityAdded: 0,
liquidityTaken: borrowAmount,
- totalStableDebt: borrowMode == 1 ? borrowAmount : 0,
- totalVariableDebt: borrowMode == 2 ? borrowAmount : 0,
- averageStableBorrowRate: 0,
+ totalDebt: borrowAmount,
reserveFactor: reserveConfig.reserveFactor,
reserve: token,
usingVirtualBalance: IPool(report.poolProxy).getConfiguration(token).getIsVirtualAccActive(),
virtualUnderlyingBalance: IPool(report.poolProxy).getVirtualUnderlyingBalance(token)
});
- if (borrowMode == 2) {
- (, , uint256 expectedVariableBorrowRate) = rateStrategy.calculateInterestRates(input);
- return expectedVariableBorrowRate;
- } else {
- (, uint256 stableRate, ) = rateStrategy.calculateInterestRates(input);
- return stableRate;
- }
+ (, uint256 expectedVariableBorrowRate) = rateStrategy.calculateInterestRates(input);
+ return expectedVariableBorrowRate;
}
function _deployInterestRateStrategy() internal returns (address) {
diff --git a/yarn.lock b/yarn.lock
new file mode 100644
index 00000000..ef5133db
--- /dev/null
+++ b/yarn.lock
@@ -0,0 +1,1048 @@
+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
+# yarn lockfile v1
+
+
+"@adraffy/ens-normalize@1.10.0":
+ version "1.10.0"
+ resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz#d2a39395c587e092d77cbbc80acf956a54f38bf7"
+ integrity sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q==
+
+"@assemblyscript/loader@^0.9.4":
+ version "0.9.4"
+ resolved "https://registry.yarnpkg.com/@assemblyscript/loader/-/loader-0.9.4.tgz#a483c54c1253656bb33babd464e3154a173e1577"
+ integrity sha512-HazVq9zwTVwGmqdwYzu7WyQ6FQVZ7SwET0KKQuKm55jD0IfUpZgN0OPIiZG3zV1iSrVYcN0bdwLRXI/VNCYsUA==
+
+"@bgd-labs/aave-address-book@^3.0.0":
+ version "3.4.0"
+ resolved "https://registry.yarnpkg.com/@bgd-labs/aave-address-book/-/aave-address-book-3.4.0.tgz#e139ffbb01eea7b51ea5b162e45a9b28e41d74bc"
+ integrity sha512-0msSmy6tF///f062FheaafONO2niOeWvD0nychrxMVXojcX+obM7g8Ad0+JjSfxmKoGxAYKGER7zF7WbBEz6nw==
+
+"@bgd-labs/aave-cli@^1.0.0":
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/@bgd-labs/aave-cli/-/aave-cli-1.0.0.tgz#023cd576a73c229476afb984ba69a3179f80a5d7"
+ integrity sha512-Xs30iS10iagkLjRgQ1zPlZmJD9SkQMZsrimgzLUTlHan0uAiK45wYwvsX4XTFtvlQ+BCqzbzw/vZb8jMWE2kbw==
+ dependencies:
+ "@bgd-labs/aave-address-book" "^3.0.0"
+ "@bgd-labs/aave-v3-governance-cache" "^1.0.6"
+ "@bgd-labs/js-utils" "^1.4.2"
+ "@commander-js/extra-typings" "^11.1.0"
+ "@inquirer/prompts" "^3.3.2"
+ chalk "^4.1.2"
+ commander "^11.1.0"
+ deepmerge "^4.3.1"
+ dotenv "^16.4.1"
+ find-object-paths "^1.1.0"
+ gray-matter "^4.0.3"
+ ipfs-unixfs-importer "^15.3.1"
+ json-bigint "^1.0.0"
+ object-hash "^3.0.0"
+ viem "^2.17.11"
+ zod "^3.23.8"
+
+"@bgd-labs/aave-v3-governance-cache@^1.0.6":
+ version "1.0.7"
+ resolved "https://registry.yarnpkg.com/@bgd-labs/aave-v3-governance-cache/-/aave-v3-governance-cache-1.0.7.tgz#14c7cf32e8d9502c3e8ccf28a980ba662a80ad84"
+ integrity sha512-0viMU8RdJJZ9+pp+YY5LbQJBekgTzxU45+mFLZt6pwqqzhoX3UzBQtq8RmpOQMyoSq+d+axPBQV1K2Hx6gOybg==
+
+"@bgd-labs/js-utils@^1.4.2":
+ version "1.4.2"
+ resolved "https://registry.yarnpkg.com/@bgd-labs/js-utils/-/js-utils-1.4.2.tgz#dd6d954fdda153d76cbcabaeff9b7e8adcf528b1"
+ integrity sha512-hKiorNIyEApdH1w7laYQ+sGkrCGZTem9kD5Ud7YP/ZKtkoPx12FcTAp+P+JZ42BerPEqzGLZMDRJDB2ZGKeAJw==
+ dependencies:
+ "@supercharge/promise-pool" "^3.1.1"
+ bs58 "^5.0.0"
+ gray-matter "^4.0.3"
+ tsx "^4.7.1"
+
+"@commander-js/extra-typings@^11.1.0":
+ version "11.1.0"
+ resolved "https://registry.yarnpkg.com/@commander-js/extra-typings/-/extra-typings-11.1.0.tgz#dd19fcb8cc6e33ede237fc1b7af96c70833d8f93"
+ integrity sha512-GuvZ38d23H+7Tz2C9DhzCepivsOsky03s5NI+KCy7ke1FNUvsJ2oO47scQ9YaGGhgjgNW5OYYNSADmbjcSoIhw==
+
+"@esbuild/aix-ppc64@0.23.1":
+ version "0.23.1"
+ resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz#51299374de171dbd80bb7d838e1cfce9af36f353"
+ integrity sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==
+
+"@esbuild/android-arm64@0.23.1":
+ version "0.23.1"
+ resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.23.1.tgz#58565291a1fe548638adb9c584237449e5e14018"
+ integrity sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==
+
+"@esbuild/android-arm@0.23.1":
+ version "0.23.1"
+ resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.23.1.tgz#5eb8c652d4c82a2421e3395b808e6d9c42c862ee"
+ integrity sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==
+
+"@esbuild/android-x64@0.23.1":
+ version "0.23.1"
+ resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.23.1.tgz#ae19d665d2f06f0f48a6ac9a224b3f672e65d517"
+ integrity sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==
+
+"@esbuild/darwin-arm64@0.23.1":
+ version "0.23.1"
+ resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.23.1.tgz#05b17f91a87e557b468a9c75e9d85ab10c121b16"
+ integrity sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==
+
+"@esbuild/darwin-x64@0.23.1":
+ version "0.23.1"
+ resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.23.1.tgz#c58353b982f4e04f0d022284b8ba2733f5ff0931"
+ integrity sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==
+
+"@esbuild/freebsd-arm64@0.23.1":
+ version "0.23.1"
+ resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.1.tgz#f9220dc65f80f03635e1ef96cfad5da1f446f3bc"
+ integrity sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==
+
+"@esbuild/freebsd-x64@0.23.1":
+ version "0.23.1"
+ resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.23.1.tgz#69bd8511fa013b59f0226d1609ac43f7ce489730"
+ integrity sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==
+
+"@esbuild/linux-arm64@0.23.1":
+ version "0.23.1"
+ resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.23.1.tgz#8050af6d51ddb388c75653ef9871f5ccd8f12383"
+ integrity sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==
+
+"@esbuild/linux-arm@0.23.1":
+ version "0.23.1"
+ resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.23.1.tgz#ecaabd1c23b701070484990db9a82f382f99e771"
+ integrity sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==
+
+"@esbuild/linux-ia32@0.23.1":
+ version "0.23.1"
+ resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.23.1.tgz#3ed2273214178109741c09bd0687098a0243b333"
+ integrity sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==
+
+"@esbuild/linux-loong64@0.23.1":
+ version "0.23.1"
+ resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.23.1.tgz#a0fdf440b5485c81b0fbb316b08933d217f5d3ac"
+ integrity sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==
+
+"@esbuild/linux-mips64el@0.23.1":
+ version "0.23.1"
+ resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.23.1.tgz#e11a2806346db8375b18f5e104c5a9d4e81807f6"
+ integrity sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==
+
+"@esbuild/linux-ppc64@0.23.1":
+ version "0.23.1"
+ resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.23.1.tgz#06a2744c5eaf562b1a90937855b4d6cf7c75ec96"
+ integrity sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==
+
+"@esbuild/linux-riscv64@0.23.1":
+ version "0.23.1"
+ resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.23.1.tgz#65b46a2892fc0d1af4ba342af3fe0fa4a8fe08e7"
+ integrity sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==
+
+"@esbuild/linux-s390x@0.23.1":
+ version "0.23.1"
+ resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.23.1.tgz#e71ea18c70c3f604e241d16e4e5ab193a9785d6f"
+ integrity sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==
+
+"@esbuild/linux-x64@0.23.1":
+ version "0.23.1"
+ resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.23.1.tgz#d47f97391e80690d4dfe811a2e7d6927ad9eed24"
+ integrity sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==
+
+"@esbuild/netbsd-x64@0.23.1":
+ version "0.23.1"
+ resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.23.1.tgz#44e743c9778d57a8ace4b72f3c6b839a3b74a653"
+ integrity sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==
+
+"@esbuild/openbsd-arm64@0.23.1":
+ version "0.23.1"
+ resolved "https://registry.yarnpkg.com/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.1.tgz#05c5a1faf67b9881834758c69f3e51b7dee015d7"
+ integrity sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==
+
+"@esbuild/openbsd-x64@0.23.1":
+ version "0.23.1"
+ resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.23.1.tgz#2e58ae511bacf67d19f9f2dcd9e8c5a93f00c273"
+ integrity sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==
+
+"@esbuild/sunos-x64@0.23.1":
+ version "0.23.1"
+ resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.23.1.tgz#adb022b959d18d3389ac70769cef5a03d3abd403"
+ integrity sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==
+
+"@esbuild/win32-arm64@0.23.1":
+ version "0.23.1"
+ resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.23.1.tgz#84906f50c212b72ec360f48461d43202f4c8b9a2"
+ integrity sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==
+
+"@esbuild/win32-ia32@0.23.1":
+ version "0.23.1"
+ resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.23.1.tgz#5e3eacc515820ff729e90d0cb463183128e82fac"
+ integrity sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==
+
+"@esbuild/win32-x64@0.23.1":
+ version "0.23.1"
+ resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.23.1.tgz#81fd50d11e2c32b2d6241470e3185b70c7b30699"
+ integrity sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg==
+
+"@inquirer/checkbox@^1.5.2":
+ version "1.5.2"
+ resolved "https://registry.yarnpkg.com/@inquirer/checkbox/-/checkbox-1.5.2.tgz#043ca370ebbc0b92691c2309bc12e8716ed701c4"
+ integrity sha512-CifrkgQjDkUkWexmgYYNyB5603HhTHI91vLFeQXh6qrTKiCMVASol01Rs1cv6LP/A2WccZSRlJKZhbaBIs/9ZA==
+ dependencies:
+ "@inquirer/core" "^6.0.0"
+ "@inquirer/type" "^1.1.6"
+ ansi-escapes "^4.3.2"
+ chalk "^4.1.2"
+ figures "^3.2.0"
+
+"@inquirer/confirm@^2.0.17":
+ version "2.0.17"
+ resolved "https://registry.yarnpkg.com/@inquirer/confirm/-/confirm-2.0.17.tgz#a45eb1b973c51c993a3c093a0114e960b1cf09a4"
+ integrity sha512-EqzhGryzmGpy2aJf6LxJVhndxYmFs+m8cxXzf8nejb1DE3sabf6mUgBcp4J0jAUEiAcYzqmkqRr7LPFh/WdnXA==
+ dependencies:
+ "@inquirer/core" "^6.0.0"
+ "@inquirer/type" "^1.1.6"
+ chalk "^4.1.2"
+
+"@inquirer/core@^6.0.0":
+ version "6.0.0"
+ resolved "https://registry.yarnpkg.com/@inquirer/core/-/core-6.0.0.tgz#d44ccd8ae09a4879a78f09cca35bf1ab894b95f4"
+ integrity sha512-fKi63Khkisgda3ohnskNf5uZJj+zXOaBvOllHsOkdsXRA/ubQLJQrZchFFi57NKbZzkTunXiBMdvWOv71alonw==
+ dependencies:
+ "@inquirer/type" "^1.1.6"
+ "@types/mute-stream" "^0.0.4"
+ "@types/node" "^20.10.7"
+ "@types/wrap-ansi" "^3.0.0"
+ ansi-escapes "^4.3.2"
+ chalk "^4.1.2"
+ cli-spinners "^2.9.2"
+ cli-width "^4.1.0"
+ figures "^3.2.0"
+ mute-stream "^1.0.0"
+ run-async "^3.0.0"
+ signal-exit "^4.1.0"
+ strip-ansi "^6.0.1"
+ wrap-ansi "^6.2.0"
+
+"@inquirer/editor@^1.2.15":
+ version "1.2.15"
+ resolved "https://registry.yarnpkg.com/@inquirer/editor/-/editor-1.2.15.tgz#28de2dabbcf1e07a37149320093798e3f4856f91"
+ integrity sha512-gQ77Ls09x5vKLVNMH9q/7xvYPT6sIs5f7URksw+a2iJZ0j48tVS6crLqm2ugG33tgXHIwiEqkytY60Zyh5GkJQ==
+ dependencies:
+ "@inquirer/core" "^6.0.0"
+ "@inquirer/type" "^1.1.6"
+ chalk "^4.1.2"
+ external-editor "^3.1.0"
+
+"@inquirer/expand@^1.1.16":
+ version "1.1.16"
+ resolved "https://registry.yarnpkg.com/@inquirer/expand/-/expand-1.1.16.tgz#63dce81240e5f7b2b1d7942b3e3cae18f4f03d07"
+ integrity sha512-TGLU9egcuo+s7PxphKUCnJnpCIVY32/EwPCLLuu+gTvYiD8hZgx8Z2niNQD36sa6xcfpdLY6xXDBiL/+g1r2XQ==
+ dependencies:
+ "@inquirer/core" "^6.0.0"
+ "@inquirer/type" "^1.1.6"
+ chalk "^4.1.2"
+ figures "^3.2.0"
+
+"@inquirer/input@^1.2.16":
+ version "1.2.16"
+ resolved "https://registry.yarnpkg.com/@inquirer/input/-/input-1.2.16.tgz#94d8765a47689e799fd55ed0361dedc8f554341b"
+ integrity sha512-Ou0LaSWvj1ni+egnyQ+NBtfM1885UwhRCMtsRt2bBO47DoC1dwtCa+ZUNgrxlnCHHF0IXsbQHYtIIjFGAavI4g==
+ dependencies:
+ "@inquirer/core" "^6.0.0"
+ "@inquirer/type" "^1.1.6"
+ chalk "^4.1.2"
+
+"@inquirer/password@^1.1.16":
+ version "1.1.16"
+ resolved "https://registry.yarnpkg.com/@inquirer/password/-/password-1.1.16.tgz#37ddebbe37c6e76f8ad27d1f726aacdd7c423558"
+ integrity sha512-aZYZVHLUXZ2gbBot+i+zOJrks1WaiI95lvZCn1sKfcw6MtSSlYC8uDX8sTzQvAsQ8epHoP84UNvAIT0KVGOGqw==
+ dependencies:
+ "@inquirer/core" "^6.0.0"
+ "@inquirer/type" "^1.1.6"
+ ansi-escapes "^4.3.2"
+ chalk "^4.1.2"
+
+"@inquirer/prompts@^3.3.2":
+ version "3.3.2"
+ resolved "https://registry.yarnpkg.com/@inquirer/prompts/-/prompts-3.3.2.tgz#0c3a44bbf7e560439590f2fcb769cd8392b0f555"
+ integrity sha512-k52mOMRvTUejrqyF1h8Z07chC+sbaoaUYzzr1KrJXyj7yaX7Nrh0a9vktv8TuocRwIJOQMaj5oZEmkspEcJFYQ==
+ dependencies:
+ "@inquirer/checkbox" "^1.5.2"
+ "@inquirer/confirm" "^2.0.17"
+ "@inquirer/core" "^6.0.0"
+ "@inquirer/editor" "^1.2.15"
+ "@inquirer/expand" "^1.1.16"
+ "@inquirer/input" "^1.2.16"
+ "@inquirer/password" "^1.1.16"
+ "@inquirer/rawlist" "^1.2.16"
+ "@inquirer/select" "^1.3.3"
+
+"@inquirer/rawlist@^1.2.16":
+ version "1.2.16"
+ resolved "https://registry.yarnpkg.com/@inquirer/rawlist/-/rawlist-1.2.16.tgz#ac6cc0bb2a60d51dccdfe2c3ea624185f1fbd5bc"
+ integrity sha512-pZ6TRg2qMwZAOZAV6TvghCtkr53dGnK29GMNQ3vMZXSNguvGqtOVc4j/h1T8kqGJFagjyfBZhUPGwNS55O5qPQ==
+ dependencies:
+ "@inquirer/core" "^6.0.0"
+ "@inquirer/type" "^1.1.6"
+ chalk "^4.1.2"
+
+"@inquirer/select@^1.3.3":
+ version "1.3.3"
+ resolved "https://registry.yarnpkg.com/@inquirer/select/-/select-1.3.3.tgz#7d832ee603c15b706148e47cda29cdf6634cd94b"
+ integrity sha512-RzlRISXWqIKEf83FDC9ZtJ3JvuK1l7aGpretf41BCWYrvla2wU8W8MTRNMiPrPJ+1SIqrRC1nZdZ60hD9hRXLg==
+ dependencies:
+ "@inquirer/core" "^6.0.0"
+ "@inquirer/type" "^1.1.6"
+ ansi-escapes "^4.3.2"
+ chalk "^4.1.2"
+ figures "^3.2.0"
+
+"@inquirer/type@^1.1.6":
+ version "1.5.5"
+ resolved "https://registry.yarnpkg.com/@inquirer/type/-/type-1.5.5.tgz#303ea04ce7ad2e585b921b662b3be36ef7b4f09b"
+ integrity sha512-MzICLu4yS7V8AA61sANROZ9vT1H3ooca5dSmI1FjZkzq7o/koMsRfQSzRtFo+F3Ao4Sf1C0bpLKejpKB/+j6MA==
+ dependencies:
+ mute-stream "^1.0.0"
+
+"@ipld/dag-pb@^4.1.2":
+ version "4.1.2"
+ resolved "https://registry.yarnpkg.com/@ipld/dag-pb/-/dag-pb-4.1.2.tgz#39db25311aeb2745ec20bfc745d91a577832b6ac"
+ integrity sha512-BSztO4l3C+ya9HjCaQot26Y4AVsqIKtnn6+23ubc1usucnf6yoTBme18oCCdM6gKBMxuPqju5ye3lh9WEJsdeQ==
+ dependencies:
+ multiformats "^13.1.0"
+
+"@multiformats/murmur3@^2.1.8":
+ version "2.1.8"
+ resolved "https://registry.yarnpkg.com/@multiformats/murmur3/-/murmur3-2.1.8.tgz#81c1c15b6391109f3febfca4b3205196615a04e9"
+ integrity sha512-6vId1C46ra3R1sbJUOFCZnsUIveR9oF20yhPmAFxPm0JfrX3/ZRCgP3YDrBzlGoEppOXnA9czHeYc0T9mB6hbA==
+ dependencies:
+ multiformats "^13.0.0"
+ murmurhash3js-revisited "^3.0.0"
+
+"@noble/curves@1.4.0":
+ version "1.4.0"
+ resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.4.0.tgz#f05771ef64da724997f69ee1261b2417a49522d6"
+ integrity sha512-p+4cb332SFCrReJkCYe8Xzm0OWi4Jji5jVdIZRL/PmacmDkFNw6MrrV+gGpiPxLHbV+zKFRywUWbaseT+tZRXg==
+ dependencies:
+ "@noble/hashes" "1.4.0"
+
+"@noble/curves@^1.4.0":
+ version "1.6.0"
+ resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.6.0.tgz#be5296ebcd5a1730fccea4786d420f87abfeb40b"
+ integrity sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ==
+ dependencies:
+ "@noble/hashes" "1.5.0"
+
+"@noble/curves@~1.4.0":
+ version "1.4.2"
+ resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.4.2.tgz#40309198c76ed71bc6dbf7ba24e81ceb4d0d1fe9"
+ integrity sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==
+ dependencies:
+ "@noble/hashes" "1.4.0"
+
+"@noble/hashes@1.4.0", "@noble/hashes@~1.4.0":
+ version "1.4.0"
+ resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.4.0.tgz#45814aa329f30e4fe0ba49426f49dfccdd066426"
+ integrity sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==
+
+"@noble/hashes@1.5.0", "@noble/hashes@^1.4.0", "@noble/hashes@~1.5.0":
+ version "1.5.0"
+ resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.5.0.tgz#abadc5ca20332db2b1b2aa3e496e9af1213570b0"
+ integrity sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==
+
+"@scure/base@~1.1.6", "@scure/base@~1.1.8":
+ version "1.1.9"
+ resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.9.tgz#e5e142fbbfe251091f9c5f1dd4c834ac04c3dbd1"
+ integrity sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==
+
+"@scure/bip32@1.4.0":
+ version "1.4.0"
+ resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.4.0.tgz#4e1f1e196abedcef395b33b9674a042524e20d67"
+ integrity sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==
+ dependencies:
+ "@noble/curves" "~1.4.0"
+ "@noble/hashes" "~1.4.0"
+ "@scure/base" "~1.1.6"
+
+"@scure/bip39@1.4.0":
+ version "1.4.0"
+ resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.4.0.tgz#664d4f851564e2e1d4bffa0339f9546ea55960a6"
+ integrity sha512-BEEm6p8IueV/ZTfQLp/0vhw4NPnT9oWf5+28nvmeUICjP99f4vr2d+qc7AVGDDtwRep6ifR43Yed9ERVmiITzw==
+ dependencies:
+ "@noble/hashes" "~1.5.0"
+ "@scure/base" "~1.1.8"
+
+"@solidity-parser/parser@^0.18.0":
+ version "0.18.0"
+ resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.18.0.tgz#8e77a02a09ecce957255a2f48c9a7178ec191908"
+ integrity sha512-yfORGUIPgLck41qyN7nbwJRAx17/jAIXCTanHOJZhB6PJ1iAk/84b/xlsVKFSyNyLXIj0dhppoE0+CRws7wlzA==
+
+"@supercharge/promise-pool@^3.1.1":
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/@supercharge/promise-pool/-/promise-pool-3.2.0.tgz#a6ab4afdf798e453a6bb51c4ae340852e1266af8"
+ integrity sha512-pj0cAALblTZBPtMltWOlZTQSLT07jIaFNeM8TWoJD1cQMgDB9mcMlVMoetiB35OzNJpqQ2b+QEtwiR9f20mADg==
+
+"@types/mute-stream@^0.0.4":
+ version "0.0.4"
+ resolved "https://registry.yarnpkg.com/@types/mute-stream/-/mute-stream-0.0.4.tgz#77208e56a08767af6c5e1237be8888e2f255c478"
+ integrity sha512-CPM9nzrCPPJHQNA9keH9CVkVI+WR5kMa+7XEs5jcGQ0VoAGnLv242w8lIVgwAEfmE4oufJRaTc9PNLQl0ioAow==
+ dependencies:
+ "@types/node" "*"
+
+"@types/node@*":
+ version "22.5.5"
+ resolved "https://registry.yarnpkg.com/@types/node/-/node-22.5.5.tgz#52f939dd0f65fc552a4ad0b392f3c466cc5d7a44"
+ integrity sha512-Xjs4y5UPO/CLdzpgR6GirZJx36yScjh73+2NlLlkFRSoQN8B0DpfXPdZGnvVmLRLOsqDpOfTNv7D9trgGhmOIA==
+ dependencies:
+ undici-types "~6.19.2"
+
+"@types/node@^20.10.7":
+ version "20.16.5"
+ resolved "https://registry.yarnpkg.com/@types/node/-/node-20.16.5.tgz#d43c7f973b32ffdf9aa7bd4f80e1072310fd7a53"
+ integrity sha512-VwYCweNo3ERajwy0IUlqqcyZ8/A7Zwa9ZP3MnENWcB11AejO+tLy3pu850goUW2FC/IJMdZUfKpX/yxL1gymCA==
+ dependencies:
+ undici-types "~6.19.2"
+
+"@types/wrap-ansi@^3.0.0":
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/@types/wrap-ansi/-/wrap-ansi-3.0.0.tgz#18b97a972f94f60a679fd5c796d96421b9abb9fd"
+ integrity sha512-ltIpx+kM7g/MLRZfkbL7EsCEjfzCcScLpkg37eXEtx5kmrAKBkTJwd1GIAjDSL8wTpM6Hzn5YO4pSb91BEwu1g==
+
+abitype@1.0.5:
+ version "1.0.5"
+ resolved "https://registry.yarnpkg.com/abitype/-/abitype-1.0.5.tgz#29d0daa3eea867ca90f7e4123144c1d1270774b6"
+ integrity sha512-YzDhti7cjlfaBhHutMaboYB21Ha3rXR9QTkNJFzYC4kC8YclaiwPBBBJY8ejFdu2wnJeZCVZSMlQJ7fi8S6hsw==
+
+ansi-escapes@^4.3.2:
+ version "4.3.2"
+ resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e"
+ integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==
+ dependencies:
+ type-fest "^0.21.3"
+
+ansi-regex@^5.0.1:
+ version "5.0.1"
+ resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
+ integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==
+
+ansi-styles@^4.0.0, ansi-styles@^4.1.0:
+ version "4.3.0"
+ resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937"
+ integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==
+ dependencies:
+ color-convert "^2.0.1"
+
+argparse@^1.0.7:
+ version "1.0.10"
+ resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911"
+ integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==
+ dependencies:
+ sprintf-js "~1.0.2"
+
+base-x@^4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/base-x/-/base-x-4.0.0.tgz#d0e3b7753450c73f8ad2389b5c018a4af7b2224a"
+ integrity sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==
+
+base64-js@^1.3.1:
+ version "1.5.1"
+ resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a"
+ integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
+
+bignumber.js@^9.0.0:
+ version "9.1.2"
+ resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.2.tgz#b7c4242259c008903b13707983b5f4bbd31eda0c"
+ integrity sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==
+
+bl@^5.0.0:
+ version "5.1.0"
+ resolved "https://registry.yarnpkg.com/bl/-/bl-5.1.0.tgz#183715f678c7188ecef9fe475d90209400624273"
+ integrity sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ==
+ dependencies:
+ buffer "^6.0.3"
+ inherits "^2.0.4"
+ readable-stream "^3.4.0"
+
+bs58@^5.0.0:
+ version "5.0.0"
+ resolved "https://registry.yarnpkg.com/bs58/-/bs58-5.0.0.tgz#865575b4d13c09ea2a84622df6c8cbeb54ffc279"
+ integrity sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==
+ dependencies:
+ base-x "^4.0.0"
+
+buffer@^6.0.3:
+ version "6.0.3"
+ resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6"
+ integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==
+ dependencies:
+ base64-js "^1.3.1"
+ ieee754 "^1.2.1"
+
+catapulta-verify@^1.1.1:
+ version "1.1.1"
+ resolved "https://registry.yarnpkg.com/catapulta-verify/-/catapulta-verify-1.1.1.tgz#46ac6c9ed50480ef982060147f4ff4a34609efd0"
+ integrity sha512-VZ9pQpno1bjjZ/+7d1AbPWkOhYcZdNSova5Y1L9jj8ftdimv3JrwDTg9i0fs4I8/A/sRXK7AUb1pmL3016Cykw==
+
+chalk@^4.1.2:
+ version "4.1.2"
+ resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"
+ integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==
+ dependencies:
+ ansi-styles "^4.1.0"
+ supports-color "^7.1.0"
+
+chardet@^0.7.0:
+ version "0.7.0"
+ resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e"
+ integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==
+
+cli-spinners@^2.9.2:
+ version "2.9.2"
+ resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.9.2.tgz#1773a8f4b9c4d6ac31563df53b3fc1d79462fe41"
+ integrity sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==
+
+cli-width@^4.1.0:
+ version "4.1.0"
+ resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-4.1.0.tgz#42daac41d3c254ef38ad8ac037672130173691c5"
+ integrity sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==
+
+color-convert@^2.0.1:
+ version "2.0.1"
+ resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3"
+ integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==
+ dependencies:
+ color-name "~1.1.4"
+
+color-name@~1.1.4:
+ version "1.1.4"
+ resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
+ integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
+
+commander@^11.1.0:
+ version "11.1.0"
+ resolved "https://registry.yarnpkg.com/commander/-/commander-11.1.0.tgz#62fdce76006a68e5c1ab3314dc92e800eb83d906"
+ integrity sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==
+
+debug@^4.3.1:
+ version "4.3.7"
+ resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52"
+ integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==
+ dependencies:
+ ms "^2.1.3"
+
+deepmerge@^4.3.1:
+ version "4.3.1"
+ resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a"
+ integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==
+
+dotenv@^16.4.1:
+ version "16.4.5"
+ resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.5.tgz#cdd3b3b604cb327e286b4762e13502f717cb099f"
+ integrity sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==
+
+emoji-regex@^8.0.0:
+ version "8.0.0"
+ resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37"
+ integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==
+
+esbuild@~0.23.0:
+ version "0.23.1"
+ resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.23.1.tgz#40fdc3f9265ec0beae6f59824ade1bd3d3d2dab8"
+ integrity sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg==
+ optionalDependencies:
+ "@esbuild/aix-ppc64" "0.23.1"
+ "@esbuild/android-arm" "0.23.1"
+ "@esbuild/android-arm64" "0.23.1"
+ "@esbuild/android-x64" "0.23.1"
+ "@esbuild/darwin-arm64" "0.23.1"
+ "@esbuild/darwin-x64" "0.23.1"
+ "@esbuild/freebsd-arm64" "0.23.1"
+ "@esbuild/freebsd-x64" "0.23.1"
+ "@esbuild/linux-arm" "0.23.1"
+ "@esbuild/linux-arm64" "0.23.1"
+ "@esbuild/linux-ia32" "0.23.1"
+ "@esbuild/linux-loong64" "0.23.1"
+ "@esbuild/linux-mips64el" "0.23.1"
+ "@esbuild/linux-ppc64" "0.23.1"
+ "@esbuild/linux-riscv64" "0.23.1"
+ "@esbuild/linux-s390x" "0.23.1"
+ "@esbuild/linux-x64" "0.23.1"
+ "@esbuild/netbsd-x64" "0.23.1"
+ "@esbuild/openbsd-arm64" "0.23.1"
+ "@esbuild/openbsd-x64" "0.23.1"
+ "@esbuild/sunos-x64" "0.23.1"
+ "@esbuild/win32-arm64" "0.23.1"
+ "@esbuild/win32-ia32" "0.23.1"
+ "@esbuild/win32-x64" "0.23.1"
+
+escape-string-regexp@^1.0.5:
+ version "1.0.5"
+ resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
+ integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==
+
+esprima@^4.0.0:
+ version "4.0.1"
+ resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
+ integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==
+
+extend-shallow@^2.0.1:
+ version "2.0.1"
+ resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f"
+ integrity sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==
+ dependencies:
+ is-extendable "^0.1.0"
+
+external-editor@^3.1.0:
+ version "3.1.0"
+ resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495"
+ integrity sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==
+ dependencies:
+ chardet "^0.7.0"
+ iconv-lite "^0.4.24"
+ tmp "^0.0.33"
+
+figures@^3.2.0:
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af"
+ integrity sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==
+ dependencies:
+ escape-string-regexp "^1.0.5"
+
+find-object-paths@^1.1.0:
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/find-object-paths/-/find-object-paths-1.1.0.tgz#2d2fe99f24c95e63af4b51377a1ba0510490376c"
+ integrity sha512-UJvfPQibLUOrXl76PJ49cYbXJPsU1lYX6Pw7mHVW+ahaGx6kVHiozNIQriDc/EOlSvkDa6L9GyTFXPYQsa6sGA==
+
+fsevents@~2.3.3:
+ version "2.3.3"
+ resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6"
+ integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==
+
+get-tsconfig@^4.7.5:
+ version "4.8.1"
+ resolved "https://registry.yarnpkg.com/get-tsconfig/-/get-tsconfig-4.8.1.tgz#8995eb391ae6e1638d251118c7b56de7eb425471"
+ integrity sha512-k9PN+cFBmaLWtVz29SkUoqU5O0slLuHJXt/2P+tMVFT+phsSGXGkp9t3rQIqdz0e+06EHNGs3oM6ZX1s2zHxRg==
+ dependencies:
+ resolve-pkg-maps "^1.0.0"
+
+gray-matter@^4.0.3:
+ version "4.0.3"
+ resolved "https://registry.yarnpkg.com/gray-matter/-/gray-matter-4.0.3.tgz#e893c064825de73ea1f5f7d88c7a9f7274288798"
+ integrity sha512-5v6yZd4JK3eMI3FqqCouswVqwugaA9r4dNZB1wwcmrD02QkV5H0y7XBQW8QwQqEaZY1pM9aqORSORhJRdNK44Q==
+ dependencies:
+ js-yaml "^3.13.1"
+ kind-of "^6.0.2"
+ section-matter "^1.0.0"
+ strip-bom-string "^1.0.0"
+
+hamt-sharding@^3.0.6:
+ version "3.0.6"
+ resolved "https://registry.yarnpkg.com/hamt-sharding/-/hamt-sharding-3.0.6.tgz#3643107a3021af66ac95684aec87b196add5ba57"
+ integrity sha512-nZeamxfymIWLpVcAN0CRrb7uVq3hCOGj9IcL6NMA6VVCVWqj+h9Jo/SmaWuS92AEDf1thmHsM5D5c70hM3j2Tg==
+ dependencies:
+ sparse-array "^1.3.1"
+ uint8arrays "^5.0.1"
+
+has-flag@^4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b"
+ integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==
+
+iconv-lite@^0.4.24:
+ version "0.4.24"
+ resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
+ integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==
+ dependencies:
+ safer-buffer ">= 2.1.2 < 3"
+
+ieee754@^1.2.1:
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352"
+ integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==
+
+inherits@^2.0.3, inherits@^2.0.4:
+ version "2.0.4"
+ resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
+ integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
+
+interface-blockstore@^5.3.0:
+ version "5.3.1"
+ resolved "https://registry.yarnpkg.com/interface-blockstore/-/interface-blockstore-5.3.1.tgz#03f511431be2b8b04a536eaae8effe4565ea6536"
+ integrity sha512-nhgrQnz6yUQEqxTFLhlOBurQOy5lWlwCpgFmZ3GTObTVTQS9RZjK/JTozY6ty9uz2lZs7VFJSqwjWAltorJ4Vw==
+ dependencies:
+ interface-store "^6.0.0"
+ multiformats "^13.2.3"
+
+interface-store@^6.0.0:
+ version "6.0.2"
+ resolved "https://registry.yarnpkg.com/interface-store/-/interface-store-6.0.2.tgz#1746a1ee07634f7678b3aa778738b79e3f75c909"
+ integrity sha512-KSFCXtBlNoG0hzwNa0RmhHtrdhzexp+S+UY2s0rWTBJyfdEIgn6i6Zl9otVqrcFYbYrneBT7hbmHQ8gE0C3umA==
+
+ipfs-unixfs-importer@^15.3.1:
+ version "15.3.1"
+ resolved "https://registry.yarnpkg.com/ipfs-unixfs-importer/-/ipfs-unixfs-importer-15.3.1.tgz#93cf3bad77e3fff7ee25b4ba822c1a0d2fd56b6e"
+ integrity sha512-wHCTBqNsZXLJZ9/GSr7Msb3FDXD5yXF20Y9sKyUbbqNjbvaXs3n3h1+NM/5+WrgESHfwRcJIlJtaOKafL8Ymdg==
+ dependencies:
+ "@ipld/dag-pb" "^4.1.2"
+ "@multiformats/murmur3" "^2.1.8"
+ hamt-sharding "^3.0.6"
+ interface-blockstore "^5.3.0"
+ interface-store "^6.0.0"
+ ipfs-unixfs "^11.0.0"
+ it-all "^3.0.6"
+ it-batch "^3.0.6"
+ it-first "^3.0.6"
+ it-parallel-batch "^3.0.6"
+ multiformats "^13.2.3"
+ progress-events "^1.0.1"
+ rabin-wasm "^0.1.5"
+ uint8arraylist "^2.4.8"
+ uint8arrays "^5.1.0"
+
+ipfs-unixfs@^11.0.0:
+ version "11.2.0"
+ resolved "https://registry.yarnpkg.com/ipfs-unixfs/-/ipfs-unixfs-11.2.0.tgz#a7f3d1f9bce29033f273bda124a0eb8bc0c752f6"
+ integrity sha512-J8FN1qM5nfrDo8sQKQwfj0+brTg1uBfZK2vY9hxci33lcl3BFrsELS9+1+4q/8tO1ASKfxZO8W3Pi2O4sVX2Lg==
+ dependencies:
+ protons-runtime "^5.5.0"
+ uint8arraylist "^2.4.8"
+
+is-extendable@^0.1.0:
+ version "0.1.1"
+ resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89"
+ integrity sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==
+
+is-fullwidth-code-point@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d"
+ integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==
+
+isows@1.0.4:
+ version "1.0.4"
+ resolved "https://registry.yarnpkg.com/isows/-/isows-1.0.4.tgz#810cd0d90cc4995c26395d2aa4cfa4037ebdf061"
+ integrity sha512-hEzjY+x9u9hPmBom9IIAqdJCwNLax+xrPb51vEPpERoFlIxgmZcHzsT5jKG06nvInKOBGvReAVz80Umed5CczQ==
+
+it-all@^3.0.6:
+ version "3.0.6"
+ resolved "https://registry.yarnpkg.com/it-all/-/it-all-3.0.6.tgz#30a4f922ae9ca0945b0f720d3478ae6f5b6707ab"
+ integrity sha512-HXZWbxCgQZJfrv5rXvaVeaayXED8nTKx9tj9fpBhmcUJcedVZshMMMqTj0RG2+scGypb9Ut1zd1ifbf3lA8L+Q==
+
+it-batch@^3.0.0, it-batch@^3.0.6:
+ version "3.0.6"
+ resolved "https://registry.yarnpkg.com/it-batch/-/it-batch-3.0.6.tgz#0bcda35bf1c600e821c6d5f4d2446fe85a26ab1d"
+ integrity sha512-pQAAlSvJ4aV6xM/6LRvkPdKSKXxS4my2fGzNUxJyAQ8ccFdxPmK1bUuF5OoeUDkcdrbs8jtsmc4DypCMrGY6sg==
+
+it-first@^3.0.6:
+ version "3.0.6"
+ resolved "https://registry.yarnpkg.com/it-first/-/it-first-3.0.6.tgz#f532f0f36fe9bf0c291e0162b9d3375d59fe8f05"
+ integrity sha512-ExIewyK9kXKNAplg2GMeWfgjUcfC1FnUXz/RPfAvIXby+w7U4b3//5Lic0NV03gXT8O/isj5Nmp6KiY0d45pIQ==
+
+it-parallel-batch@^3.0.6:
+ version "3.0.6"
+ resolved "https://registry.yarnpkg.com/it-parallel-batch/-/it-parallel-batch-3.0.6.tgz#61487fdaca03cc34c648b3432f59e82e0c805172"
+ integrity sha512-3wgiQGvMMHy65OXScrtrtmY+bJSF7P6St1AP+BU+SK83fEr8NNk/MrmJKrtB1+MahYX2a8I+pOGKDj8qVtuV0Q==
+ dependencies:
+ it-batch "^3.0.0"
+
+js-yaml@^3.13.1:
+ version "3.14.1"
+ resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537"
+ integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==
+ dependencies:
+ argparse "^1.0.7"
+ esprima "^4.0.0"
+
+json-bigint@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/json-bigint/-/json-bigint-1.0.0.tgz#ae547823ac0cad8398667f8cd9ef4730f5b01ff1"
+ integrity sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==
+ dependencies:
+ bignumber.js "^9.0.0"
+
+kind-of@^6.0.0, kind-of@^6.0.2:
+ version "6.0.3"
+ resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd"
+ integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==
+
+minimist@^1.2.5:
+ version "1.2.8"
+ resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c"
+ integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==
+
+ms@^2.1.3:
+ version "2.1.3"
+ resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
+ integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==
+
+multiformats@^13.0.0, multiformats@^13.1.0, multiformats@^13.2.3:
+ version "13.3.0"
+ resolved "https://registry.yarnpkg.com/multiformats/-/multiformats-13.3.0.tgz#1f5188bc7c4fe08ff829ae1c18dc33409042fb71"
+ integrity sha512-CBiqvsufgmpo01VT5ze94O+uc+Pbf6f/sThlvWss0sBZmAOu6GQn5usrYV2sf2mr17FWYc0rO8c/CNe2T90QAA==
+
+murmurhash3js-revisited@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/murmurhash3js-revisited/-/murmurhash3js-revisited-3.0.0.tgz#6bd36e25de8f73394222adc6e41fa3fac08a5869"
+ integrity sha512-/sF3ee6zvScXMb1XFJ8gDsSnY+X8PbOyjIuBhtgis10W2Jx4ZjIhikUCIF9c4gpJxVnQIsPAFrSwTCuAjicP6g==
+
+mute-stream@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-1.0.0.tgz#e31bd9fe62f0aed23520aa4324ea6671531e013e"
+ integrity sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==
+
+node-fetch@^2.6.1:
+ version "2.7.0"
+ resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d"
+ integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==
+ dependencies:
+ whatwg-url "^5.0.0"
+
+object-hash@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-3.0.0.tgz#73f97f753e7baffc0e2cc9d6e079079744ac82e9"
+ integrity sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==
+
+os-tmpdir@~1.0.2:
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274"
+ integrity sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==
+
+prettier-plugin-solidity@^1.1.1:
+ version "1.4.1"
+ resolved "https://registry.yarnpkg.com/prettier-plugin-solidity/-/prettier-plugin-solidity-1.4.1.tgz#8060baf18853a9e34d2e09e47e87b4f19e15afe9"
+ integrity sha512-Mq8EtfacVZ/0+uDKTtHZGW3Aa7vEbX/BNx63hmVg6YTiTXSiuKP0amj0G6pGwjmLaOfymWh3QgXEZkjQbU8QRg==
+ dependencies:
+ "@solidity-parser/parser" "^0.18.0"
+ semver "^7.5.4"
+
+prettier@^2.8.3:
+ version "2.8.8"
+ resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da"
+ integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==
+
+progress-events@^1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/progress-events/-/progress-events-1.0.1.tgz#693b6d4153f08c1418ae3cd5fcad8596c91db7e8"
+ integrity sha512-MOzLIwhpt64KIVN64h1MwdKWiyKFNc/S6BoYKPIVUHFg0/eIEyBulhWCgn678v/4c0ri3FdGuzXymNCv02MUIw==
+
+protons-runtime@^5.5.0:
+ version "5.5.0"
+ resolved "https://registry.yarnpkg.com/protons-runtime/-/protons-runtime-5.5.0.tgz#ea06d9ef843aad77ea5de3e1ebafa81b58c24570"
+ integrity sha512-EsALjF9QsrEk6gbCx3lmfHxVN0ah7nG3cY7GySD4xf4g8cr7g543zB88Foh897Sr1RQJ9yDCUsoT1i1H/cVUFA==
+ dependencies:
+ uint8-varint "^2.0.2"
+ uint8arraylist "^2.4.3"
+ uint8arrays "^5.0.1"
+
+rabin-wasm@^0.1.5:
+ version "0.1.5"
+ resolved "https://registry.yarnpkg.com/rabin-wasm/-/rabin-wasm-0.1.5.tgz#5b625ca007d6a2cbc1456c78ae71d550addbc9c9"
+ integrity sha512-uWgQTo7pim1Rnj5TuWcCewRDTf0PEFTSlaUjWP4eY9EbLV9em08v89oCz/WO+wRxpYuO36XEHp4wgYQnAgOHzA==
+ dependencies:
+ "@assemblyscript/loader" "^0.9.4"
+ bl "^5.0.0"
+ debug "^4.3.1"
+ minimist "^1.2.5"
+ node-fetch "^2.6.1"
+ readable-stream "^3.6.0"
+
+readable-stream@^3.4.0, readable-stream@^3.6.0:
+ version "3.6.2"
+ resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967"
+ integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==
+ dependencies:
+ inherits "^2.0.3"
+ string_decoder "^1.1.1"
+ util-deprecate "^1.0.1"
+
+resolve-pkg-maps@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz#616b3dc2c57056b5588c31cdf4b3d64db133720f"
+ integrity sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==
+
+run-async@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/run-async/-/run-async-3.0.0.tgz#42a432f6d76c689522058984384df28be379daad"
+ integrity sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q==
+
+safe-buffer@~5.2.0:
+ version "5.2.1"
+ resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
+ integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
+
+"safer-buffer@>= 2.1.2 < 3":
+ version "2.1.2"
+ resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
+ integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
+
+section-matter@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/section-matter/-/section-matter-1.0.0.tgz#e9041953506780ec01d59f292a19c7b850b84167"
+ integrity sha512-vfD3pmTzGpufjScBh50YHKzEu2lxBWhVEHsNGoEXmCmn2hKGfeNLYMzCJpe8cD7gqX7TJluOVpBkAequ6dgMmA==
+ dependencies:
+ extend-shallow "^2.0.1"
+ kind-of "^6.0.0"
+
+semver@^7.5.4:
+ version "7.6.3"
+ resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143"
+ integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==
+
+signal-exit@^4.1.0:
+ version "4.1.0"
+ resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04"
+ integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==
+
+sparse-array@^1.3.1:
+ version "1.3.2"
+ resolved "https://registry.yarnpkg.com/sparse-array/-/sparse-array-1.3.2.tgz#0e1a8b71706d356bc916fe754ff496d450ec20b0"
+ integrity sha512-ZT711fePGn3+kQyLuv1fpd3rNSkNF8vd5Kv2D+qnOANeyKs3fx6bUMGWRPvgTTcYV64QMqZKZwcuaQSP3AZ0tg==
+
+sprintf-js@~1.0.2:
+ version "1.0.3"
+ resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
+ integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==
+
+string-width@^4.1.0:
+ version "4.2.3"
+ resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
+ integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
+ dependencies:
+ emoji-regex "^8.0.0"
+ is-fullwidth-code-point "^3.0.0"
+ strip-ansi "^6.0.1"
+
+string_decoder@^1.1.1:
+ version "1.3.0"
+ resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e"
+ integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==
+ dependencies:
+ safe-buffer "~5.2.0"
+
+strip-ansi@^6.0.0, strip-ansi@^6.0.1:
+ version "6.0.1"
+ resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
+ integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
+ dependencies:
+ ansi-regex "^5.0.1"
+
+strip-bom-string@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/strip-bom-string/-/strip-bom-string-1.0.0.tgz#e5211e9224369fbb81d633a2f00044dc8cedad92"
+ integrity sha512-uCC2VHvQRYu+lMh4My/sFNmF2klFymLX1wHJeXnbEJERpV/ZsVuonzerjfrGpIGF7LBVa1O7i9kjiWvJiFck8g==
+
+supports-color@^7.1.0:
+ version "7.2.0"
+ resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da"
+ integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==
+ dependencies:
+ has-flag "^4.0.0"
+
+tmp@^0.0.33:
+ version "0.0.33"
+ resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9"
+ integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==
+ dependencies:
+ os-tmpdir "~1.0.2"
+
+tr46@~0.0.3:
+ version "0.0.3"
+ resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
+ integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==
+
+tsx@^4.7.1:
+ version "4.19.1"
+ resolved "https://registry.yarnpkg.com/tsx/-/tsx-4.19.1.tgz#b7bffdf4b565813e4dea14b90872af279cd0090b"
+ integrity sha512-0flMz1lh74BR4wOvBjuh9olbnwqCPc35OOlfyzHba0Dc+QNUeWX/Gq2YTbnwcWPO3BMd8fkzRVrHcsR+a7z7rA==
+ dependencies:
+ esbuild "~0.23.0"
+ get-tsconfig "^4.7.5"
+ optionalDependencies:
+ fsevents "~2.3.3"
+
+type-fest@^0.21.3:
+ version "0.21.3"
+ resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37"
+ integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==
+
+uint8-varint@^2.0.2:
+ version "2.0.4"
+ resolved "https://registry.yarnpkg.com/uint8-varint/-/uint8-varint-2.0.4.tgz#85be52b3849eb30f2c3640a2df8a14364180affb"
+ integrity sha512-FwpTa7ZGA/f/EssWAb5/YV6pHgVF1fViKdW8cWaEarjB8t7NyofSWBdOTyFPaGuUG4gx3v1O3PQ8etsiOs3lcw==
+ dependencies:
+ uint8arraylist "^2.0.0"
+ uint8arrays "^5.0.0"
+
+uint8arraylist@^2.0.0, uint8arraylist@^2.4.3, uint8arraylist@^2.4.8:
+ version "2.4.8"
+ resolved "https://registry.yarnpkg.com/uint8arraylist/-/uint8arraylist-2.4.8.tgz#5a4d17f4defd77799cb38e93fd5db0f0dceddc12"
+ integrity sha512-vc1PlGOzglLF0eae1M8mLRTBivsvrGsdmJ5RbK3e+QRvRLOZfZhQROTwH/OfyF3+ZVUg9/8hE8bmKP2CvP9quQ==
+ dependencies:
+ uint8arrays "^5.0.1"
+
+uint8arrays@^5.0.0, uint8arrays@^5.0.1, uint8arrays@^5.1.0:
+ version "5.1.0"
+ resolved "https://registry.yarnpkg.com/uint8arrays/-/uint8arrays-5.1.0.tgz#14047c9bdf825d025b7391299436e5e50e7270f1"
+ integrity sha512-vA6nFepEmlSKkMBnLBaUMVvAC4G3CTmO58C12y4sq6WPDOR7mOFYOi7GlrQ4djeSbP6JG9Pv9tJDM97PedRSww==
+ dependencies:
+ multiformats "^13.0.0"
+
+undici-types@~6.19.2:
+ version "6.19.8"
+ resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02"
+ integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==
+
+util-deprecate@^1.0.1:
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
+ integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==
+
+viem@^2.17.11:
+ version "2.21.12"
+ resolved "https://registry.yarnpkg.com/viem/-/viem-2.21.12.tgz#10c668668b62d276e806fc3261145a9285ae663c"
+ integrity sha512-yPZulbPdoDnuB8Gm2m+Qc9Mjgl6gC1YgNU6zcO+C8XZNYwaCNE6mokPiy30m8o5I1XkfvMc35jMmtT1zCb8yxA==
+ dependencies:
+ "@adraffy/ens-normalize" "1.10.0"
+ "@noble/curves" "1.4.0"
+ "@noble/hashes" "1.4.0"
+ "@scure/bip32" "1.4.0"
+ "@scure/bip39" "1.4.0"
+ abitype "1.0.5"
+ isows "1.0.4"
+ webauthn-p256 "0.0.5"
+ ws "8.17.1"
+
+webauthn-p256@0.0.5:
+ version "0.0.5"
+ resolved "https://registry.yarnpkg.com/webauthn-p256/-/webauthn-p256-0.0.5.tgz#0baebd2ba8a414b21cc09c0d40f9dd0be96a06bd"
+ integrity sha512-drMGNWKdaixZNobeORVIqq7k5DsRC9FnG201K2QjeOoQLmtSDaSsVZdkg6n5jUALJKcAG++zBPJXmv6hy0nWFg==
+ dependencies:
+ "@noble/curves" "^1.4.0"
+ "@noble/hashes" "^1.4.0"
+
+webidl-conversions@^3.0.0:
+ version "3.0.1"
+ resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
+ integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==
+
+whatwg-url@^5.0.0:
+ version "5.0.0"
+ resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d"
+ integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==
+ dependencies:
+ tr46 "~0.0.3"
+ webidl-conversions "^3.0.0"
+
+wrap-ansi@^6.2.0:
+ version "6.2.0"
+ resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53"
+ integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==
+ dependencies:
+ ansi-styles "^4.0.0"
+ string-width "^4.1.0"
+ strip-ansi "^6.0.0"
+
+ws@8.17.1:
+ version "8.17.1"
+ resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.1.tgz#9293da530bb548febc95371d90f9c878727d919b"
+ integrity sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==
+
+zod@^3.23.8:
+ version "3.23.8"
+ resolved "https://registry.yarnpkg.com/zod/-/zod-3.23.8.tgz#e37b957b5d52079769fb8097099b592f0ef4067d"
+ integrity sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==