Updated require message errors with constant string numbers to reduce gas

This commit is contained in:
pol 2020-08-25 15:51:52 +02:00
parent abe967c707
commit 0f5017cc81
3 changed files with 703 additions and 713 deletions

View File

@ -3,6 +3,7 @@
"trailingComma": "es5",
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"overrides": [
{
"files": "*.sol",

File diff suppressed because it is too large Load Diff

View File

@ -25,6 +25,10 @@ contract LendingPoolConfigurator is VersionedInitializable {
using SafeMath for uint256;
using ReserveConfiguration for ReserveConfiguration.Map;
//require error messages
string private constant CALLER_NOT_LENDING_POOL_MANAGER = '1'; // 'The caller must be a lending pool manager'
string private constant RESERVE_LIQUIDITY_NOT_0 = '2'; // 'The liquidity of the reserve needs to be 0'
/**
* @dev emitted when a reserve is initialized.
* @param asset the address of the reserve
@ -178,7 +182,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
modifier onlyLendingPoolManager {
require(
addressesProvider.getLendingPoolManager() == msg.sender,
'The caller must be a lending pool manager'
CALLER_NOT_LENDING_POOL_MANAGER
);
_;
}
@ -425,7 +429,7 @@ contract LendingPoolConfigurator is VersionedInitializable {
) = pool.getReserveData(asset);
require(
availableLiquidity == 0 && totalBorrowsStable == 0 && totalBorrowsVariable == 0,
'The liquidity of the reserve needs to be 0'
RESERVE_LIQUIDITY_NOT_0
);
ReserveConfiguration.Map memory currentConfig = pool.getConfiguration(asset);