From b87c28f75ae50ff13101fae6cd5a81897139fa42 Mon Sep 17 00:00:00 2001 From: Harsh Pandey Date: Wed, 14 Aug 2024 00:22:38 +0530 Subject: [PATCH] fix: cleanup diffs --- .../AAVE_PROTOCOL_DATA_PROVIDER_DIFF.md | 145 +- diffs/MAINNET_ZKSYNC/ACL_MANAGER_DIFF.md | 111 +- diffs/MAINNET_ZKSYNC/BORROW_LOGIC_DIFF.md | 316 +---- diffs/MAINNET_ZKSYNC/BRIDGE_LOGIC_DIFF.md | 298 +---- diffs/MAINNET_ZKSYNC/COLLECTOR_IMPL_DIFF.md | 731 +--------- .../MAINNET_ZKSYNC/CONFIGURATOR_LOGIC_DIFF.md | 172 +-- .../DEFAULT_A_TOKEN_IMPL_DIFF.md | 467 +------ ...DEFAULT_INCENTIVES_CONTROLLER_IMPL_DIFF.md | 548 +------- .../DEFAULT_STABLE_DEBT_TOKEN_IMPL_DIFF.md | 542 +------- .../DEFAULT_VARIABLE_DEBT_TOKEN_IMPL_DIFF.md | 474 +------ diffs/MAINNET_ZKSYNC/EMISSION_MANAGER_DIFF.md | 121 +- diffs/MAINNET_ZKSYNC/EMODE_LOGIC_DIFF.md | 289 +--- diffs/MAINNET_ZKSYNC/FLASHLOAN_LOGIC_DIFF.md | 343 +---- .../MAINNET_ZKSYNC/LIQUIDATION_LOGIC_DIFF.md | 316 +---- diffs/MAINNET_ZKSYNC/ORACLE_DIFF.md | 85 +- .../POOL_ADDRESSES_PROVIDER_DIFF.md | 278 +--- .../POOL_ADDRESSES_PROVIDER_REGISTRY_DIFF.md | 66 +- .../POOL_CONFIGURATOR_IMPL_DIFF.md | 10 +- diffs/MAINNET_ZKSYNC/POOL_LOGIC_DIFF.md | 298 +---- diffs/MAINNET_ZKSYNC/SUPPLY_LOGIC_DIFF.md | 298 +---- .../UI_INCENTIVE_DATA_PROVIDER_DIFF.md | 1175 +---------------- .../UI_POOL_DATA_PROVIDER_DIFF.md | 37 +- .../WALLET_BALANCE_PROVIDER_DIFF.md | 600 +-------- diffs/MAINNET_ZKSYNC/WETH_GATEWAY_DIFF.md | 557 +------- 24 files changed, 66 insertions(+), 8211 deletions(-) diff --git a/diffs/MAINNET_ZKSYNC/AAVE_PROTOCOL_DATA_PROVIDER_DIFF.md b/diffs/MAINNET_ZKSYNC/AAVE_PROTOCOL_DATA_PROVIDER_DIFF.md index ce14e241..bf7b3ef5 100644 --- a/diffs/MAINNET_ZKSYNC/AAVE_PROTOCOL_DATA_PROVIDER_DIFF.md +++ b/diffs/MAINNET_ZKSYNC/AAVE_PROTOCOL_DATA_PROVIDER_DIFF.md @@ -3,148 +3,5 @@ diff --git a/./downloads/MAINNET/AAVE_PROTOCOL_DATA_PROVIDER.sol b/./downloads/Z index 91cc016..35ccb13 100644 --- a/./downloads/MAINNET/AAVE_PROTOCOL_DATA_PROVIDER.sol +++ b/./downloads/ZKSYNC/AAVE_PROTOCOL_DATA_PROVIDER.sol -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: MIT - pragma solidity ^0.8.0 ^0.8.10; - --// downloads/MAINNET/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/lib/aave-v3-origin/src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol -+// downloads/ZKSYNC/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol - - /** - * @dev Interface of the ERC20 standard as defined in the EIP. -@@ -77,7 +77,7 @@ interface IERC20 { - event Approval(address indexed owner, address indexed spender, uint256 value); - } - --// downloads/MAINNET/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/lib/aave-v3-origin/src/core/contracts/interfaces/IAaveIncentivesController.sol -+// downloads/ZKSYNC/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/src/core/contracts/interfaces/IAaveIncentivesController.sol - - /** - * @title IAaveIncentivesController -@@ -96,7 +96,7 @@ interface IAaveIncentivesController { - function handleAction(address user, uint256 totalSupply, uint256 userBalance) external; - } - --// downloads/MAINNET/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/lib/aave-v3-origin/src/core/contracts/interfaces/IPoolAddressesProvider.sol -+// downloads/ZKSYNC/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/src/core/contracts/interfaces/IPoolAddressesProvider.sol - - /** - * @title IPoolAddressesProvider -@@ -323,7 +323,7 @@ interface IPoolAddressesProvider { - function setPoolDataProvider(address newDataProvider) external; - } - --// downloads/MAINNET/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/lib/aave-v3-origin/src/core/contracts/interfaces/IScaledBalanceToken.sol -+// downloads/ZKSYNC/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/src/core/contracts/interfaces/IScaledBalanceToken.sol - - /** - * @title IScaledBalanceToken -@@ -395,7 +395,7 @@ interface IScaledBalanceToken { - function getPreviousIndex(address user) external view returns (uint256); - } - --// downloads/MAINNET/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/lib/aave-v3-origin/src/core/contracts/protocol/libraries/helpers/Errors.sol -+// downloads/ZKSYNC/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/src/core/contracts/protocol/libraries/helpers/Errors.sol - - /** - * @title Errors library -@@ -503,7 +503,7 @@ library Errors { - string public constant INVALID_FREEZE_STATE = '99'; // Reserve is already in the passed freeze state - } - --// downloads/MAINNET/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/lib/aave-v3-origin/src/core/contracts/protocol/libraries/math/WadRayMath.sol -+// downloads/ZKSYNC/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/src/core/contracts/protocol/libraries/math/WadRayMath.sol - - /** - * @title WadRayMath library -@@ -629,7 +629,7 @@ library WadRayMath { - } - } - --// downloads/MAINNET/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/lib/aave-v3-origin/src/core/contracts/protocol/libraries/types/DataTypes.sol -+// downloads/ZKSYNC/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/src/core/contracts/protocol/libraries/types/DataTypes.sol - - library DataTypes { - /** -@@ -942,7 +942,7 @@ library DataTypes { - } - } - --// downloads/MAINNET/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/lib/aave-v3-origin/src/core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol -+// downloads/ZKSYNC/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/src/core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol - - interface IERC20Detailed is IERC20 { - function name() external view returns (string memory); -@@ -952,7 +952,7 @@ interface IERC20Detailed is IERC20 { - function decimals() external view returns (uint8); - } - --// downloads/MAINNET/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/lib/aave-v3-origin/src/core/contracts/interfaces/IPoolDataProvider.sol -+// downloads/ZKSYNC/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/src/core/contracts/interfaces/IPoolDataProvider.sol - - /** - * @title IPoolDataProvider -@@ -1207,7 +1207,7 @@ interface IPoolDataProvider { - function getVirtualUnderlyingBalance(address asset) external view returns (uint256); - } - --// downloads/MAINNET/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/lib/aave-v3-origin/src/core/contracts/interfaces/IPool.sol -+// downloads/ZKSYNC/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/src/core/contracts/interfaces/IPool.sol - - /** - * @title IPool -@@ -2039,7 +2039,7 @@ interface IPool { - function getSupplyLogic() external returns (address); - } - --// downloads/MAINNET/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/lib/aave-v3-origin/src/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol -+// downloads/ZKSYNC/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/src/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol - - /** - * @title ReserveConfiguration library -@@ -2676,7 +2676,7 @@ library ReserveConfiguration { - } - } - --// downloads/MAINNET/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/lib/aave-v3-origin/src/core/contracts/protocol/libraries/configuration/UserConfiguration.sol -+// downloads/ZKSYNC/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/src/core/contracts/protocol/libraries/configuration/UserConfiguration.sol - - /** - * @title UserConfiguration library -@@ -2908,7 +2908,7 @@ library UserConfiguration { - } - } - --// downloads/MAINNET/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/lib/aave-v3-origin/src/core/contracts/interfaces/IInitializableDebtToken.sol -+// downloads/ZKSYNC/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/src/core/contracts/interfaces/IInitializableDebtToken.sol - - /** - * @title IInitializableDebtToken -@@ -2957,7 +2957,7 @@ interface IInitializableDebtToken { - ) external; - } - --// downloads/MAINNET/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/lib/aave-v3-origin/src/core/contracts/interfaces/IStableDebtToken.sol -+// downloads/ZKSYNC/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/src/core/contracts/interfaces/IStableDebtToken.sol - - /** - * @title IStableDebtToken -@@ -3094,7 +3094,7 @@ interface IStableDebtToken is IInitializableDebtToken { - function UNDERLYING_ASSET_ADDRESS() external view returns (address); - } - --// downloads/MAINNET/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/lib/aave-v3-origin/src/core/contracts/interfaces/IVariableDebtToken.sol -+// downloads/ZKSYNC/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/src/core/contracts/interfaces/IVariableDebtToken.sol - - /** - * @title IVariableDebtToken -@@ -3137,7 +3137,7 @@ interface IVariableDebtToken is IScaledBalanceToken, IInitializableDebtToken { - function UNDERLYING_ASSET_ADDRESS() external view returns (address); - } - --// downloads/MAINNET/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/lib/aave-v3-origin/src/core/contracts/misc/AaveProtocolDataProvider.sol -+// downloads/ZKSYNC/AAVE_PROTOCOL_DATA_PROVIDER/AaveProtocolDataProvider/src/core/contracts/misc/AaveProtocolDataProvider.sol - - /** - * @title AaveProtocolDataProvider + ``` diff --git a/diffs/MAINNET_ZKSYNC/ACL_MANAGER_DIFF.md b/diffs/MAINNET_ZKSYNC/ACL_MANAGER_DIFF.md index 1ddaaab7..0efeae09 100644 --- a/diffs/MAINNET_ZKSYNC/ACL_MANAGER_DIFF.md +++ b/diffs/MAINNET_ZKSYNC/ACL_MANAGER_DIFF.md @@ -3,114 +3,5 @@ diff --git a/./downloads/MAINNET/ACL_MANAGER.sol b/./downloads/ZKSYNC/ACL_MANAGE index 8e5aac3..88e1973 100644 --- a/./downloads/MAINNET/ACL_MANAGER.sol +++ b/./downloads/ZKSYNC/ACL_MANAGER.sol -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: BUSL-1.1 --pragma solidity =0.8.10 ^0.8.0; -+pragma solidity ^0.8.0 ^0.8.10; - --// downloads/MAINNET/ACL_MANAGER/ACLManager/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/Context.sol -+// downloads/ZKSYNC/ACL_MANAGER/ACLManager/src/core/contracts/dependencies/openzeppelin/contracts/Context.sol - - /* - * @dev Provides information about the current execution context, including the -@@ -24,7 +24,7 @@ abstract contract Context { - } - } - --// downloads/MAINNET/ACL_MANAGER/ACLManager/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/IAccessControl.sol -+// downloads/ZKSYNC/ACL_MANAGER/ACLManager/src/core/contracts/dependencies/openzeppelin/contracts/IAccessControl.sol - - /** - * @dev External interface of AccessControl declared to support ERC165 detection. -@@ -114,7 +114,7 @@ interface IAccessControl { - function renounceRole(bytes32 role, address account) external; - } - --// downloads/MAINNET/ACL_MANAGER/ACLManager/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/IERC165.sol -+// downloads/ZKSYNC/ACL_MANAGER/ACLManager/src/core/contracts/dependencies/openzeppelin/contracts/IERC165.sol - - /** - * @dev Interface of the ERC165 standard, as defined in the -@@ -137,7 +137,7 @@ interface IERC165 { - function supportsInterface(bytes4 interfaceId) external view returns (bool); - } - --// downloads/MAINNET/ACL_MANAGER/ACLManager/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/Strings.sol -+// downloads/ZKSYNC/ACL_MANAGER/ACLManager/src/core/contracts/dependencies/openzeppelin/contracts/Strings.sol - - /** - * @dev String operations. -@@ -202,7 +202,7 @@ library Strings { - } - } - --// downloads/MAINNET/ACL_MANAGER/ACLManager/@aave/core-v3/contracts/interfaces/IPoolAddressesProvider.sol -+// downloads/ZKSYNC/ACL_MANAGER/ACLManager/src/core/contracts/interfaces/IPoolAddressesProvider.sol - - /** - * @title IPoolAddressesProvider -@@ -429,7 +429,7 @@ interface IPoolAddressesProvider { - function setPoolDataProvider(address newDataProvider) external; - } - --// downloads/MAINNET/ACL_MANAGER/ACLManager/@aave/core-v3/contracts/protocol/libraries/helpers/Errors.sol -+// downloads/ZKSYNC/ACL_MANAGER/ACLManager/src/core/contracts/protocol/libraries/helpers/Errors.sol - - /** - * @title Errors library -@@ -497,7 +497,7 @@ library Errors { - string public constant PRICE_ORACLE_SENTINEL_CHECK_FAILED = '59'; // 'Price oracle sentinel validation failed' - string public constant ASSET_NOT_BORROWABLE_IN_ISOLATION = '60'; // 'Asset is not borrowable in isolation mode' - string public constant RESERVE_ALREADY_INITIALIZED = '61'; // 'Reserve has already been initialized' -- string public constant USER_IN_ISOLATION_MODE = '62'; // 'User is in isolation mode' -+ string public constant USER_IN_ISOLATION_MODE_OR_LTV_ZERO = '62'; // 'User is in isolation mode or ltv is zero' - string public constant INVALID_LTV = '63'; // 'Invalid ltv parameter for the reserve' - string public constant INVALID_LIQ_THRESHOLD = '64'; // 'Invalid liquidity threshold parameter for the reserve' - string public constant INVALID_LIQ_BONUS = '65'; // 'Invalid liquidity bonus parameter for the reserve' -@@ -527,9 +527,17 @@ library Errors { - 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 -+ string public constant INVALID_MAX_RATE = '92'; // The expect maximum borrow rate is invalid -+ string public constant WITHDRAW_TO_ATOKEN = '93'; // Withdrawing to the aToken is not allowed -+ string public constant SUPPLY_TO_ATOKEN = '94'; // Supplying to the aToken is not allowed -+ string public constant SLOPE_2_MUST_BE_GTE_SLOPE_1 = '95'; // Variable interest rate slope 2 can not be lower than slope 1 -+ string public constant CALLER_NOT_RISK_OR_POOL_OR_EMERGENCY_ADMIN = '96'; // 'The caller of the function is not a risk, pool or emergency admin' -+ 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 - } - --// downloads/MAINNET/ACL_MANAGER/ACLManager/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/ERC165.sol -+// downloads/ZKSYNC/ACL_MANAGER/ACLManager/src/core/contracts/dependencies/openzeppelin/contracts/ERC165.sol - - /** - * @dev Implementation of the {IERC165} interface. -@@ -554,7 +562,7 @@ abstract contract ERC165 is IERC165 { - } - } - --// downloads/MAINNET/ACL_MANAGER/ACLManager/@aave/core-v3/contracts/interfaces/IACLManager.sol -+// downloads/ZKSYNC/ACL_MANAGER/ACLManager/src/core/contracts/interfaces/IACLManager.sol - - /** - * @title IACLManager -@@ -727,7 +735,7 @@ interface IACLManager { - function isAssetListingAdmin(address admin) external view returns (bool); - } - --// downloads/MAINNET/ACL_MANAGER/ACLManager/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/AccessControl.sol -+// downloads/ZKSYNC/ACL_MANAGER/ACLManager/src/core/contracts/dependencies/openzeppelin/contracts/AccessControl.sol - - /** - * @dev Contract module that allows children to implement role-based access -@@ -937,7 +945,7 @@ abstract contract AccessControl is Context, IAccessControl, ERC165 { - } - } - --// downloads/MAINNET/ACL_MANAGER/ACLManager/@aave/core-v3/contracts/protocol/configuration/ACLManager.sol -+// downloads/ZKSYNC/ACL_MANAGER/ACLManager/src/core/contracts/protocol/configuration/ACLManager.sol - - /** - * @title ACLManager + ``` diff --git a/diffs/MAINNET_ZKSYNC/BORROW_LOGIC_DIFF.md b/diffs/MAINNET_ZKSYNC/BORROW_LOGIC_DIFF.md index 881e545a..c93a32ac 100644 --- a/diffs/MAINNET_ZKSYNC/BORROW_LOGIC_DIFF.md +++ b/diffs/MAINNET_ZKSYNC/BORROW_LOGIC_DIFF.md @@ -3,319 +3,5 @@ diff --git a/./downloads/MAINNET/BORROW_LOGIC.sol b/./downloads/ZKSYNC/BORROW_LO index 1a60f5e..d61106e 100644 --- a/./downloads/MAINNET/BORROW_LOGIC.sol +++ b/./downloads/ZKSYNC/BORROW_LOGIC.sol -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: BUSL-1.1 - pragma solidity ^0.8.0 ^0.8.10; - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/dependencies/openzeppelin/contracts/Address.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/dependencies/openzeppelin/contracts/Address.sol - - // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) - -@@ -221,7 +221,7 @@ library Address { - } - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/dependencies/openzeppelin/contracts/Context.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/dependencies/openzeppelin/contracts/Context.sol - - /* - * @dev Provides information about the current execution context, including the -@@ -244,7 +244,7 @@ abstract contract Context { - } - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/dependencies/openzeppelin/contracts/IAccessControl.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/dependencies/openzeppelin/contracts/IAccessControl.sol - - /** - * @dev External interface of AccessControl declared to support ERC165 detection. -@@ -334,7 +334,7 @@ interface IAccessControl { - function renounceRole(bytes32 role, address account) external; - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol - - /** - * @dev Interface of the ERC20 standard as defined in the EIP. -@@ -410,7 +410,7 @@ interface IERC20 { - event Approval(address indexed owner, address indexed spender, uint256 value); - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol - - // OpenZeppelin Contracts v4.4.1 (utils/math/SafeCast.sol) - -@@ -666,7 +666,7 @@ library SafeCast { - } - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/interfaces/IAaveIncentivesController.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/interfaces/IAaveIncentivesController.sol - - /** - * @title IAaveIncentivesController -@@ -685,7 +685,7 @@ interface IAaveIncentivesController { - function handleAction(address user, uint256 totalSupply, uint256 userBalance) external; - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/interfaces/IPoolAddressesProvider.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/interfaces/IPoolAddressesProvider.sol - - /** - * @title IPoolAddressesProvider -@@ -912,7 +912,7 @@ interface IPoolAddressesProvider { - function setPoolDataProvider(address newDataProvider) external; - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/interfaces/IPriceOracleGetter.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/interfaces/IPriceOracleGetter.sol - - /** - * @title IPriceOracleGetter -@@ -942,7 +942,7 @@ interface IPriceOracleGetter { - function getAssetPrice(address asset) external view returns (uint256); - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/interfaces/IScaledBalanceToken.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/interfaces/IScaledBalanceToken.sol - - /** - * @title IScaledBalanceToken -@@ -1014,7 +1014,7 @@ interface IScaledBalanceToken { - function getPreviousIndex(address user) external view returns (uint256); - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/helpers/Errors.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/helpers/Errors.sol - - /** - * @title Errors library -@@ -1122,7 +1122,7 @@ library Errors { - string public constant INVALID_FREEZE_STATE = '99'; // Reserve is already in the passed freeze state - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/math/PercentageMath.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/math/PercentageMath.sol - - /** - * @title PercentageMath library -@@ -1183,7 +1183,7 @@ library PercentageMath { - } - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/math/WadRayMath.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/math/WadRayMath.sol - - /** - * @title WadRayMath library -@@ -1309,7 +1309,7 @@ library WadRayMath { - } - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/types/DataTypes.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/types/DataTypes.sol - - library DataTypes { - /** -@@ -1622,7 +1622,7 @@ library DataTypes { - } - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol - - /// @title Gnosis Protocol v2 Safe ERC20 Transfer Library - /// @author Gnosis Developers -@@ -1735,7 +1735,7 @@ library GPv2SafeERC20 { - } - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol - - interface IERC20Detailed is IERC20 { - function name() external view returns (string memory); -@@ -1745,7 +1745,7 @@ interface IERC20Detailed is IERC20 { - function decimals() external view returns (uint8); - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/interfaces/IACLManager.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/interfaces/IACLManager.sol - - /** - * @title IACLManager -@@ -1918,7 +1918,7 @@ interface IACLManager { - function isAssetListingAdmin(address admin) external view returns (bool); - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/interfaces/IPriceOracleSentinel.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/interfaces/IPriceOracleSentinel.sol - - /** - * @title IPriceOracleSentinel -@@ -1983,7 +1983,7 @@ interface IPriceOracleSentinel { - function getGracePeriod() external view returns (uint256); - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/interfaces/IReserveInterestRateStrategy.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/interfaces/IReserveInterestRateStrategy.sol - - /** - * @title IReserveInterestRateStrategy -@@ -2011,7 +2011,7 @@ interface IReserveInterestRateStrategy { - ) external view returns (uint256, uint256, uint256); - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/math/MathUtils.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/math/MathUtils.sol - - /** - * @title MathUtils library -@@ -2108,7 +2108,7 @@ library MathUtils { - } - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/interfaces/IPool.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/interfaces/IPool.sol - - /** - * @title IPool -@@ -2940,7 +2940,7 @@ interface IPool { - function getSupplyLogic() external returns (address); - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol - - /** - * @title ReserveConfiguration library -@@ -3577,7 +3577,7 @@ library ReserveConfiguration { - } - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/helpers/Helpers.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/helpers/Helpers.sol - - /** - * @title Helpers library -@@ -3602,7 +3602,7 @@ library Helpers { - } - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/configuration/UserConfiguration.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/configuration/UserConfiguration.sol - - /** - * @title UserConfiguration library -@@ -3834,7 +3834,7 @@ library UserConfiguration { - } - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/interfaces/IInitializableAToken.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/interfaces/IInitializableAToken.sol - - /** - * @title IInitializableAToken -@@ -3887,7 +3887,7 @@ interface IInitializableAToken { - ) external; - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/interfaces/IInitializableDebtToken.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/interfaces/IInitializableDebtToken.sol - - /** - * @title IInitializableDebtToken -@@ -3936,7 +3936,7 @@ interface IInitializableDebtToken { - ) external; - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/interfaces/IStableDebtToken.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/interfaces/IStableDebtToken.sol - - /** - * @title IStableDebtToken -@@ -4073,7 +4073,7 @@ interface IStableDebtToken is IInitializableDebtToken { - function UNDERLYING_ASSET_ADDRESS() external view returns (address); - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/logic/IsolationModeLogic.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/logic/IsolationModeLogic.sol - - /** - * @title IsolationModeLogic library -@@ -4132,7 +4132,7 @@ library IsolationModeLogic { - } - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/interfaces/IVariableDebtToken.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/interfaces/IVariableDebtToken.sol - - /** - * @title IVariableDebtToken -@@ -4175,7 +4175,7 @@ interface IVariableDebtToken is IScaledBalanceToken, IInitializableDebtToken { - function UNDERLYING_ASSET_ADDRESS() external view returns (address); - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/interfaces/IAToken.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/interfaces/IAToken.sol - - /** - * @title IAToken -@@ -4309,7 +4309,7 @@ interface IAToken is IERC20, IScaledBalanceToken, IInitializableAToken { - function rescueTokens(address token, address to, uint256 amount) external; - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol - - /** - * @title IncentivizedERC20 -@@ -4533,7 +4533,7 @@ abstract contract IncentivizedERC20 is Context, IERC20Detailed { - } - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/logic/ReserveLogic.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/logic/ReserveLogic.sol - - /** - * @title ReserveLogic library -@@ -4893,7 +4893,7 @@ library ReserveLogic { - } - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/logic/EModeLogic.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/logic/EModeLogic.sol - - /** - * @title EModeLogic library -@@ -4994,7 +4994,7 @@ library EModeLogic { - } - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/logic/GenericLogic.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/logic/GenericLogic.sol - - /** - * @title GenericLogic library -@@ -5252,7 +5252,7 @@ library GenericLogic { - } - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol - - /** - * @title ReserveLogic library -@@ -6012,7 +6012,7 @@ library ValidationLogic { - } - } - --// downloads/MAINNET/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/logic/BorrowLogic.sol -+// downloads/ZKSYNC/BORROW_LOGIC/BorrowLogic/src/core/contracts/protocol/libraries/logic/BorrowLogic.sol - - /** - * @title BorrowLogic library + ``` diff --git a/diffs/MAINNET_ZKSYNC/BRIDGE_LOGIC_DIFF.md b/diffs/MAINNET_ZKSYNC/BRIDGE_LOGIC_DIFF.md index a5a1f6a7..d7ac960e 100644 --- a/diffs/MAINNET_ZKSYNC/BRIDGE_LOGIC_DIFF.md +++ b/diffs/MAINNET_ZKSYNC/BRIDGE_LOGIC_DIFF.md @@ -3,301 +3,5 @@ diff --git a/./downloads/MAINNET/BRIDGE_LOGIC.sol b/./downloads/ZKSYNC/BRIDGE_LO index af3d37e..202afd6 100644 --- a/./downloads/MAINNET/BRIDGE_LOGIC.sol +++ b/./downloads/ZKSYNC/BRIDGE_LOGIC.sol -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: BUSL-1.1 - pragma solidity ^0.8.0 ^0.8.10; - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/dependencies/openzeppelin/contracts/Address.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/dependencies/openzeppelin/contracts/Address.sol - - // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) - -@@ -221,7 +221,7 @@ library Address { - } - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/dependencies/openzeppelin/contracts/Context.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/dependencies/openzeppelin/contracts/Context.sol - - /* - * @dev Provides information about the current execution context, including the -@@ -244,7 +244,7 @@ abstract contract Context { - } - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/dependencies/openzeppelin/contracts/IAccessControl.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/dependencies/openzeppelin/contracts/IAccessControl.sol - - /** - * @dev External interface of AccessControl declared to support ERC165 detection. -@@ -334,7 +334,7 @@ interface IAccessControl { - function renounceRole(bytes32 role, address account) external; - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol - - /** - * @dev Interface of the ERC20 standard as defined in the EIP. -@@ -410,7 +410,7 @@ interface IERC20 { - event Approval(address indexed owner, address indexed spender, uint256 value); - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol - - // OpenZeppelin Contracts v4.4.1 (utils/math/SafeCast.sol) - -@@ -666,7 +666,7 @@ library SafeCast { - } - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/interfaces/IAaveIncentivesController.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/interfaces/IAaveIncentivesController.sol - - /** - * @title IAaveIncentivesController -@@ -685,7 +685,7 @@ interface IAaveIncentivesController { - function handleAction(address user, uint256 totalSupply, uint256 userBalance) external; - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/interfaces/IPoolAddressesProvider.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/interfaces/IPoolAddressesProvider.sol - - /** - * @title IPoolAddressesProvider -@@ -912,7 +912,7 @@ interface IPoolAddressesProvider { - function setPoolDataProvider(address newDataProvider) external; - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/interfaces/IPriceOracleGetter.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/interfaces/IPriceOracleGetter.sol - - /** - * @title IPriceOracleGetter -@@ -942,7 +942,7 @@ interface IPriceOracleGetter { - function getAssetPrice(address asset) external view returns (uint256); - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/interfaces/IScaledBalanceToken.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/interfaces/IScaledBalanceToken.sol - - /** - * @title IScaledBalanceToken -@@ -1014,7 +1014,7 @@ interface IScaledBalanceToken { - function getPreviousIndex(address user) external view returns (uint256); - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/protocol/libraries/helpers/Errors.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/protocol/libraries/helpers/Errors.sol - - /** - * @title Errors library -@@ -1122,7 +1122,7 @@ library Errors { - string public constant INVALID_FREEZE_STATE = '99'; // Reserve is already in the passed freeze state - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/protocol/libraries/math/PercentageMath.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/protocol/libraries/math/PercentageMath.sol - - /** - * @title PercentageMath library -@@ -1183,7 +1183,7 @@ library PercentageMath { - } - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/protocol/libraries/math/WadRayMath.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/protocol/libraries/math/WadRayMath.sol - - /** - * @title WadRayMath library -@@ -1309,7 +1309,7 @@ library WadRayMath { - } - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/protocol/libraries/types/DataTypes.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/protocol/libraries/types/DataTypes.sol - - library DataTypes { - /** -@@ -1622,7 +1622,7 @@ library DataTypes { - } - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol - - /// @title Gnosis Protocol v2 Safe ERC20 Transfer Library - /// @author Gnosis Developers -@@ -1735,7 +1735,7 @@ library GPv2SafeERC20 { - } - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol - - interface IERC20Detailed is IERC20 { - function name() external view returns (string memory); -@@ -1745,7 +1745,7 @@ interface IERC20Detailed is IERC20 { - function decimals() external view returns (uint8); - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/interfaces/IACLManager.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/interfaces/IACLManager.sol - - /** - * @title IACLManager -@@ -1918,7 +1918,7 @@ interface IACLManager { - function isAssetListingAdmin(address admin) external view returns (bool); - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/interfaces/IPriceOracleSentinel.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/interfaces/IPriceOracleSentinel.sol - - /** - * @title IPriceOracleSentinel -@@ -1983,7 +1983,7 @@ interface IPriceOracleSentinel { - function getGracePeriod() external view returns (uint256); - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/interfaces/IReserveInterestRateStrategy.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/interfaces/IReserveInterestRateStrategy.sol - - /** - * @title IReserveInterestRateStrategy -@@ -2011,7 +2011,7 @@ interface IReserveInterestRateStrategy { - ) external view returns (uint256, uint256, uint256); - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/protocol/libraries/math/MathUtils.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/protocol/libraries/math/MathUtils.sol - - /** - * @title MathUtils library -@@ -2108,7 +2108,7 @@ library MathUtils { - } - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/interfaces/IPool.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/interfaces/IPool.sol - - /** - * @title IPool -@@ -2940,7 +2940,7 @@ interface IPool { - function getSupplyLogic() external returns (address); - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol - - /** - * @title ReserveConfiguration library -@@ -3577,7 +3577,7 @@ library ReserveConfiguration { - } - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/protocol/libraries/configuration/UserConfiguration.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/protocol/libraries/configuration/UserConfiguration.sol - - /** - * @title UserConfiguration library -@@ -3809,7 +3809,7 @@ library UserConfiguration { - } - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/interfaces/IInitializableAToken.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/interfaces/IInitializableAToken.sol - - /** - * @title IInitializableAToken -@@ -3862,7 +3862,7 @@ interface IInitializableAToken { - ) external; - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/interfaces/IInitializableDebtToken.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/interfaces/IInitializableDebtToken.sol - - /** - * @title IInitializableDebtToken -@@ -3911,7 +3911,7 @@ interface IInitializableDebtToken { - ) external; - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/interfaces/IStableDebtToken.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/interfaces/IStableDebtToken.sol - - /** - * @title IStableDebtToken -@@ -4048,7 +4048,7 @@ interface IStableDebtToken is IInitializableDebtToken { - function UNDERLYING_ASSET_ADDRESS() external view returns (address); - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/interfaces/IVariableDebtToken.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/interfaces/IVariableDebtToken.sol - - /** - * @title IVariableDebtToken -@@ -4091,7 +4091,7 @@ interface IVariableDebtToken is IScaledBalanceToken, IInitializableDebtToken { - function UNDERLYING_ASSET_ADDRESS() external view returns (address); - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/interfaces/IAToken.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/interfaces/IAToken.sol - - /** - * @title IAToken -@@ -4225,7 +4225,7 @@ interface IAToken is IERC20, IScaledBalanceToken, IInitializableAToken { - function rescueTokens(address token, address to, uint256 amount) external; - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol - - /** - * @title IncentivizedERC20 -@@ -4449,7 +4449,7 @@ abstract contract IncentivizedERC20 is Context, IERC20Detailed { - } - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/protocol/libraries/logic/ReserveLogic.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/protocol/libraries/logic/ReserveLogic.sol - - /** - * @title ReserveLogic library -@@ -4809,7 +4809,7 @@ library ReserveLogic { - } - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/protocol/libraries/logic/EModeLogic.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/protocol/libraries/logic/EModeLogic.sol - - /** - * @title EModeLogic library -@@ -4910,7 +4910,7 @@ library EModeLogic { - } - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/protocol/libraries/logic/GenericLogic.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/protocol/libraries/logic/GenericLogic.sol - - /** - * @title GenericLogic library -@@ -5168,7 +5168,7 @@ library GenericLogic { - } - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol - - /** - * @title ReserveLogic library -@@ -5928,7 +5928,7 @@ library ValidationLogic { - } - } - --// downloads/MAINNET/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/protocol/libraries/logic/BridgeLogic.sol -+// downloads/ZKSYNC/BRIDGE_LOGIC/BridgeLogic/src/core/contracts/protocol/libraries/logic/BridgeLogic.sol - - library BridgeLogic { - using ReserveLogic for DataTypes.ReserveCache; + ``` diff --git a/diffs/MAINNET_ZKSYNC/COLLECTOR_IMPL_DIFF.md b/diffs/MAINNET_ZKSYNC/COLLECTOR_IMPL_DIFF.md index b3f04f53..8b43bcf9 100644 --- a/diffs/MAINNET_ZKSYNC/COLLECTOR_IMPL_DIFF.md +++ b/diffs/MAINNET_ZKSYNC/COLLECTOR_IMPL_DIFF.md @@ -3,746 +3,25 @@ diff --git a/./downloads/MAINNET/COLLECTOR_IMPL.sol b/./downloads/ZKSYNC/COLLECT index 63ccda0..e453c1f 100644 --- a/./downloads/MAINNET/COLLECTOR_IMPL.sol +++ b/./downloads/ZKSYNC/COLLECTOR_IMPL.sol -@@ -1,122 +1,9 @@ - // SPDX-License-Identifier: MIT --pragma solidity >=0.6.0 ^0.8.0 ^0.8.1; -+pragma solidity ^0.8.0 ^0.8.10; - --// downloads/MAINNET/COLLECTOR_IMPL/Collector/src/libs/ReentrancyGuard.sol -+// downloads/ZKSYNC/COLLECTOR_IMPL/Collector/src/core/contracts/dependencies/openzeppelin/contracts/Address.sol - --// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) -- --/** -- * @dev Contract module that helps prevent reentrant calls to a function. -- * -- * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier -- * available, which can be applied to functions to make sure there are no nested -- * (reentrant) calls to them. -- * -- * Note that because there is a single `nonReentrant` guard, functions marked as -- * `nonReentrant` may not call one another. This can be worked around by making -- * those functions `private`, and then adding `external` `nonReentrant` entry -- * points to them. -- * -- * TIP: If you would like to learn more about reentrancy and alternative ways -- * to protect against it, check out our blog post -- * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. -- */ --abstract contract ReentrancyGuard { -- // Booleans are more expensive than uint256 or any type that takes up a full -- // word because each write operation emits an extra SLOAD to first read the -- // slot's contents, replace the bits taken up by the boolean, and then write -- // back. This is the compiler's defense against contract upgrades and -- // pointer aliasing, and it cannot be disabled. -- -- // The values being non-zero value makes deployment a bit more expensive, -- // but in exchange the refund on every call to nonReentrant will be lower in -- // amount. Since refunds are capped to a percentage of the total -- // transaction's gas, it is best to keep them low in cases like this one, to -- // increase the likelihood of the full refund coming into effect. -- uint256 private constant _NOT_ENTERED = 1; -- uint256 private constant _ENTERED = 2; -- -- uint256 private _status; -- -- constructor() { -- _status = _NOT_ENTERED; -- } -- -- /** -- * @dev Prevents a contract from calling itself, directly or indirectly. -- * Calling a `nonReentrant` function from another `nonReentrant` -- * function is not supported. It is possible to prevent this from happening -- * by making the `nonReentrant` function external, and making it call a -- * `private` function that does the actual work. -- */ -- modifier nonReentrant() { -- // On the first call to nonReentrant, _notEntered will be true -- require(_status != _ENTERED, 'ReentrancyGuard: reentrant call'); -- -- // Any calls to nonReentrant after this point will fail -- _status = _ENTERED; -- -- _; -- -- // By storing the original value once again, a refund is triggered (see -- // https://eips.ethereum.org/EIPS/eip-2200) -- _status = _NOT_ENTERED; -- } -- -- /** -- * @dev As we use the guard with the proxy we need to init it with the empty value -- */ -- function _initGuard() internal { -- _status = _NOT_ENTERED; -- } --} -- --// downloads/MAINNET/COLLECTOR_IMPL/Collector/src/libs/VersionedInitializable.sol -- --/** -- * @title VersionedInitializable -- * -- * @dev Helper contract to support initializer functions. To use it, replace -- * the constructor with a function that has the `initializer` modifier. -- * WARNING: Unlike constructors, initializer functions must be manually -- * invoked. This applies both to deploying an Initializable contract, as well -- * as extending an Initializable contract via inheritance. -- * WARNING: When used with inheritance, manual care must be taken to not invoke -- * a parent initializer twice, or ensure that all initializers are idempotent, -- * because this is not dealt with automatically as with constructors. -- * -- * @author Aave, inspired by the OpenZeppelin Initializable contract -- */ --abstract contract VersionedInitializable { -- /** -- * @dev Indicates that the contract has been initialized. -- */ -- uint256 internal lastInitializedRevision = 0; -- -- /** -- * @dev Modifier to use in the initializer function of a contract. -- */ -- modifier initializer() { -- uint256 revision = getRevision(); -- require(revision > lastInitializedRevision, 'Contract instance has already been initialized'); -- -- lastInitializedRevision = revision; -- -- _; -- } -- -- /// @dev returns the revision number of the contract. -- /// Needs to be defined in the inherited class as a constant. -- function getRevision() internal pure virtual returns (uint256); -- -- // Reserved storage space to allow for layout changes in the future. -- uint256[50] private ______gap; --} -- --// lib/solidity-utils/src/contracts/oz-common/Address.sol -- --// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) --// From commit https://github.com/OpenZeppelin/openzeppelin-contracts/commit/8b778fa20d6d76340c5fac1ed66c80273f05b95a -+// OpenZeppelin Contracts v4.4.1 (utils/Address.sol) - - /** - * @dev Collection of functions related to the address type -@@ -138,22 +25,17 @@ library Address { - * - an address where a contract will be created - * - an address where a contract lived, but was destroyed - * ==== -- * -- * [IMPORTANT] -- * ==== -- * You shouldn't rely on `isContract` to protect against flash loan attacks! -- * -- * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets -- * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract -- * constructor. -- * ==== - */ - function isContract(address account) internal view returns (bool) { -- // This method relies on extcodesize/address.code.length, which returns 0 -- // for contracts in construction, since the code is only stored at the end -- // of the constructor execution. -+ // This method relies on extcodesize, which returns 0 for contracts in -+ // construction, since the code is only stored at the end of the -+ // constructor execution. - -- return account.code.length > 0; -+ uint256 size; -+ assembly { -+ size := extcodesize(account) -+ } -+ return size > 0; - } - - /** -@@ -198,7 +80,7 @@ library Address { - * _Available since v3.1._ - */ - function functionCall(address target, bytes memory data) internal returns (bytes memory) { -- return functionCallWithValue(target, data, 0, 'Address: low-level call failed'); -+ return functionCall(target, data, 'Address: low-level call failed'); - } - - /** -@@ -247,8 +129,10 @@ library Address { - string memory errorMessage - ) internal returns (bytes memory) { - require(address(this).balance >= value, 'Address: insufficient balance for call'); -+ require(isContract(target), 'Address: call to non-contract'); -+ - (bool success, bytes memory returndata) = target.call{value: value}(data); -- return verifyCallResultFromTarget(target, success, returndata, errorMessage); -+ return verifyCallResult(success, returndata, errorMessage); - } - - /** -@@ -275,8 +159,10 @@ library Address { - bytes memory data, - string memory errorMessage - ) internal view returns (bytes memory) { -+ require(isContract(target), 'Address: static call to non-contract'); -+ - (bool success, bytes memory returndata) = target.staticcall(data); -- return verifyCallResultFromTarget(target, success, returndata, errorMessage); -+ return verifyCallResult(success, returndata, errorMessage); - } - - /** -@@ -300,37 +186,15 @@ library Address { - bytes memory data, - string memory errorMessage - ) internal returns (bytes memory) { -+ require(isContract(target), 'Address: delegate call to non-contract'); -+ - (bool success, bytes memory returndata) = target.delegatecall(data); -- return verifyCallResultFromTarget(target, success, returndata, errorMessage); -+ return verifyCallResult(success, returndata, errorMessage); - } - - /** -- * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling -- * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. -- * -- * _Available since v4.8._ -- */ -- function verifyCallResultFromTarget( -- address target, -- bool success, -- bytes memory returndata, -- string memory errorMessage -- ) internal view returns (bytes memory) { -- if (success) { -- if (returndata.length == 0) { -- // only check isContract if the call was successful and the return data is empty -- // otherwise we already know that it was a contract -- require(isContract(target), 'Address: call to non-contract'); -- } -- return returndata; -- } else { -- _revert(returndata, errorMessage); -- } -- } -- -- /** -- * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the -- * revert reason or using the provided one. -+ * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the -+ * revert reason using the provided one. - * - * _Available since v4.3._ - */ -@@ -342,48 +206,27 @@ library Address { - if (success) { - return returndata; - } else { -- _revert(returndata, errorMessage); -- } -- } -+ // Look for revert reason and bubble it up if present -+ if (returndata.length > 0) { -+ // The easiest way to bubble the revert reason is using memory via assembly - -- function _revert(bytes memory returndata, string memory errorMessage) private pure { -- // Look for revert reason and bubble it up if present -- if (returndata.length > 0) { -- // The easiest way to bubble the revert reason is using memory via assembly -- /// @solidity memory-safe-assembly -- assembly { -- let returndata_size := mload(returndata) -- revert(add(32, returndata), returndata_size) -+ assembly { -+ let returndata_size := mload(returndata) -+ revert(add(32, returndata), returndata_size) -+ } -+ } else { -+ revert(errorMessage); - } -- } else { -- revert(errorMessage); - } - } - } - --// lib/solidity-utils/src/contracts/oz-common/interfaces/IERC20.sol -- --// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) --// From commit https://github.com/OpenZeppelin/openzeppelin-contracts/commit/a035b235b4f2c9af4ba88edc4447f02e37f8d124 -+// downloads/ZKSYNC/COLLECTOR_IMPL/Collector/src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol - - /** - * @dev Interface of the ERC20 standard as defined in the EIP. - */ - interface IERC20 { -- /** -- * @dev Emitted when `value` tokens are moved from one account (`from`) to -- * another (`to`). -- * -- * Note that `value` may be zero. -- */ -- event Transfer(address indexed from, address indexed to, uint256 value); -- -- /** -- * @dev Emitted when the allowance of a `spender` for an `owner` is set by -- * a call to {approve}. `value` is the new allowance. -- */ -- event Approval(address indexed owner, address indexed spender, uint256 value); -- - /** - * @dev Returns the amount of tokens in existence. - */ -@@ -395,13 +238,13 @@ interface IERC20 { - function balanceOf(address account) external view returns (uint256); - - /** -- * @dev Moves `amount` tokens from the caller's account to `to`. -+ * @dev Moves `amount` tokens from the caller's account to `recipient`. - * - * Returns a boolean value indicating whether the operation succeeded. - * - * Emits a {Transfer} event. - */ -- function transfer(address to, uint256 amount) external returns (bool); -+ function transfer(address recipient, uint256 amount) external returns (bool); - - /** - * @dev Returns the remaining number of tokens that `spender` will be -@@ -429,7 +272,7 @@ interface IERC20 { - function approve(address spender, uint256 amount) external returns (bool); - - /** -- * @dev Moves `amount` tokens from `from` to `to` using the -+ * @dev Moves `amount` tokens from `sender` to `recipient` using the - * allowance mechanism. `amount` is then deducted from the caller's - * allowance. - * -@@ -437,71 +280,171 @@ interface IERC20 { - * - * Emits a {Transfer} event. - */ -- function transferFrom(address from, address to, uint256 amount) external returns (bool); --} -+ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); -+ -+ /** -+ * @dev Emitted when `value` tokens are moved from one account (`from`) to -+ * another (`to`). -+ * -+ * Note that `value` may be zero. -+ */ -+ event Transfer(address indexed from, address indexed to, uint256 value); - --// lib/solidity-utils/src/contracts/oz-common/interfaces/IERC20Permit.sol -+ /** -+ * @dev Emitted when the allowance of a `spender` for an `owner` is set by -+ * a call to {approve}. `value` is the new allowance. -+ */ -+ event Approval(address indexed owner, address indexed spender, uint256 value); -+} - --// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) --// Modified from https://github.com/OpenZeppelin/openzeppelin-contracts/commit/00cbf5a236564c3b7aacdad1f378cae22d890ca6 -+// downloads/ZKSYNC/COLLECTOR_IMPL/Collector/src/core/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol - - /** -- * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in -- * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. -- * -- * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by -- * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't -- * need to send a transaction, and thus is not required to hold Ether at all. -+ * @title VersionedInitializable -+ * @author Aave, inspired by the OpenZeppelin Initializable contract -+ * @notice Helper contract to implement initializer functions. To use it, replace -+ * the constructor with a function that has the `initializer` modifier. -+ * @dev WARNING: Unlike constructors, initializer functions must be manually -+ * invoked. This applies both to deploying an Initializable contract, as well -+ * as extending an Initializable contract via inheritance. -+ * WARNING: When used with inheritance, manual care must be taken to not invoke -+ * a parent initializer twice, or ensure that all initializers are idempotent, -+ * because this is not dealt with automatically as with constructors. - */ --interface IERC20Permit { -+abstract contract VersionedInitializable { - /** -- * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, -- * given ``owner``'s signed approval. -- * -- * IMPORTANT: The same issues {IERC20-approve} has related to transaction -- * ordering also apply here. -- * -- * Emits an {Approval} event. -- * -- * Requirements: -- * -- * - `spender` cannot be the zero address. -- * - `deadline` must be a timestamp in the future. -- * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` -- * over the EIP712-formatted function arguments. -- * - the signature must use ``owner``'s current nonce (see {nonces}). -- * -- * For more information on the signature format, see the -- * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP -- * section]. -+ * @dev Indicates that the contract has been initialized. - */ -- function permit( -- address owner, -- address spender, -- uint256 value, -- uint256 deadline, -- uint8 v, -- bytes32 r, -- bytes32 s -- ) external; -+ uint256 private lastInitializedRevision = 0; - - /** -- * @dev Returns the current nonce for `owner`. This value must be -- * included whenever a signature is generated for {permit}. -- * -- * Every successful call to {permit} increases ``owner``'s nonce by one. This -- * prevents a signature from being used multiple times. -+ * @dev Indicates that the contract is in the process of being initialized. -+ */ -+ bool private initializing; -+ -+ /** -+ * @dev Modifier to use in the initializer function of a contract. -+ */ -+ modifier initializer() { -+ uint256 revision = getRevision(); -+ require( -+ initializing || isConstructor() || revision > lastInitializedRevision, -+ 'Contract instance has already been initialized' -+ ); -+ -+ bool isTopLevelCall = !initializing; -+ if (isTopLevelCall) { -+ initializing = true; -+ lastInitializedRevision = revision; -+ } -+ -+ _; -+ -+ if (isTopLevelCall) { -+ initializing = false; -+ } -+ } -+ -+ /** -+ * @notice Returns the revision number of the contract -+ * @dev Needs to be defined in the inherited class as a constant. -+ * @return The revision number -+ */ -+ function getRevision() internal pure virtual returns (uint256); -+ -+ /** -+ * @notice Returns true if and only if the function is running in the constructor -+ * @return True if the function is running in the constructor - */ -- function nonces(address owner) external view returns (uint256); -+ function isConstructor() private view returns (bool) { -+ // extcodesize checks the size of the code stored in an address, and -+ // address returns the current address. Since the code is still not -+ // deployed when running a constructor, any checks on its code size will -+ // yield zero, making it an effective way to detect if a contract is -+ // under construction or not. -+ uint256 cs; -+ //solium-disable-next-line -+ assembly { -+ cs := extcodesize(address()) -+ } -+ return cs == 0; -+ } -+ -+ // Reserved storage space to allow for layout changes in the future. -+ uint256[50] private ______gap; -+} -+ -+// downloads/ZKSYNC/COLLECTOR_IMPL/Collector/src/periphery/contracts/dependencies/openzeppelin/ReentrancyGuard.sol -+ -+// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) -+ -+/** -+ * @dev Contract module that helps prevent reentrant calls to a function. -+ * -+ * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier -+ * available, which can be applied to functions to make sure there are no nested -+ * (reentrant) calls to them. -+ * -+ * Note that because there is a single `nonReentrant` guard, functions marked as -+ * `nonReentrant` may not call one another. This can be worked around by making -+ * those functions `private`, and then adding `external` `nonReentrant` entry -+ * points to them. -+ * -+ * TIP: If you would like to learn more about reentrancy and alternative ways -+ * to protect against it, check out our blog post -+ * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. -+ */ -+abstract contract ReentrancyGuard { -+ // Booleans are more expensive than uint256 or any type that takes up a full -+ // word because each write operation emits an extra SLOAD to first read the -+ // slot's contents, replace the bits taken up by the boolean, and then write -+ // back. This is the compiler's defense against contract upgrades and -+ // pointer aliasing, and it cannot be disabled. -+ -+ // The values being non-zero value makes deployment a bit more expensive, -+ // but in exchange the refund on every call to nonReentrant will be lower in -+ // amount. Since refunds are capped to a percentage of the total -+ // transaction's gas, it is best to keep them low in cases like this one, to -+ // increase the likelihood of the full refund coming into effect. -+ uint256 private constant _NOT_ENTERED = 1; -+ uint256 private constant _ENTERED = 2; -+ -+ uint256 private _status; -+ -+ constructor() { -+ _status = _NOT_ENTERED; -+ } -+ -+ /** -+ * @dev Prevents a contract from calling itself, directly or indirectly. -+ * Calling a `nonReentrant` function from another `nonReentrant` -+ * function is not supported. It is possible to prevent this from happening -+ * by making the `nonReentrant` function external, and making it call a -+ * `private` function that does the actual work. -+ */ -+ modifier nonReentrant() { -+ // On the first call to nonReentrant, _notEntered will be true -+ require(_status != _ENTERED, 'ReentrancyGuard: reentrant call'); -+ -+ // Any calls to nonReentrant after this point will fail -+ _status = _ENTERED; -+ -+ _; -+ -+ // By storing the original value once again, a refund is triggered (see -+ // https://eips.ethereum.org/EIPS/eip-2200) -+ _status = _NOT_ENTERED; -+ } - - /** -- * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. -+ * @dev As we use the guard with the proxy we need to init it with the empty value - */ -- // solhint-disable-next-line func-name-mixedcase -- function DOMAIN_SEPARATOR() external view returns (bytes32); -+ function _initGuard() internal { -+ _status = _NOT_ENTERED; -+ } - } - --// downloads/MAINNET/COLLECTOR_IMPL/Collector/src/interfaces/ICollector.sol -+// downloads/ZKSYNC/COLLECTOR_IMPL/Collector/src/periphery/contracts/treasury/ICollector.sol - - interface ICollector { - struct Stream { -@@ -673,10 +616,9 @@ interface ICollector { - function getNextStreamId() external view returns (uint256); - } - --// lib/solidity-utils/src/contracts/oz-common/SafeERC20.sol -+// downloads/ZKSYNC/COLLECTOR_IMPL/Collector/src/core/contracts/dependencies/openzeppelin/contracts/SafeERC20.sol - --// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol) --// Modified From commit https://github.com/OpenZeppelin/openzeppelin-contracts/commit/00cbf5a236564c3b7aacdad1f378cae22d890ca6 -+// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol) - - /** - * @title SafeERC20 -@@ -690,96 +632,52 @@ interface ICollector { - library SafeERC20 { - using Address for address; - -- /** -- * @dev An operation with an ERC20 token failed. -- */ -- error SafeERC20FailedOperation(address token); -- -- /** -- * @dev Indicates a failed `decreaseAllowance` request. -- */ -- error SafeERC20FailedDecreaseAllowance( -- address spender, -- uint256 currentAllowance, -- uint256 requestedDecrease -- ); -- -- /** -- * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, -- * non-reverting calls are assumed to be successful. -- */ - function safeTransfer(IERC20 token, address to, uint256 value) internal { -- _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value))); -+ _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); - } - -- /** -- * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the -- * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. -- */ - function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { -- _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value))); -+ _callOptionalReturn( -+ token, -+ abi.encodeWithSelector(token.transferFrom.selector, from, to, value) -+ ); - } - - /** -- * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, -- * non-reverting calls are assumed to be successful. -+ * @dev Deprecated. This function has issues similar to the ones found in -+ * {IERC20-approve}, and its usage is discouraged. -+ * -+ * Whenever possible, use {safeIncreaseAllowance} and -+ * {safeDecreaseAllowance} instead. - */ -+ function safeApprove(IERC20 token, address spender, uint256 value) internal { -+ // safeApprove should only be called when setting an initial allowance, -+ // or when resetting it to zero. To increase and decrease it, use -+ // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' -+ require( -+ (value == 0) || (token.allowance(address(this), spender) == 0), -+ 'SafeERC20: approve from non-zero to non-zero allowance' -+ ); -+ _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); -+ } -+ - function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { -- uint256 oldAllowance = token.allowance(address(this), spender); -- forceApprove(token, spender, oldAllowance + value); -+ uint256 newAllowance = token.allowance(address(this), spender) + value; -+ _callOptionalReturn( -+ token, -+ abi.encodeWithSelector(token.approve.selector, spender, newAllowance) -+ ); - } - -- /** -- * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no value, -- * non-reverting calls are assumed to be successful. -- */ -- function safeDecreaseAllowance( -- IERC20 token, -- address spender, -- uint256 requestedDecrease -- ) internal { -+ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { - unchecked { -- uint256 currentAllowance = token.allowance(address(this), spender); -- if (currentAllowance < requestedDecrease) { -- revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); -- } -- forceApprove(token, spender, currentAllowance - requestedDecrease); -- } -- } -- -- /** -- * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, -- * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval -- * to be set to zero before setting it to a non-zero value, such as USDT. -- */ -- function forceApprove(IERC20 token, address spender, uint256 value) internal { -- bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); -- -- if (!_callOptionalReturnBool(token, approvalCall)) { -- _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); -- _callOptionalReturn(token, approvalCall); -- } -- } -- -- /** -- * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. -- * Revert on invalid signature. -- */ -- function safePermit( -- IERC20Permit token, -- address owner, -- address spender, -- uint256 value, -- uint256 deadline, -- uint8 v, -- bytes32 r, -- bytes32 s -- ) internal { -- uint256 nonceBefore = token.nonces(owner); -- token.permit(owner, spender, value, deadline, v, r, s); -- uint256 nonceAfter = token.nonces(owner); -- if (nonceAfter != nonceBefore + 1) { -- revert SafeERC20FailedOperation(address(token)); -+ uint256 oldAllowance = token.allowance(address(this), spender); -+ require(oldAllowance >= value, 'SafeERC20: decreased allowance below zero'); -+ uint256 newAllowance = oldAllowance - value; -+ _callOptionalReturn( -+ token, -+ abi.encodeWithSelector(token.approve.selector, spender, newAllowance) -+ ); - } - } - -@@ -791,37 +689,18 @@ library SafeERC20 { - */ - function _callOptionalReturn(IERC20 token, bytes memory data) private { - // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since -- // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that -+ // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that - // the target address contains contract code and also asserts for success in the low-level call. - -- bytes memory returndata = address(token).functionCall(data); -- if (returndata.length != 0 && !abi.decode(returndata, (bool))) { -- revert SafeERC20FailedOperation(address(token)); -+ bytes memory returndata = address(token).functionCall(data, 'SafeERC20: low-level call failed'); -+ if (returndata.length > 0) { -+ // Return data is optional -+ require(abi.decode(returndata, (bool)), 'SafeERC20: ERC20 operation did not succeed'); - } - } -- -- /** -- * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement -- * on the return value: the return value is optional (but if data is returned, it must not be false). -- * @param token The token targeted by the call. -- * @param data The call data (encoded using abi.encode or one of its variants). -- * -- * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. -- */ -- function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { -- // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since -- // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false -- // and not revert is the subcall reverts. -- -- (bool success, bytes memory returndata) = address(token).call(data); -- return -- success && -- (returndata.length == 0 || abi.decode(returndata, (bool))) && -- address(token).code.length > 0; -- } - } - + -// downloads/MAINNET/COLLECTOR_IMPL/Collector/src/contracts/Collector.sol +// downloads/ZKSYNC/COLLECTOR_IMPL/Collector/src/periphery/contracts/treasury/Collector.sol - + /** * @title Collector @@ -903,8 +782,6 @@ contract Collector is VersionedInitializable, ICollector, ReentrancyGuard { _nextStreamId = nextStreamId; } - + - // can be removed after first deployment - _initGuard(); _setFundsAdmin(fundsAdmin); } - + @@ -1021,9 +898,6 @@ contract Collector is VersionedInitializable, ICollector, ReentrancyGuard { } } - + - /// @dev needed in order to receive ETH from the Aave v1 ecosystem reserve - receive() external payable {} - diff --git a/diffs/MAINNET_ZKSYNC/CONFIGURATOR_LOGIC_DIFF.md b/diffs/MAINNET_ZKSYNC/CONFIGURATOR_LOGIC_DIFF.md index 8d761df0..3ab88180 100644 --- a/diffs/MAINNET_ZKSYNC/CONFIGURATOR_LOGIC_DIFF.md +++ b/diffs/MAINNET_ZKSYNC/CONFIGURATOR_LOGIC_DIFF.md @@ -3,175 +3,5 @@ diff --git a/./downloads/MAINNET/CONFIGURATOR_LOGIC.sol b/./downloads/ZKSYNC/CON index 54ee17a..70934b0 100644 --- a/./downloads/MAINNET/CONFIGURATOR_LOGIC.sol +++ b/./downloads/ZKSYNC/CONFIGURATOR_LOGIC.sol -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: BUSL-1.1 - pragma solidity ^0.8.0 ^0.8.10; - --// downloads/MAINNET/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/dependencies/openzeppelin/contracts/Address.sol -+// downloads/ZKSYNC/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/dependencies/openzeppelin/contracts/Address.sol - - // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) - -@@ -221,7 +221,7 @@ library Address { - } - } - --// downloads/MAINNET/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol -+// downloads/ZKSYNC/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol - - /** - * @dev Interface of the ERC20 standard as defined in the EIP. -@@ -297,7 +297,7 @@ interface IERC20 { - event Approval(address indexed owner, address indexed spender, uint256 value); - } - --// downloads/MAINNET/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/dependencies/openzeppelin/upgradeability/Proxy.sol -+// downloads/ZKSYNC/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/dependencies/openzeppelin/upgradeability/Proxy.sol - - /** - * @title Proxy -@@ -378,7 +378,7 @@ abstract contract Proxy { - } - } - --// downloads/MAINNET/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/interfaces/IAaveIncentivesController.sol -+// downloads/ZKSYNC/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/interfaces/IAaveIncentivesController.sol - - /** - * @title IAaveIncentivesController -@@ -397,7 +397,7 @@ interface IAaveIncentivesController { - function handleAction(address user, uint256 totalSupply, uint256 userBalance) external; - } - --// downloads/MAINNET/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/interfaces/IPoolAddressesProvider.sol -+// downloads/ZKSYNC/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/interfaces/IPoolAddressesProvider.sol - - /** - * @title IPoolAddressesProvider -@@ -624,7 +624,7 @@ interface IPoolAddressesProvider { - function setPoolDataProvider(address newDataProvider) external; - } - --// downloads/MAINNET/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/protocol/libraries/helpers/Errors.sol -+// downloads/ZKSYNC/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/protocol/libraries/helpers/Errors.sol - - /** - * @title Errors library -@@ -732,7 +732,7 @@ library Errors { - string public constant INVALID_FREEZE_STATE = '99'; // Reserve is already in the passed freeze state - } - --// downloads/MAINNET/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/protocol/libraries/types/ConfiguratorInputTypes.sol -+// downloads/ZKSYNC/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/protocol/libraries/types/ConfiguratorInputTypes.sol - - library ConfiguratorInputTypes { - struct InitReserveInput { -@@ -774,7 +774,7 @@ library ConfiguratorInputTypes { - } - } - --// downloads/MAINNET/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/protocol/libraries/types/DataTypes.sol -+// downloads/ZKSYNC/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/protocol/libraries/types/DataTypes.sol - - library DataTypes { - /** -@@ -1087,7 +1087,7 @@ library DataTypes { - } - } - --// downloads/MAINNET/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol -+// downloads/ZKSYNC/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol - - interface IERC20Detailed is IERC20 { - function name() external view returns (string memory); -@@ -1097,7 +1097,7 @@ interface IERC20Detailed is IERC20 { - function decimals() external view returns (uint8); - } - --// downloads/MAINNET/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/interfaces/IReserveInterestRateStrategy.sol -+// downloads/ZKSYNC/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/interfaces/IReserveInterestRateStrategy.sol - - /** - * @title IReserveInterestRateStrategy -@@ -1125,7 +1125,7 @@ interface IReserveInterestRateStrategy { - ) external view returns (uint256, uint256, uint256); - } - --// downloads/MAINNET/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/dependencies/openzeppelin/upgradeability/BaseUpgradeabilityProxy.sol -+// downloads/ZKSYNC/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/dependencies/openzeppelin/upgradeability/BaseUpgradeabilityProxy.sol - - /** - * @title BaseUpgradeabilityProxy -@@ -1188,7 +1188,7 @@ contract BaseUpgradeabilityProxy is Proxy { - } - } - --// downloads/MAINNET/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/interfaces/IPool.sol -+// downloads/ZKSYNC/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/interfaces/IPool.sol - - /** - * @title IPool -@@ -2020,7 +2020,7 @@ interface IPool { - function getSupplyLogic() external returns (address); - } - --// downloads/MAINNET/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol -+// downloads/ZKSYNC/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol - - /** - * @title ReserveConfiguration library -@@ -2657,7 +2657,7 @@ library ReserveConfiguration { - } - } - --// downloads/MAINNET/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/dependencies/openzeppelin/upgradeability/InitializableUpgradeabilityProxy.sol -+// downloads/ZKSYNC/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/dependencies/openzeppelin/upgradeability/InitializableUpgradeabilityProxy.sol - - /** - * @title InitializableUpgradeabilityProxy -@@ -2684,7 +2684,7 @@ contract InitializableUpgradeabilityProxy is BaseUpgradeabilityProxy { - } - } - --// downloads/MAINNET/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/protocol/libraries/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol -+// downloads/ZKSYNC/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/protocol/libraries/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol - - /** - * @title BaseImmutableAdminUpgradeabilityProxy -@@ -2767,7 +2767,7 @@ contract BaseImmutableAdminUpgradeabilityProxy is BaseUpgradeabilityProxy { - } - } - --// downloads/MAINNET/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/interfaces/IInitializableAToken.sol -+// downloads/ZKSYNC/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/interfaces/IInitializableAToken.sol - - /** - * @title IInitializableAToken -@@ -2820,7 +2820,7 @@ interface IInitializableAToken { - ) external; - } - --// downloads/MAINNET/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/interfaces/IInitializableDebtToken.sol -+// downloads/ZKSYNC/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/interfaces/IInitializableDebtToken.sol - - /** - * @title IInitializableDebtToken -@@ -2869,7 +2869,7 @@ interface IInitializableDebtToken { - ) external; - } - --// downloads/MAINNET/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol -+// downloads/ZKSYNC/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol - - /** - * @title InitializableAdminUpgradeabilityProxy -@@ -2894,7 +2894,7 @@ contract InitializableImmutableAdminUpgradeabilityProxy is - } - } - --// downloads/MAINNET/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/protocol/libraries/logic/ConfiguratorLogic.sol -+// downloads/ZKSYNC/CONFIGURATOR_LOGIC/ConfiguratorLogic/src/core/contracts/protocol/libraries/logic/ConfiguratorLogic.sol - - /** - * @title ConfiguratorLogic library + ``` diff --git a/diffs/MAINNET_ZKSYNC/DEFAULT_A_TOKEN_IMPL_DIFF.md b/diffs/MAINNET_ZKSYNC/DEFAULT_A_TOKEN_IMPL_DIFF.md index 10e185c2..6fdd8005 100644 --- a/diffs/MAINNET_ZKSYNC/DEFAULT_A_TOKEN_IMPL_DIFF.md +++ b/diffs/MAINNET_ZKSYNC/DEFAULT_A_TOKEN_IMPL_DIFF.md @@ -3,443 +3,10 @@ diff --git a/./downloads/MAINNET/DEFAULT_A_TOKEN_IMPL.sol b/./downloads/ZKSYNC/D index 36ee10c..459d34e 100644 --- a/./downloads/MAINNET/DEFAULT_A_TOKEN_IMPL.sol +++ b/./downloads/ZKSYNC/DEFAULT_A_TOKEN_IMPL.sol -@@ -1,7 +1,7 @@ --// SPDX-License-Identifier: BUSL-1.1 --pragma solidity =0.8.10 ^0.8.0; -+// SPDX-License-Identifier: MIT -+pragma solidity ^0.8.0 ^0.8.10; - --// downloads/MAINNET/DEFAULT_A_TOKEN_IMPL/AToken/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/Context.sol -+// downloads/ZKSYNC/DEFAULT_A_TOKEN_IMPL/ATokenInstance/src/core/contracts/dependencies/openzeppelin/contracts/Context.sol - - /* - * @dev Provides information about the current execution context, including the -@@ -24,7 +24,7 @@ abstract contract Context { - } - } - --// downloads/MAINNET/DEFAULT_A_TOKEN_IMPL/AToken/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/IERC20.sol -+// downloads/ZKSYNC/DEFAULT_A_TOKEN_IMPL/ATokenInstance/src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol - - /** - * @dev Interface of the ERC20 standard as defined in the EIP. -@@ -100,7 +100,7 @@ interface IERC20 { - event Approval(address indexed owner, address indexed spender, uint256 value); - } - --// downloads/MAINNET/DEFAULT_A_TOKEN_IMPL/AToken/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/SafeCast.sol -+// downloads/ZKSYNC/DEFAULT_A_TOKEN_IMPL/ATokenInstance/src/core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol - - // OpenZeppelin Contracts v4.4.1 (utils/math/SafeCast.sol) - -@@ -356,7 +356,7 @@ library SafeCast { - } - } - --// downloads/MAINNET/DEFAULT_A_TOKEN_IMPL/AToken/@aave/core-v3/contracts/interfaces/IAaveIncentivesController.sol -+// downloads/ZKSYNC/DEFAULT_A_TOKEN_IMPL/ATokenInstance/src/core/contracts/interfaces/IAaveIncentivesController.sol - - /** - * @title IAaveIncentivesController -@@ -375,7 +375,7 @@ interface IAaveIncentivesController { - function handleAction(address user, uint256 totalSupply, uint256 userBalance) external; - } - --// downloads/MAINNET/DEFAULT_A_TOKEN_IMPL/AToken/@aave/core-v3/contracts/interfaces/IPoolAddressesProvider.sol -+// downloads/ZKSYNC/DEFAULT_A_TOKEN_IMPL/ATokenInstance/src/core/contracts/interfaces/IPoolAddressesProvider.sol - - /** - * @title IPoolAddressesProvider -@@ -602,7 +602,7 @@ interface IPoolAddressesProvider { - function setPoolDataProvider(address newDataProvider) external; - } - --// downloads/MAINNET/DEFAULT_A_TOKEN_IMPL/AToken/@aave/core-v3/contracts/interfaces/IScaledBalanceToken.sol -+// downloads/ZKSYNC/DEFAULT_A_TOKEN_IMPL/ATokenInstance/src/core/contracts/interfaces/IScaledBalanceToken.sol - - /** - * @title IScaledBalanceToken -@@ -674,7 +674,7 @@ interface IScaledBalanceToken { - function getPreviousIndex(address user) external view returns (uint256); - } - --// downloads/MAINNET/DEFAULT_A_TOKEN_IMPL/AToken/@aave/core-v3/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol -+// downloads/ZKSYNC/DEFAULT_A_TOKEN_IMPL/ATokenInstance/src/core/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol - - /** - * @title VersionedInitializable -@@ -751,7 +751,7 @@ abstract contract VersionedInitializable { - uint256[50] private ______gap; - } - --// downloads/MAINNET/DEFAULT_A_TOKEN_IMPL/AToken/@aave/core-v3/contracts/protocol/libraries/helpers/Errors.sol -+// downloads/ZKSYNC/DEFAULT_A_TOKEN_IMPL/ATokenInstance/src/core/contracts/protocol/libraries/helpers/Errors.sol - - /** - * @title Errors library -@@ -819,7 +819,7 @@ library Errors { - string public constant PRICE_ORACLE_SENTINEL_CHECK_FAILED = '59'; // 'Price oracle sentinel validation failed' - string public constant ASSET_NOT_BORROWABLE_IN_ISOLATION = '60'; // 'Asset is not borrowable in isolation mode' - string public constant RESERVE_ALREADY_INITIALIZED = '61'; // 'Reserve has already been initialized' -- string public constant USER_IN_ISOLATION_MODE = '62'; // 'User is in isolation mode' -+ string public constant USER_IN_ISOLATION_MODE_OR_LTV_ZERO = '62'; // 'User is in isolation mode or ltv is zero' - string public constant INVALID_LTV = '63'; // 'Invalid ltv parameter for the reserve' - string public constant INVALID_LIQ_THRESHOLD = '64'; // 'Invalid liquidity threshold parameter for the reserve' - string public constant INVALID_LIQ_BONUS = '65'; // 'Invalid liquidity bonus parameter for the reserve' -@@ -849,9 +849,17 @@ library Errors { - 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 -+ string public constant INVALID_MAX_RATE = '92'; // The expect maximum borrow rate is invalid -+ string public constant WITHDRAW_TO_ATOKEN = '93'; // Withdrawing to the aToken is not allowed -+ string public constant SUPPLY_TO_ATOKEN = '94'; // Supplying to the aToken is not allowed -+ string public constant SLOPE_2_MUST_BE_GTE_SLOPE_1 = '95'; // Variable interest rate slope 2 can not be lower than slope 1 -+ string public constant CALLER_NOT_RISK_OR_POOL_OR_EMERGENCY_ADMIN = '96'; // 'The caller of the function is not a risk, pool or emergency admin' -+ 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 - } - --// downloads/MAINNET/DEFAULT_A_TOKEN_IMPL/AToken/@aave/core-v3/contracts/protocol/libraries/math/WadRayMath.sol -+// downloads/ZKSYNC/DEFAULT_A_TOKEN_IMPL/ATokenInstance/src/core/contracts/protocol/libraries/math/WadRayMath.sol - - /** - * @title WadRayMath library -@@ -977,9 +985,46 @@ library WadRayMath { - } - } - --// downloads/MAINNET/DEFAULT_A_TOKEN_IMPL/AToken/@aave/core-v3/contracts/protocol/libraries/types/DataTypes.sol -+// downloads/ZKSYNC/DEFAULT_A_TOKEN_IMPL/ATokenInstance/src/core/contracts/protocol/libraries/types/DataTypes.sol - - library DataTypes { -+ /** -+ * This exists specifically to maintain the `getReserveData()` interface, since the new, internal -+ * `ReserveData` struct includes the reserve's `virtualUnderlyingBalance`. -+ */ -+ struct ReserveDataLegacy { -+ //stores the reserve configuration -+ ReserveConfigurationMap configuration; -+ //the liquidity index. Expressed in ray -+ uint128 liquidityIndex; -+ //the current supply rate. Expressed in ray -+ uint128 currentLiquidityRate; -+ //variable borrow index. Expressed in ray -+ uint128 variableBorrowIndex; -+ //the current variable borrow rate. Expressed in ray -+ uint128 currentVariableBorrowRate; -+ //the current stable borrow rate. Expressed in ray -+ uint128 currentStableBorrowRate; -+ //timestamp of last update -+ uint40 lastUpdateTimestamp; -+ //the id of the reserve. Represents the position in the list of the active reserves -+ uint16 id; -+ //aToken address -+ address aTokenAddress; -+ //stableDebtToken address -+ address stableDebtTokenAddress; -+ //variableDebtToken address -+ address variableDebtTokenAddress; -+ //address of the interest rate strategy -+ address interestRateStrategyAddress; -+ //the current treasury balance, scaled -+ uint128 accruedToTreasury; -+ //the outstanding unbacked aTokens minted through the bridging feature -+ uint128 unbacked; -+ //the outstanding debt borrowed against this asset in isolation mode -+ uint128 isolationModeTotalDebt; -+ } -+ - struct ReserveData { - //stores the reserve configuration - ReserveConfigurationMap configuration; -@@ -997,6 +1042,8 @@ library DataTypes { - uint40 lastUpdateTimestamp; - //the id of the reserve. Represents the position in the list of the active reserves - uint16 id; -+ //timestamp until when liquidations are not allowed on the reserve, if set to past liquidations will be allowed -+ uint40 liquidationGracePeriodUntil; - //aToken address - address aTokenAddress; - //stableDebtToken address -@@ -1011,6 +1058,8 @@ library DataTypes { - uint128 unbacked; - //the outstanding debt borrowed against this asset in isolation mode - uint128 isolationModeTotalDebt; -+ //the amount of underlying accounted for by the protocol -+ uint128 virtualUnderlyingBalance; - } - - struct ReserveConfigurationMap { -@@ -1024,15 +1073,17 @@ library DataTypes { - //bit 59: stable rate borrowing enabled - //bit 60: asset is paused - //bit 61: borrowing in isolation mode is enabled -- //bit 62-63: reserved -+ //bit 62: siloed borrowing enabled -+ //bit 63: flashloaning enabled - //bit 64-79: reserve factor -- //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 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-255 unused -+ //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 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 -+ //bit 253-255 unused - - uint256 data; - } -@@ -1167,6 +1218,7 @@ library DataTypes { - uint256 maxStableRateBorrowSizePercent; - uint256 reservesCount; - address addressesProvider; -+ address pool; - uint8 userEModeCategory; - bool isAuthorizedFlashBorrower; - } -@@ -1231,7 +1283,8 @@ library DataTypes { - uint256 averageStableBorrowRate; - uint256 reserveFactor; - address reserve; -- address aToken; -+ bool usingVirtualBalance; -+ uint256 virtualUnderlyingBalance; - } - - struct InitReserveParams { -@@ -1245,7 +1298,7 @@ library DataTypes { - } - } - --// downloads/MAINNET/DEFAULT_A_TOKEN_IMPL/AToken/@aave/core-v3/contracts/protocol/tokenization/base/EIP712Base.sol -+// downloads/ZKSYNC/DEFAULT_A_TOKEN_IMPL/ATokenInstance/src/core/contracts/protocol/tokenization/base/EIP712Base.sol - - /** - * @title EIP712Base -@@ -1315,7 +1368,7 @@ abstract contract EIP712Base { - function _EIP712BaseId() internal view virtual returns (string memory); - } - --// downloads/MAINNET/DEFAULT_A_TOKEN_IMPL/AToken/@aave/core-v3/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol -+// downloads/ZKSYNC/DEFAULT_A_TOKEN_IMPL/ATokenInstance/src/core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol - - /// @title Gnosis Protocol v2 Safe ERC20 Transfer Library - /// @author Gnosis Developers -@@ -1428,7 +1481,7 @@ library GPv2SafeERC20 { - } - } - --// downloads/MAINNET/DEFAULT_A_TOKEN_IMPL/AToken/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol -+// downloads/ZKSYNC/DEFAULT_A_TOKEN_IMPL/ATokenInstance/src/core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol - - interface IERC20Detailed is IERC20 { - function name() external view returns (string memory); -@@ -1438,7 +1491,7 @@ interface IERC20Detailed is IERC20 { - function decimals() external view returns (uint8); - } - --// downloads/MAINNET/DEFAULT_A_TOKEN_IMPL/AToken/@aave/core-v3/contracts/interfaces/IACLManager.sol -+// downloads/ZKSYNC/DEFAULT_A_TOKEN_IMPL/ATokenInstance/src/core/contracts/interfaces/IACLManager.sol - - /** - * @title IACLManager -@@ -1611,7 +1664,7 @@ interface IACLManager { - function isAssetListingAdmin(address admin) external view returns (bool); - } - --// downloads/MAINNET/DEFAULT_A_TOKEN_IMPL/AToken/@aave/core-v3/contracts/interfaces/IPool.sol -+// downloads/ZKSYNC/DEFAULT_A_TOKEN_IMPL/ATokenInstance/src/core/contracts/interfaces/IPool.sol - - /** - * @title IPool -@@ -1989,6 +2042,14 @@ interface IPool { - */ - 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: -@@ -2030,7 +2091,7 @@ interface IPool { - * @notice Allows smartcontracts to access the liquidity of the pool within one transaction, - * as long as the amount taken plus a fee is returned. - * @dev IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept -- * into consideration. For further details please visit https://developers.aave.com -+ * into consideration. For further details please visit https://docs.aave.com/developers/ - * @param receiverAddress The address of the contract receiving the funds, implementing IFlashLoanReceiver interface - * @param assets The addresses of the assets being flash-borrowed - * @param amounts The amounts of the assets being flash-borrowed -@@ -2057,7 +2118,7 @@ interface IPool { - * @notice Allows smartcontracts to access the liquidity of the pool within one transaction, - * as long as the amount taken plus a fee is returned. - * @dev IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept -- * into consideration. For further details please visit https://developers.aave.com -+ * into consideration. For further details please visit https://docs.aave.com/developers/ - * @param receiverAddress The address of the contract receiving the funds, implementing IFlashLoanSimpleReceiver interface - * @param asset The address of the asset being flash-borrowed - * @param amount The amount of the asset being flash-borrowed -@@ -2133,6 +2194,22 @@ interface IPool { - address rateStrategyAddress - ) external; - -+ /** -+ * @notice Accumulates interest to all indexes of the reserve -+ * @dev Only callable by the PoolConfigurator contract -+ * @dev To be used when required by the configurator, for example when updating interest rates strategy data -+ * @param asset The address of the underlying asset of the reserve -+ */ -+ function syncIndexesState(address asset) external; -+ -+ /** -+ * @notice Updates interest rates on the reserve data -+ * @dev Only callable by the PoolConfigurator contract -+ * @dev To be used when required by the configurator, for example when updating interest rates strategy data -+ * @param asset The address of the underlying asset of the reserve -+ */ -+ function syncRatesState(address asset) external; -+ - /** - * @notice Sets the configuration bitmap of the reserve as a whole - * @dev Only callable by the PoolConfigurator contract -@@ -2188,7 +2265,23 @@ interface IPool { - * @param asset The address of the underlying asset of the reserve - * @return The state and configuration data of the reserve - */ -- function getReserveData(address asset) external view returns (DataTypes.ReserveData memory); -+ function getReserveData(address asset) external view returns (DataTypes.ReserveDataLegacy memory); -+ -+ /** -+ * @notice Returns the state and configuration of the reserve, including extra data included with Aave v3.1 -+ * @param asset The address of the underlying asset of the reserve -+ * @return The state and configuration data of the reserve with virtual accounting -+ */ -+ function getReserveDataExtended( -+ address asset -+ ) external view returns (DataTypes.ReserveData memory); -+ -+ /** -+ * @notice Returns the virtual underlying balance of the reserve -+ * @param asset The address of the underlying asset of the reserve -+ * @return The reserve virtual underlying balance -+ */ -+ function getVirtualUnderlyingBalance(address asset) external view returns (uint128); - - /** - * @notice Validates and finalizes an aToken transfer -@@ -2216,6 +2309,13 @@ interface IPool { - */ - function getReservesList() external view returns (address[] memory); - -+ /** -+ * @notice Returns the number of initialized reserves -+ * @dev It includes dropped reserves -+ * @return The count -+ */ -+ function getReservesCount() external view returns (uint256); -+ - /** - * @notice Returns the address of the underlying asset of a reserve by the reserve id as stored in the DataTypes.ReserveData struct - * @param id The id of the reserve as stored in the DataTypes.ReserveData struct -@@ -2286,6 +2386,22 @@ interface IPool { - */ - function resetIsolationModeTotalDebt(address asset) external; - -+ /** -+ * @notice Sets the liquidation grace period of the given asset -+ * @dev To enable a liquidation grace period, a timestamp in the future should be set, -+ * To disable a liquidation grace period, any timestamp in the past works, like 0 -+ * @param asset The address of the underlying asset to set the liquidationGracePeriod -+ * @param until Timestamp when the liquidation grace period will end -+ **/ -+ function setLiquidationGracePeriod(address asset, uint40 until) external; -+ -+ /** -+ * @notice Returns the liquidation grace period of the given asset -+ * @param asset The address of the underlying asset -+ * @return Timestamp when the liquidation grace period will end -+ **/ -+ 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 -@@ -2343,9 +2459,44 @@ interface IPool { - * 0 if the action is executed directly by the user, without any middle-man - */ - function deposit(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external; -+ -+ /** -+ * @notice Gets the address of the external FlashLoanLogic -+ */ -+ function getFlashLoanLogic() external returns (address); -+ -+ /** -+ * @notice Gets the address of the external BorrowLogic -+ */ -+ function getBorrowLogic() external returns (address); -+ -+ /** -+ * @notice Gets the address of the external BridgeLogic -+ */ -+ function getBridgeLogic() external returns (address); -+ -+ /** -+ * @notice Gets the address of the external EModeLogic -+ */ -+ function getEModeLogic() external returns (address); -+ -+ /** -+ * @notice Gets the address of the external LiquidationLogic -+ */ -+ function getLiquidationLogic() external returns (address); -+ -+ /** -+ * @notice Gets the address of the external PoolLogic -+ */ -+ function getPoolLogic() external returns (address); -+ -+ /** -+ * @notice Gets the address of the external SupplyLogic -+ */ -+ function getSupplyLogic() external returns (address); - } - --// downloads/MAINNET/DEFAULT_A_TOKEN_IMPL/AToken/@aave/core-v3/contracts/interfaces/IInitializableAToken.sol -+// downloads/ZKSYNC/DEFAULT_A_TOKEN_IMPL/ATokenInstance/src/core/contracts/interfaces/IInitializableAToken.sol - - /** - * @title IInitializableAToken -@@ -2398,7 +2549,7 @@ interface IInitializableAToken { - ) external; - } - --// downloads/MAINNET/DEFAULT_A_TOKEN_IMPL/AToken/@aave/core-v3/contracts/interfaces/IAToken.sol -+// downloads/ZKSYNC/DEFAULT_A_TOKEN_IMPL/ATokenInstance/src/core/contracts/interfaces/IAToken.sol - - /** - * @title IAToken -@@ -2532,7 +2683,7 @@ interface IAToken is IERC20, IScaledBalanceToken, IInitializableAToken { - function rescueTokens(address token, address to, uint256 amount) external; - } - + -// downloads/MAINNET/DEFAULT_A_TOKEN_IMPL/AToken/@aave/core-v3/contracts/protocol/tokenization/base/IncentivizedERC20.sol +// downloads/ZKSYNC/DEFAULT_A_TOKEN_IMPL/ATokenInstance/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol - + /** * @title IncentivizedERC20 @@ -2587,15 +2738,15 @@ abstract contract IncentivizedERC20 is Context, IERC20Detailed { @@ -464,32 +31,14 @@ index 36ee10c..459d34e 100644 + _decimals = decimals_; POOL = pool; } - + @@ -2756,7 +2907,7 @@ abstract contract IncentivizedERC20 is Context, IERC20Detailed { } } - --// downloads/MAINNET/DEFAULT_A_TOKEN_IMPL/AToken/@aave/core-v3/contracts/protocol/tokenization/base/MintableIncentivizedERC20.sol -+// downloads/ZKSYNC/DEFAULT_A_TOKEN_IMPL/ATokenInstance/src/core/contracts/protocol/tokenization/base/MintableIncentivizedERC20.sol - - /** - * @title MintableIncentivizedERC20 -@@ -2818,7 +2969,7 @@ abstract contract MintableIncentivizedERC20 is IncentivizedERC20 { - } - } - --// downloads/MAINNET/DEFAULT_A_TOKEN_IMPL/AToken/@aave/core-v3/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol -+// downloads/ZKSYNC/DEFAULT_A_TOKEN_IMPL/ATokenInstance/src/core/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol - - /** - * @title ScaledBalanceTokenBase -@@ -2967,14 +3118,14 @@ abstract contract ScaledBalanceTokenBase is MintableIncentivizedERC20, IScaledBa - } - } - + -// downloads/MAINNET/DEFAULT_A_TOKEN_IMPL/AToken/@aave/core-v3/contracts/protocol/tokenization/AToken.sol +// downloads/ZKSYNC/DEFAULT_A_TOKEN_IMPL/ATokenInstance/src/core/contracts/protocol/tokenization/AToken.sol - + /** * @title Aave ERC20 AToken * @author Aave @@ -503,12 +52,12 @@ index 36ee10c..459d34e 100644 @@ -2982,16 +3133,9 @@ contract AToken is VersionedInitializable, ScaledBalanceTokenBase, EIP712Base, I bytes32 public constant PERMIT_TYPEHASH = keccak256('Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)'); - + - uint256 public constant ATOKEN_REVISION = 0x1; - address internal _treasury; address internal _underlyingAsset; - + - /// @inheritdoc VersionedInitializable - function getRevision() internal pure virtual override returns (uint256) { - return ATOKEN_REVISION; @@ -545,7 +94,7 @@ index 36ee10c..459d34e 100644 - ); - } + ) public virtual; - + /// @inheritdoc IAToken function mint( @@ -3208,3 +3330,50 @@ contract AToken is VersionedInitializable, ScaledBalanceTokenBase, EIP712Base, I diff --git a/diffs/MAINNET_ZKSYNC/DEFAULT_INCENTIVES_CONTROLLER_IMPL_DIFF.md b/diffs/MAINNET_ZKSYNC/DEFAULT_INCENTIVES_CONTROLLER_IMPL_DIFF.md index 73676360..2dd78b39 100644 --- a/diffs/MAINNET_ZKSYNC/DEFAULT_INCENTIVES_CONTROLLER_IMPL_DIFF.md +++ b/diffs/MAINNET_ZKSYNC/DEFAULT_INCENTIVES_CONTROLLER_IMPL_DIFF.md @@ -3,545 +3,10 @@ diff --git a/./downloads/MAINNET/DEFAULT_INCENTIVES_CONTROLLER_IMPL.sol b/./down index e94b837..455ec9b 100644 --- a/./downloads/MAINNET/DEFAULT_INCENTIVES_CONTROLLER_IMPL.sol +++ b/./downloads/ZKSYNC/DEFAULT_INCENTIVES_CONTROLLER_IMPL.sol -@@ -1,7 +1,241 @@ - // SPDX-License-Identifier: BUSL-1.1 --pragma solidity =0.8.10 ^0.8.0 ^0.8.10; -+pragma solidity ^0.8.0 ^0.8.10; - --// downloads/MAINNET/DEFAULT_INCENTIVES_CONTROLLER_IMPL/RewardsController/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/IERC20.sol -+// downloads/ZKSYNC/DEFAULT_INCENTIVES_CONTROLLER_IMPL/RewardsController/src/periphery/contracts/misc/interfaces/IEACAggregatorProxy.sol -+ -+interface IEACAggregatorProxy { -+ function decimals() external view returns (uint8); -+ -+ function latestAnswer() external view returns (int256); -+ -+ function latestTimestamp() external view returns (uint256); -+ -+ function latestRound() external view returns (uint256); -+ -+ function getAnswer(uint256 roundId) external view returns (int256); -+ -+ function getTimestamp(uint256 roundId) external view returns (uint256); -+ -+ event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 timestamp); -+ event NewRound(uint256 indexed roundId, address indexed startedBy); -+} -+ -+// downloads/ZKSYNC/DEFAULT_INCENTIVES_CONTROLLER_IMPL/RewardsController/src/periphery/contracts/rewards/interfaces/IRewardsDistributor.sol -+ -+/** -+ * @title IRewardsDistributor -+ * @author Aave -+ * @notice Defines the basic interface for a Rewards Distributor. -+ */ -+interface IRewardsDistributor { -+ /** -+ * @dev Emitted when the configuration of the rewards of an asset is updated. -+ * @param asset The address of the incentivized asset -+ * @param reward The address of the reward token -+ * @param oldEmission The old emissions per second value of the reward distribution -+ * @param newEmission The new emissions per second value of the reward distribution -+ * @param oldDistributionEnd The old end timestamp of the reward distribution -+ * @param newDistributionEnd The new end timestamp of the reward distribution -+ * @param assetIndex The index of the asset distribution -+ */ -+ event AssetConfigUpdated( -+ address indexed asset, -+ address indexed reward, -+ uint256 oldEmission, -+ uint256 newEmission, -+ uint256 oldDistributionEnd, -+ uint256 newDistributionEnd, -+ uint256 assetIndex -+ ); -+ -+ /** -+ * @dev Emitted when rewards of an asset are accrued on behalf of a user. -+ * @param asset The address of the incentivized asset -+ * @param reward The address of the reward token -+ * @param user The address of the user that rewards are accrued on behalf of -+ * @param assetIndex The index of the asset distribution -+ * @param userIndex The index of the asset distribution on behalf of the user -+ * @param rewardsAccrued The amount of rewards accrued -+ */ -+ event Accrued( -+ address indexed asset, -+ address indexed reward, -+ address indexed user, -+ uint256 assetIndex, -+ uint256 userIndex, -+ uint256 rewardsAccrued -+ ); -+ -+ /** -+ * @dev Sets the end date for the distribution -+ * @param asset The asset to incentivize -+ * @param reward The reward token that incentives the asset -+ * @param newDistributionEnd The end date of the incentivization, in unix time format -+ **/ -+ function setDistributionEnd(address asset, address reward, uint32 newDistributionEnd) external; -+ -+ /** -+ * @dev Sets the emission per second of a set of reward distributions -+ * @param asset The asset is being incentivized -+ * @param rewards List of reward addresses are being distributed -+ * @param newEmissionsPerSecond List of new reward emissions per second -+ */ -+ function setEmissionPerSecond( -+ address asset, -+ address[] calldata rewards, -+ uint88[] calldata newEmissionsPerSecond -+ ) external; -+ -+ /** -+ * @dev Gets the end date for the distribution -+ * @param asset The incentivized asset -+ * @param reward The reward token of the incentivized asset -+ * @return The timestamp with the end of the distribution, in unix time format -+ **/ -+ function getDistributionEnd(address asset, address reward) external view returns (uint256); -+ -+ /** -+ * @dev Returns the index of a user on a reward distribution -+ * @param user Address of the user -+ * @param asset The incentivized asset -+ * @param reward The reward token of the incentivized asset -+ * @return The current user asset index, not including new distributions -+ **/ -+ function getUserAssetIndex( -+ address user, -+ address asset, -+ address reward -+ ) external view returns (uint256); -+ -+ /** -+ * @dev Returns the configuration of the distribution reward for a certain asset -+ * @param asset The incentivized asset -+ * @param reward The reward token of the incentivized asset -+ * @return The index of the asset distribution -+ * @return The emission per second of the reward distribution -+ * @return The timestamp of the last update of the index -+ * @return The timestamp of the distribution end -+ **/ -+ function getRewardsData( -+ address asset, -+ address reward -+ ) external view returns (uint256, uint256, uint256, uint256); -+ -+ /** -+ * @dev Calculates the next value of an specific distribution index, with validations. -+ * @param asset The incentivized asset -+ * @param reward The reward token of the incentivized asset -+ * @return The old index of the asset distribution -+ * @return The new index of the asset distribution -+ **/ -+ function getAssetIndex(address asset, address reward) external view returns (uint256, uint256); -+ -+ /** -+ * @dev Returns the list of available reward token addresses of an incentivized asset -+ * @param asset The incentivized asset -+ * @return List of rewards addresses of the input asset -+ **/ -+ function getRewardsByAsset(address asset) external view returns (address[] memory); -+ -+ /** -+ * @dev Returns the list of available reward addresses -+ * @return List of rewards supported in this contract -+ **/ -+ function getRewardsList() external view returns (address[] memory); -+ -+ /** -+ * @dev Returns the accrued rewards balance of a user, not including virtually accrued rewards since last distribution. -+ * @param user The address of the user -+ * @param reward The address of the reward token -+ * @return Unclaimed rewards, not including new distributions -+ **/ -+ function getUserAccruedRewards(address user, address reward) external view returns (uint256); -+ -+ /** -+ * @dev Returns a single rewards balance of a user, including virtually accrued and unrealized claimable rewards. -+ * @param assets List of incentivized assets to check eligible distributions -+ * @param user The address of the user -+ * @param reward The address of the reward token -+ * @return The rewards amount -+ **/ -+ function getUserRewards( -+ address[] calldata assets, -+ address user, -+ address reward -+ ) external view returns (uint256); -+ -+ /** -+ * @dev Returns a list all rewards of a user, including already accrued and unrealized claimable rewards -+ * @param assets List of incentivized assets to check eligible distributions -+ * @param user The address of the user -+ * @return The list of reward addresses -+ * @return The list of unclaimed amount of rewards -+ **/ -+ function getAllUserRewards( -+ address[] calldata assets, -+ address user -+ ) external view returns (address[] memory, uint256[] memory); -+ -+ /** -+ * @dev Returns the decimals of an asset to calculate the distribution delta -+ * @param asset The address to retrieve decimals -+ * @return The decimals of an underlying asset -+ */ -+ function getAssetDecimals(address asset) external view returns (uint8); -+ -+ /** -+ * @dev Returns the address of the emission manager -+ * @return The address of the EmissionManager -+ */ -+ function EMISSION_MANAGER() external view returns (address); -+ -+ /** -+ * @dev Returns the address of the emission manager. -+ * Deprecated: This getter is maintained for compatibility purposes. Use the `EMISSION_MANAGER()` function instead. -+ * @return The address of the EmissionManager -+ */ -+ function getEmissionManager() external view returns (address); -+} -+ -+// downloads/ZKSYNC/DEFAULT_INCENTIVES_CONTROLLER_IMPL/RewardsController/src/periphery/contracts/rewards/interfaces/ITransferStrategyBase.sol -+ -+interface ITransferStrategyBase { -+ event EmergencyWithdrawal( -+ address indexed caller, -+ address indexed token, -+ address indexed to, -+ uint256 amount -+ ); -+ -+ /** -+ * @dev Perform custom transfer logic via delegate call from source contract to a TransferStrategy implementation -+ * @param to Account to transfer rewards -+ * @param reward Address of the reward token -+ * @param amount Amount to transfer to the "to" address parameter -+ * @return Returns true bool if transfer logic succeeds -+ */ -+ function performTransfer(address to, address reward, uint256 amount) external returns (bool); -+ -+ /** -+ * @return Returns the address of the Incentives Controller -+ */ -+ function getIncentivesController() external view returns (address); -+ -+ /** -+ * @return Returns the address of the Rewards admin -+ */ -+ function getRewardsAdmin() external view returns (address); -+ -+ /** -+ * @dev Perform an emergency token withdrawal only callable by the Rewards admin -+ * @param token Address of the token to withdraw funds from this contract -+ * @param to Address of the recipient of the withdrawal -+ * @param amount Amount of the withdrawal -+ */ -+ function emergencyWithdrawal(address token, address to, uint256 amount) external; -+} -+ -+// src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol - - /** - * @dev Interface of the ERC20 standard as defined in the EIP. -@@ -77,7 +311,7 @@ interface IERC20 { - event Approval(address indexed owner, address indexed spender, uint256 value); - } - --// downloads/MAINNET/DEFAULT_INCENTIVES_CONTROLLER_IMPL/RewardsController/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/SafeCast.sol -+// src/core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol - - // OpenZeppelin Contracts v4.4.1 (utils/math/SafeCast.sol) - -@@ -333,7 +567,7 @@ library SafeCast { - } - } - --// downloads/MAINNET/DEFAULT_INCENTIVES_CONTROLLER_IMPL/RewardsController/@aave/core-v3/contracts/interfaces/IScaledBalanceToken.sol -+// src/core/contracts/interfaces/IScaledBalanceToken.sol - - /** - * @title IScaledBalanceToken -@@ -405,7 +639,7 @@ interface IScaledBalanceToken { - function getPreviousIndex(address user) external view returns (uint256); - } - --// downloads/MAINNET/DEFAULT_INCENTIVES_CONTROLLER_IMPL/RewardsController/@aave/core-v3/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol -+// src/core/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol - - /** - * @title VersionedInitializable -@@ -482,241 +716,7 @@ abstract contract VersionedInitializable { - uint256[50] private ______gap; - } - --// downloads/MAINNET/DEFAULT_INCENTIVES_CONTROLLER_IMPL/RewardsController/@aave/periphery-v3/contracts/misc/interfaces/IEACAggregatorProxy.sol -- --interface IEACAggregatorProxy { -- function decimals() external view returns (uint8); -- -- function latestAnswer() external view returns (int256); -- -- function latestTimestamp() external view returns (uint256); -- -- function latestRound() external view returns (uint256); -- -- function getAnswer(uint256 roundId) external view returns (int256); -- -- function getTimestamp(uint256 roundId) external view returns (uint256); -- -- event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 timestamp); -- event NewRound(uint256 indexed roundId, address indexed startedBy); --} -- --// downloads/MAINNET/DEFAULT_INCENTIVES_CONTROLLER_IMPL/RewardsController/@aave/periphery-v3/contracts/rewards/interfaces/IRewardsDistributor.sol -- --/** -- * @title IRewardsDistributor -- * @author Aave -- * @notice Defines the basic interface for a Rewards Distributor. -- */ --interface IRewardsDistributor { -- /** -- * @dev Emitted when the configuration of the rewards of an asset is updated. -- * @param asset The address of the incentivized asset -- * @param reward The address of the reward token -- * @param oldEmission The old emissions per second value of the reward distribution -- * @param newEmission The new emissions per second value of the reward distribution -- * @param oldDistributionEnd The old end timestamp of the reward distribution -- * @param newDistributionEnd The new end timestamp of the reward distribution -- * @param assetIndex The index of the asset distribution -- */ -- event AssetConfigUpdated( -- address indexed asset, -- address indexed reward, -- uint256 oldEmission, -- uint256 newEmission, -- uint256 oldDistributionEnd, -- uint256 newDistributionEnd, -- uint256 assetIndex -- ); -- -- /** -- * @dev Emitted when rewards of an asset are accrued on behalf of a user. -- * @param asset The address of the incentivized asset -- * @param reward The address of the reward token -- * @param user The address of the user that rewards are accrued on behalf of -- * @param assetIndex The index of the asset distribution -- * @param userIndex The index of the asset distribution on behalf of the user -- * @param rewardsAccrued The amount of rewards accrued -- */ -- event Accrued( -- address indexed asset, -- address indexed reward, -- address indexed user, -- uint256 assetIndex, -- uint256 userIndex, -- uint256 rewardsAccrued -- ); -- -- /** -- * @dev Sets the end date for the distribution -- * @param asset The asset to incentivize -- * @param reward The reward token that incentives the asset -- * @param newDistributionEnd The end date of the incentivization, in unix time format -- **/ -- function setDistributionEnd(address asset, address reward, uint32 newDistributionEnd) external; -- -- /** -- * @dev Sets the emission per second of a set of reward distributions -- * @param asset The asset is being incentivized -- * @param rewards List of reward addresses are being distributed -- * @param newEmissionsPerSecond List of new reward emissions per second -- */ -- function setEmissionPerSecond( -- address asset, -- address[] calldata rewards, -- uint88[] calldata newEmissionsPerSecond -- ) external; -- -- /** -- * @dev Gets the end date for the distribution -- * @param asset The incentivized asset -- * @param reward The reward token of the incentivized asset -- * @return The timestamp with the end of the distribution, in unix time format -- **/ -- function getDistributionEnd(address asset, address reward) external view returns (uint256); -- -- /** -- * @dev Returns the index of a user on a reward distribution -- * @param user Address of the user -- * @param asset The incentivized asset -- * @param reward The reward token of the incentivized asset -- * @return The current user asset index, not including new distributions -- **/ -- function getUserAssetIndex( -- address user, -- address asset, -- address reward -- ) external view returns (uint256); -- -- /** -- * @dev Returns the configuration of the distribution reward for a certain asset -- * @param asset The incentivized asset -- * @param reward The reward token of the incentivized asset -- * @return The index of the asset distribution -- * @return The emission per second of the reward distribution -- * @return The timestamp of the last update of the index -- * @return The timestamp of the distribution end -- **/ -- function getRewardsData( -- address asset, -- address reward -- ) external view returns (uint256, uint256, uint256, uint256); -- -- /** -- * @dev Calculates the next value of an specific distribution index, with validations. -- * @param asset The incentivized asset -- * @param reward The reward token of the incentivized asset -- * @return The old index of the asset distribution -- * @return The new index of the asset distribution -- **/ -- function getAssetIndex(address asset, address reward) external view returns (uint256, uint256); -- -- /** -- * @dev Returns the list of available reward token addresses of an incentivized asset -- * @param asset The incentivized asset -- * @return List of rewards addresses of the input asset -- **/ -- function getRewardsByAsset(address asset) external view returns (address[] memory); -- -- /** -- * @dev Returns the list of available reward addresses -- * @return List of rewards supported in this contract -- **/ -- function getRewardsList() external view returns (address[] memory); -- -- /** -- * @dev Returns the accrued rewards balance of a user, not including virtually accrued rewards since last distribution. -- * @param user The address of the user -- * @param reward The address of the reward token -- * @return Unclaimed rewards, not including new distributions -- **/ -- function getUserAccruedRewards(address user, address reward) external view returns (uint256); -- -- /** -- * @dev Returns a single rewards balance of a user, including virtually accrued and unrealized claimable rewards. -- * @param assets List of incentivized assets to check eligible distributions -- * @param user The address of the user -- * @param reward The address of the reward token -- * @return The rewards amount -- **/ -- function getUserRewards( -- address[] calldata assets, -- address user, -- address reward -- ) external view returns (uint256); -- -- /** -- * @dev Returns a list all rewards of a user, including already accrued and unrealized claimable rewards -- * @param assets List of incentivized assets to check eligible distributions -- * @param user The address of the user -- * @return The list of reward addresses -- * @return The list of unclaimed amount of rewards -- **/ -- function getAllUserRewards( -- address[] calldata assets, -- address user -- ) external view returns (address[] memory, uint256[] memory); -- -- /** -- * @dev Returns the decimals of an asset to calculate the distribution delta -- * @param asset The address to retrieve decimals -- * @return The decimals of an underlying asset -- */ -- function getAssetDecimals(address asset) external view returns (uint8); -- -- /** -- * @dev Returns the address of the emission manager -- * @return The address of the EmissionManager -- */ -- function EMISSION_MANAGER() external view returns (address); -- -- /** -- * @dev Returns the address of the emission manager. -- * Deprecated: This getter is maintained for compatibility purposes. Use the `EMISSION_MANAGER()` function instead. -- * @return The address of the EmissionManager -- */ -- function getEmissionManager() external view returns (address); --} -- --// downloads/MAINNET/DEFAULT_INCENTIVES_CONTROLLER_IMPL/RewardsController/@aave/periphery-v3/contracts/rewards/interfaces/ITransferStrategyBase.sol -- --interface ITransferStrategyBase { -- event EmergencyWithdrawal( -- address indexed caller, -- address indexed token, -- address indexed to, -- uint256 amount -- ); -- -- /** -- * @dev Perform custom transfer logic via delegate call from source contract to a TransferStrategy implementation -- * @param to Account to transfer rewards -- * @param reward Address of the reward token -- * @param amount Amount to transfer to the "to" address parameter -- * @return Returns true bool if transfer logic succeeds -- */ -- function performTransfer(address to, address reward, uint256 amount) external returns (bool); -- -- /** -- * @return Returns the address of the Incentives Controller -- */ -- function getIncentivesController() external view returns (address); -- -- /** -- * @return Returns the address of the Rewards admin -- */ -- function getRewardsAdmin() external view returns (address); -- -- /** -- * @dev Perform an emergency token withdrawal only callable by the Rewards admin -- * @param token Address of the token to withdraw funds from this contract -- * @param to Address of the recipient of the withdrawal -- * @param amount Amount of the withdrawal -- */ -- function emergencyWithdrawal(address token, address to, uint256 amount) external; --} -- --// downloads/MAINNET/DEFAULT_INCENTIVES_CONTROLLER_IMPL/RewardsController/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol -+// src/core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol - - interface IERC20Detailed is IERC20 { - function name() external view returns (string memory); -@@ -726,7 +726,7 @@ interface IERC20Detailed is IERC20 { - function decimals() external view returns (uint8); - } - --// downloads/MAINNET/DEFAULT_INCENTIVES_CONTROLLER_IMPL/RewardsController/@aave/periphery-v3/contracts/rewards/libraries/RewardsDataTypes.sol -+// downloads/ZKSYNC/DEFAULT_INCENTIVES_CONTROLLER_IMPL/RewardsController/src/periphery/contracts/rewards/libraries/RewardsDataTypes.sol - - library RewardsDataTypes { - struct RewardsConfigInput { -@@ -777,7 +777,7 @@ library RewardsDataTypes { - } - } - --// downloads/MAINNET/DEFAULT_INCENTIVES_CONTROLLER_IMPL/RewardsController/@aave/periphery-v3/contracts/rewards/interfaces/IRewardsController.sol -+// downloads/ZKSYNC/DEFAULT_INCENTIVES_CONTROLLER_IMPL/RewardsController/src/periphery/contracts/rewards/interfaces/IRewardsController.sol - - /** - * @title IRewardsController -@@ -975,7 +975,7 @@ interface IRewardsController is IRewardsDistributor { - ) external returns (address[] memory rewardsList, uint256[] memory claimedAmounts); - } - + -// downloads/MAINNET/DEFAULT_INCENTIVES_CONTROLLER_IMPL/RewardsController/@aave/periphery-v3/contracts/rewards/RewardsDistributor.sol +// downloads/ZKSYNC/DEFAULT_INCENTIVES_CONTROLLER_IMPL/RewardsController/src/periphery/contracts/rewards/RewardsDistributor.sol - + /** * @title RewardsDistributor @@ -1015,7 +1015,7 @@ abstract contract RewardsDistributor is IRewardsDistributor { @@ -561,14 +26,9 @@ index e94b837..455ec9b 100644 + ) external view override returns (uint256) { return _assets[asset].rewards[reward].usersData[user].index; } - + @@ -1506,7 +1506,7 @@ abstract contract RewardsDistributor is IRewardsDistributor { } } - --// downloads/MAINNET/DEFAULT_INCENTIVES_CONTROLLER_IMPL/RewardsController/@aave/periphery-v3/contracts/rewards/RewardsController.sol -+// downloads/ZKSYNC/DEFAULT_INCENTIVES_CONTROLLER_IMPL/RewardsController/src/periphery/contracts/rewards/RewardsController.sol - - /** - * @title RewardsController + ``` diff --git a/diffs/MAINNET_ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL_DIFF.md b/diffs/MAINNET_ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL_DIFF.md index 7c6b43de..f7d6c22e 100644 --- a/diffs/MAINNET_ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL_DIFF.md +++ b/diffs/MAINNET_ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL_DIFF.md @@ -3,540 +3,10 @@ diff --git a/./downloads/MAINNET/DEFAULT_STABLE_DEBT_TOKEN_IMPL.sol b/./download index 87f3628..35e192c 100644 --- a/./downloads/MAINNET/DEFAULT_STABLE_DEBT_TOKEN_IMPL.sol +++ b/./downloads/ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL.sol -@@ -1,7 +1,7 @@ --// SPDX-License-Identifier: BUSL-1.1 --pragma solidity =0.8.10 ^0.8.0; -+// SPDX-License-Identifier: MIT -+pragma solidity ^0.8.0 ^0.8.10; - --// downloads/MAINNET/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtToken/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/Context.sol -+// downloads/ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtTokenInstance/src/core/contracts/dependencies/openzeppelin/contracts/Context.sol - - /* - * @dev Provides information about the current execution context, including the -@@ -24,7 +24,7 @@ abstract contract Context { - } - } - --// downloads/MAINNET/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtToken/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/IERC20.sol -+// downloads/ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtTokenInstance/src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol - - /** - * @dev Interface of the ERC20 standard as defined in the EIP. -@@ -100,7 +100,7 @@ interface IERC20 { - event Approval(address indexed owner, address indexed spender, uint256 value); - } - --// downloads/MAINNET/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtToken/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/SafeCast.sol -+// downloads/ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtTokenInstance/src/core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol - - // OpenZeppelin Contracts v4.4.1 (utils/math/SafeCast.sol) - -@@ -356,7 +356,7 @@ library SafeCast { - } - } - --// downloads/MAINNET/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtToken/@aave/core-v3/contracts/interfaces/IAaveIncentivesController.sol -+// downloads/ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtTokenInstance/src/core/contracts/interfaces/IAaveIncentivesController.sol - - /** - * @title IAaveIncentivesController -@@ -375,7 +375,7 @@ interface IAaveIncentivesController { - function handleAction(address user, uint256 totalSupply, uint256 userBalance) external; - } - --// downloads/MAINNET/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtToken/@aave/core-v3/contracts/interfaces/ICreditDelegationToken.sol -+// downloads/ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtTokenInstance/src/core/contracts/interfaces/ICreditDelegationToken.sol - - /** - * @title ICreditDelegationToken -@@ -435,7 +435,7 @@ interface ICreditDelegationToken { - ) external; - } - --// downloads/MAINNET/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtToken/@aave/core-v3/contracts/interfaces/IPoolAddressesProvider.sol -+// downloads/ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtTokenInstance/src/core/contracts/interfaces/IPoolAddressesProvider.sol - - /** - * @title IPoolAddressesProvider -@@ -662,7 +662,7 @@ interface IPoolAddressesProvider { - function setPoolDataProvider(address newDataProvider) external; - } - --// downloads/MAINNET/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtToken/@aave/core-v3/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol -+// downloads/ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtTokenInstance/src/core/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol - - /** - * @title VersionedInitializable -@@ -739,7 +739,7 @@ abstract contract VersionedInitializable { - uint256[50] private ______gap; - } - --// downloads/MAINNET/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtToken/@aave/core-v3/contracts/protocol/libraries/helpers/Errors.sol -+// downloads/ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtTokenInstance/src/core/contracts/protocol/libraries/helpers/Errors.sol - - /** - * @title Errors library -@@ -807,7 +807,7 @@ library Errors { - string public constant PRICE_ORACLE_SENTINEL_CHECK_FAILED = '59'; // 'Price oracle sentinel validation failed' - string public constant ASSET_NOT_BORROWABLE_IN_ISOLATION = '60'; // 'Asset is not borrowable in isolation mode' - string public constant RESERVE_ALREADY_INITIALIZED = '61'; // 'Reserve has already been initialized' -- string public constant USER_IN_ISOLATION_MODE = '62'; // 'User is in isolation mode' -+ string public constant USER_IN_ISOLATION_MODE_OR_LTV_ZERO = '62'; // 'User is in isolation mode or ltv is zero' - string public constant INVALID_LTV = '63'; // 'Invalid ltv parameter for the reserve' - string public constant INVALID_LIQ_THRESHOLD = '64'; // 'Invalid liquidity threshold parameter for the reserve' - string public constant INVALID_LIQ_BONUS = '65'; // 'Invalid liquidity bonus parameter for the reserve' -@@ -837,9 +837,17 @@ library Errors { - 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 -+ string public constant INVALID_MAX_RATE = '92'; // The expect maximum borrow rate is invalid -+ string public constant WITHDRAW_TO_ATOKEN = '93'; // Withdrawing to the aToken is not allowed -+ string public constant SUPPLY_TO_ATOKEN = '94'; // Supplying to the aToken is not allowed -+ string public constant SLOPE_2_MUST_BE_GTE_SLOPE_1 = '95'; // Variable interest rate slope 2 can not be lower than slope 1 -+ string public constant CALLER_NOT_RISK_OR_POOL_OR_EMERGENCY_ADMIN = '96'; // 'The caller of the function is not a risk, pool or emergency admin' -+ 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 - } - --// downloads/MAINNET/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtToken/@aave/core-v3/contracts/protocol/libraries/math/WadRayMath.sol -+// downloads/ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtTokenInstance/src/core/contracts/protocol/libraries/math/WadRayMath.sol - - /** - * @title WadRayMath library -@@ -965,9 +973,46 @@ library WadRayMath { - } - } - --// downloads/MAINNET/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtToken/@aave/core-v3/contracts/protocol/libraries/types/DataTypes.sol -+// downloads/ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtTokenInstance/src/core/contracts/protocol/libraries/types/DataTypes.sol - - library DataTypes { -+ /** -+ * This exists specifically to maintain the `getReserveData()` interface, since the new, internal -+ * `ReserveData` struct includes the reserve's `virtualUnderlyingBalance`. -+ */ -+ struct ReserveDataLegacy { -+ //stores the reserve configuration -+ ReserveConfigurationMap configuration; -+ //the liquidity index. Expressed in ray -+ uint128 liquidityIndex; -+ //the current supply rate. Expressed in ray -+ uint128 currentLiquidityRate; -+ //variable borrow index. Expressed in ray -+ uint128 variableBorrowIndex; -+ //the current variable borrow rate. Expressed in ray -+ uint128 currentVariableBorrowRate; -+ //the current stable borrow rate. Expressed in ray -+ uint128 currentStableBorrowRate; -+ //timestamp of last update -+ uint40 lastUpdateTimestamp; -+ //the id of the reserve. Represents the position in the list of the active reserves -+ uint16 id; -+ //aToken address -+ address aTokenAddress; -+ //stableDebtToken address -+ address stableDebtTokenAddress; -+ //variableDebtToken address -+ address variableDebtTokenAddress; -+ //address of the interest rate strategy -+ address interestRateStrategyAddress; -+ //the current treasury balance, scaled -+ uint128 accruedToTreasury; -+ //the outstanding unbacked aTokens minted through the bridging feature -+ uint128 unbacked; -+ //the outstanding debt borrowed against this asset in isolation mode -+ uint128 isolationModeTotalDebt; -+ } -+ - struct ReserveData { - //stores the reserve configuration - ReserveConfigurationMap configuration; -@@ -985,6 +1030,8 @@ library DataTypes { - uint40 lastUpdateTimestamp; - //the id of the reserve. Represents the position in the list of the active reserves - uint16 id; -+ //timestamp until when liquidations are not allowed on the reserve, if set to past liquidations will be allowed -+ uint40 liquidationGracePeriodUntil; - //aToken address - address aTokenAddress; - //stableDebtToken address -@@ -999,6 +1046,8 @@ library DataTypes { - uint128 unbacked; - //the outstanding debt borrowed against this asset in isolation mode - uint128 isolationModeTotalDebt; -+ //the amount of underlying accounted for by the protocol -+ uint128 virtualUnderlyingBalance; - } - - struct ReserveConfigurationMap { -@@ -1012,15 +1061,17 @@ library DataTypes { - //bit 59: stable rate borrowing enabled - //bit 60: asset is paused - //bit 61: borrowing in isolation mode is enabled -- //bit 62-63: reserved -+ //bit 62: siloed borrowing enabled -+ //bit 63: flashloaning enabled - //bit 64-79: reserve factor -- //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 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-255 unused -+ //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 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 -+ //bit 253-255 unused - - uint256 data; - } -@@ -1155,6 +1206,7 @@ library DataTypes { - uint256 maxStableRateBorrowSizePercent; - uint256 reservesCount; - address addressesProvider; -+ address pool; - uint8 userEModeCategory; - bool isAuthorizedFlashBorrower; - } -@@ -1219,7 +1271,8 @@ library DataTypes { - uint256 averageStableBorrowRate; - uint256 reserveFactor; - address reserve; -- address aToken; -+ bool usingVirtualBalance; -+ uint256 virtualUnderlyingBalance; - } - - struct InitReserveParams { -@@ -1233,7 +1286,7 @@ library DataTypes { - } - } - --// downloads/MAINNET/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtToken/@aave/core-v3/contracts/protocol/tokenization/base/EIP712Base.sol -+// downloads/ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtTokenInstance/src/core/contracts/protocol/tokenization/base/EIP712Base.sol - - /** - * @title EIP712Base -@@ -1303,7 +1356,7 @@ abstract contract EIP712Base { - function _EIP712BaseId() internal view virtual returns (string memory); - } - --// downloads/MAINNET/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtToken/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol -+// downloads/ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtTokenInstance/src/core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol - - interface IERC20Detailed is IERC20 { - function name() external view returns (string memory); -@@ -1313,7 +1366,7 @@ interface IERC20Detailed is IERC20 { - function decimals() external view returns (uint8); - } - --// downloads/MAINNET/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtToken/@aave/core-v3/contracts/interfaces/IACLManager.sol -+// downloads/ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtTokenInstance/src/core/contracts/interfaces/IACLManager.sol - - /** - * @title IACLManager -@@ -1486,104 +1539,7 @@ interface IACLManager { - function isAssetListingAdmin(address admin) external view returns (bool); - } - --// downloads/MAINNET/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtToken/@aave/core-v3/contracts/protocol/libraries/math/MathUtils.sol -- --/** -- * @title MathUtils library -- * @author Aave -- * @notice Provides functions to perform linear and compounded interest calculations -- */ --library MathUtils { -- using WadRayMath for uint256; -- -- /// @dev Ignoring leap years -- uint256 internal constant SECONDS_PER_YEAR = 365 days; -- -- /** -- * @dev Function to calculate the interest accumulated using a linear interest rate formula -- * @param rate The interest rate, in ray -- * @param lastUpdateTimestamp The timestamp of the last update of the interest -- * @return The interest rate linearly accumulated during the timeDelta, in ray -- */ -- function calculateLinearInterest( -- uint256 rate, -- uint40 lastUpdateTimestamp -- ) internal view returns (uint256) { -- //solium-disable-next-line -- uint256 result = rate * (block.timestamp - uint256(lastUpdateTimestamp)); -- unchecked { -- result = result / SECONDS_PER_YEAR; -- } -- -- return WadRayMath.RAY + result; -- } -- -- /** -- * @dev Function to calculate the interest using a compounded interest rate formula -- * To avoid expensive exponentiation, the calculation is performed using a binomial approximation: -- * -- * (1+x)^n = 1+n*x+[n/2*(n-1)]*x^2+[n/6*(n-1)*(n-2)*x^3... -- * -- * The approximation slightly underpays liquidity providers and undercharges borrowers, with the advantage of great -- * gas cost reductions. The whitepaper contains reference to the approximation and a table showing the margin of -- * error per different time periods -- * -- * @param rate The interest rate, in ray -- * @param lastUpdateTimestamp The timestamp of the last update of the interest -- * @return The interest rate compounded during the timeDelta, in ray -- */ -- function calculateCompoundedInterest( -- uint256 rate, -- uint40 lastUpdateTimestamp, -- uint256 currentTimestamp -- ) internal pure returns (uint256) { -- //solium-disable-next-line -- uint256 exp = currentTimestamp - uint256(lastUpdateTimestamp); -- -- if (exp == 0) { -- return WadRayMath.RAY; -- } -- -- uint256 expMinusOne; -- uint256 expMinusTwo; -- uint256 basePowerTwo; -- uint256 basePowerThree; -- unchecked { -- expMinusOne = exp - 1; -- -- expMinusTwo = exp > 2 ? exp - 2 : 0; -- -- basePowerTwo = rate.rayMul(rate) / (SECONDS_PER_YEAR * SECONDS_PER_YEAR); -- basePowerThree = basePowerTwo.rayMul(rate) / SECONDS_PER_YEAR; -- } -- -- uint256 secondTerm = exp * expMinusOne * basePowerTwo; -- unchecked { -- secondTerm /= 2; -- } -- uint256 thirdTerm = exp * expMinusOne * expMinusTwo * basePowerThree; -- unchecked { -- thirdTerm /= 6; -- } -- -- return WadRayMath.RAY + (rate * exp) / SECONDS_PER_YEAR + secondTerm + thirdTerm; -- } -- -- /** -- * @dev Calculates the compounded interest between the timestamp of the last update and the current block timestamp -- * @param rate The interest rate (in ray) -- * @param lastUpdateTimestamp The timestamp from which the interest accumulation needs to be calculated -- * @return The interest rate compounded between lastUpdateTimestamp and current block timestamp, in ray -- */ -- function calculateCompoundedInterest( -- uint256 rate, -- uint40 lastUpdateTimestamp -- ) internal view returns (uint256) { -- return calculateCompoundedInterest(rate, lastUpdateTimestamp, block.timestamp); -- } --} -- --// downloads/MAINNET/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtToken/@aave/core-v3/contracts/interfaces/IPool.sol -+// downloads/ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtTokenInstance/src/core/contracts/interfaces/IPool.sol - - /** - * @title IPool -@@ -1961,6 +1917,14 @@ interface IPool { - */ - 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: -@@ -2002,7 +1966,7 @@ interface IPool { - * @notice Allows smartcontracts to access the liquidity of the pool within one transaction, - * as long as the amount taken plus a fee is returned. - * @dev IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept -- * into consideration. For further details please visit https://developers.aave.com -+ * into consideration. For further details please visit https://docs.aave.com/developers/ - * @param receiverAddress The address of the contract receiving the funds, implementing IFlashLoanReceiver interface - * @param assets The addresses of the assets being flash-borrowed - * @param amounts The amounts of the assets being flash-borrowed -@@ -2029,7 +1993,7 @@ interface IPool { - * @notice Allows smartcontracts to access the liquidity of the pool within one transaction, - * as long as the amount taken plus a fee is returned. - * @dev IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept -- * into consideration. For further details please visit https://developers.aave.com -+ * into consideration. For further details please visit https://docs.aave.com/developers/ - * @param receiverAddress The address of the contract receiving the funds, implementing IFlashLoanSimpleReceiver interface - * @param asset The address of the asset being flash-borrowed - * @param amount The amount of the asset being flash-borrowed -@@ -2105,6 +2069,22 @@ interface IPool { - address rateStrategyAddress - ) external; - -+ /** -+ * @notice Accumulates interest to all indexes of the reserve -+ * @dev Only callable by the PoolConfigurator contract -+ * @dev To be used when required by the configurator, for example when updating interest rates strategy data -+ * @param asset The address of the underlying asset of the reserve -+ */ -+ function syncIndexesState(address asset) external; -+ -+ /** -+ * @notice Updates interest rates on the reserve data -+ * @dev Only callable by the PoolConfigurator contract -+ * @dev To be used when required by the configurator, for example when updating interest rates strategy data -+ * @param asset The address of the underlying asset of the reserve -+ */ -+ function syncRatesState(address asset) external; -+ - /** - * @notice Sets the configuration bitmap of the reserve as a whole - * @dev Only callable by the PoolConfigurator contract -@@ -2160,7 +2140,23 @@ interface IPool { - * @param asset The address of the underlying asset of the reserve - * @return The state and configuration data of the reserve - */ -- function getReserveData(address asset) external view returns (DataTypes.ReserveData memory); -+ function getReserveData(address asset) external view returns (DataTypes.ReserveDataLegacy memory); -+ -+ /** -+ * @notice Returns the state and configuration of the reserve, including extra data included with Aave v3.1 -+ * @param asset The address of the underlying asset of the reserve -+ * @return The state and configuration data of the reserve with virtual accounting -+ */ -+ function getReserveDataExtended( -+ address asset -+ ) external view returns (DataTypes.ReserveData memory); -+ -+ /** -+ * @notice Returns the virtual underlying balance of the reserve -+ * @param asset The address of the underlying asset of the reserve -+ * @return The reserve virtual underlying balance -+ */ -+ function getVirtualUnderlyingBalance(address asset) external view returns (uint128); - - /** - * @notice Validates and finalizes an aToken transfer -@@ -2188,6 +2184,13 @@ interface IPool { - */ - function getReservesList() external view returns (address[] memory); - -+ /** -+ * @notice Returns the number of initialized reserves -+ * @dev It includes dropped reserves -+ * @return The count -+ */ -+ function getReservesCount() external view returns (uint256); -+ - /** - * @notice Returns the address of the underlying asset of a reserve by the reserve id as stored in the DataTypes.ReserveData struct - * @param id The id of the reserve as stored in the DataTypes.ReserveData struct -@@ -2258,6 +2261,22 @@ interface IPool { - */ - function resetIsolationModeTotalDebt(address asset) external; - -+ /** -+ * @notice Sets the liquidation grace period of the given asset -+ * @dev To enable a liquidation grace period, a timestamp in the future should be set, -+ * To disable a liquidation grace period, any timestamp in the past works, like 0 -+ * @param asset The address of the underlying asset to set the liquidationGracePeriod -+ * @param until Timestamp when the liquidation grace period will end -+ **/ -+ function setLiquidationGracePeriod(address asset, uint40 until) external; -+ -+ /** -+ * @notice Returns the liquidation grace period of the given asset -+ * @param asset The address of the underlying asset -+ * @return Timestamp when the liquidation grace period will end -+ **/ -+ 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 -@@ -2315,9 +2334,44 @@ interface IPool { - * 0 if the action is executed directly by the user, without any middle-man - */ - function deposit(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external; -+ -+ /** -+ * @notice Gets the address of the external FlashLoanLogic -+ */ -+ function getFlashLoanLogic() external returns (address); -+ -+ /** -+ * @notice Gets the address of the external BorrowLogic -+ */ -+ function getBorrowLogic() external returns (address); -+ -+ /** -+ * @notice Gets the address of the external BridgeLogic -+ */ -+ function getBridgeLogic() external returns (address); -+ -+ /** -+ * @notice Gets the address of the external EModeLogic -+ */ -+ function getEModeLogic() external returns (address); -+ -+ /** -+ * @notice Gets the address of the external LiquidationLogic -+ */ -+ function getLiquidationLogic() external returns (address); -+ -+ /** -+ * @notice Gets the address of the external PoolLogic -+ */ -+ function getPoolLogic() external returns (address); -+ -+ /** -+ * @notice Gets the address of the external SupplyLogic -+ */ -+ function getSupplyLogic() external returns (address); - } - --// downloads/MAINNET/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtToken/@aave/core-v3/contracts/interfaces/IInitializableDebtToken.sol -+// downloads/ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtTokenInstance/src/core/contracts/interfaces/IInitializableDebtToken.sol - - /** - * @title IInitializableDebtToken -@@ -2366,7 +2420,7 @@ interface IInitializableDebtToken { - ) external; - } - --// downloads/MAINNET/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtToken/@aave/core-v3/contracts/interfaces/IStableDebtToken.sol -+// downloads/ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtTokenInstance/src/core/contracts/interfaces/IStableDebtToken.sol - - /** - * @title IStableDebtToken -@@ -2503,7 +2557,7 @@ interface IStableDebtToken is IInitializableDebtToken { - function UNDERLYING_ASSET_ADDRESS() external view returns (address); - } - --// downloads/MAINNET/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtToken/@aave/core-v3/contracts/protocol/tokenization/base/DebtTokenBase.sol -+// downloads/ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtTokenInstance/src/core/contracts/protocol/tokenization/base/DebtTokenBase.sol - - /** - * @title DebtTokenBase -@@ -2599,7 +2653,7 @@ abstract contract DebtTokenBase is - } - } - + -// downloads/MAINNET/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtToken/@aave/core-v3/contracts/protocol/tokenization/base/IncentivizedERC20.sol +// downloads/ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtTokenInstance/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol - + /** * @title IncentivizedERC20 @@ -2654,15 +2708,15 @@ abstract contract IncentivizedERC20 is Context, IERC20Detailed { @@ -561,14 +31,14 @@ index 87f3628..35e192c 100644 + _decimals = decimals_; POOL = pool; } - + @@ -2823,7 +2877,7 @@ abstract contract IncentivizedERC20 is Context, IERC20Detailed { } } - + -// downloads/MAINNET/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtToken/@aave/core-v3/contracts/protocol/tokenization/StableDebtToken.sol +// downloads/ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtTokenInstance/src/core/contracts/protocol/tokenization/StableDebtToken.sol - + /** * @title StableDebtToken @@ -2832,20 +2886,7 @@ abstract contract IncentivizedERC20 is Context, IERC20Detailed { @@ -596,7 +66,7 @@ index 87f3628..35e192c 100644 @@ -2856,6 +2897,128 @@ contract StableDebtToken is DebtTokenBase, IncentivizedERC20, IStableDebtToken { // Intentionally left blank } - + + /// @inheritdoc IInitializableDebtToken + function initialize( + IPool initializingPool, diff --git a/diffs/MAINNET_ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL_DIFF.md b/diffs/MAINNET_ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL_DIFF.md index 7e018535..22c7d126 100644 --- a/diffs/MAINNET_ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL_DIFF.md +++ b/diffs/MAINNET_ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL_DIFF.md @@ -3,452 +3,10 @@ diff --git a/./downloads/MAINNET/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL.sol b/./downlo index d195593..885ee20 100644 --- a/./downloads/MAINNET/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL.sol +++ b/./downloads/ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL.sol -@@ -1,7 +1,7 @@ --// SPDX-License-Identifier: BUSL-1.1 --pragma solidity =0.8.10 ^0.8.0; -+// SPDX-License-Identifier: MIT -+pragma solidity ^0.8.0 ^0.8.10; - --// downloads/MAINNET/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtToken/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/Context.sol -+// downloads/ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtTokenInstance/src/core/contracts/dependencies/openzeppelin/contracts/Context.sol - - /* - * @dev Provides information about the current execution context, including the -@@ -24,7 +24,7 @@ abstract contract Context { - } - } - --// downloads/MAINNET/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtToken/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/IERC20.sol -+// downloads/ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtTokenInstance/src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol - - /** - * @dev Interface of the ERC20 standard as defined in the EIP. -@@ -100,7 +100,7 @@ interface IERC20 { - event Approval(address indexed owner, address indexed spender, uint256 value); - } - --// downloads/MAINNET/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtToken/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/SafeCast.sol -+// downloads/ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtTokenInstance/src/core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol - - // OpenZeppelin Contracts v4.4.1 (utils/math/SafeCast.sol) - -@@ -356,7 +356,7 @@ library SafeCast { - } - } - --// downloads/MAINNET/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtToken/@aave/core-v3/contracts/interfaces/IAaveIncentivesController.sol -+// downloads/ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtTokenInstance/src/core/contracts/interfaces/IAaveIncentivesController.sol - - /** - * @title IAaveIncentivesController -@@ -375,7 +375,7 @@ interface IAaveIncentivesController { - function handleAction(address user, uint256 totalSupply, uint256 userBalance) external; - } - --// downloads/MAINNET/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtToken/@aave/core-v3/contracts/interfaces/ICreditDelegationToken.sol -+// downloads/ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtTokenInstance/src/core/contracts/interfaces/ICreditDelegationToken.sol - - /** - * @title ICreditDelegationToken -@@ -435,7 +435,7 @@ interface ICreditDelegationToken { - ) external; - } - --// downloads/MAINNET/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtToken/@aave/core-v3/contracts/interfaces/IPoolAddressesProvider.sol -+// downloads/ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtTokenInstance/src/core/contracts/interfaces/IPoolAddressesProvider.sol - - /** - * @title IPoolAddressesProvider -@@ -662,7 +662,7 @@ interface IPoolAddressesProvider { - function setPoolDataProvider(address newDataProvider) external; - } - --// downloads/MAINNET/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtToken/@aave/core-v3/contracts/interfaces/IScaledBalanceToken.sol -+// downloads/ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtTokenInstance/src/core/contracts/interfaces/IScaledBalanceToken.sol - - /** - * @title IScaledBalanceToken -@@ -734,7 +734,7 @@ interface IScaledBalanceToken { - function getPreviousIndex(address user) external view returns (uint256); - } - --// downloads/MAINNET/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtToken/@aave/core-v3/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol -+// downloads/ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtTokenInstance/src/core/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol - - /** - * @title VersionedInitializable -@@ -811,7 +811,7 @@ abstract contract VersionedInitializable { - uint256[50] private ______gap; - } - --// downloads/MAINNET/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtToken/@aave/core-v3/contracts/protocol/libraries/helpers/Errors.sol -+// downloads/ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtTokenInstance/src/core/contracts/protocol/libraries/helpers/Errors.sol - - /** - * @title Errors library -@@ -879,7 +879,7 @@ library Errors { - string public constant PRICE_ORACLE_SENTINEL_CHECK_FAILED = '59'; // 'Price oracle sentinel validation failed' - string public constant ASSET_NOT_BORROWABLE_IN_ISOLATION = '60'; // 'Asset is not borrowable in isolation mode' - string public constant RESERVE_ALREADY_INITIALIZED = '61'; // 'Reserve has already been initialized' -- string public constant USER_IN_ISOLATION_MODE = '62'; // 'User is in isolation mode' -+ string public constant USER_IN_ISOLATION_MODE_OR_LTV_ZERO = '62'; // 'User is in isolation mode or ltv is zero' - string public constant INVALID_LTV = '63'; // 'Invalid ltv parameter for the reserve' - string public constant INVALID_LIQ_THRESHOLD = '64'; // 'Invalid liquidity threshold parameter for the reserve' - string public constant INVALID_LIQ_BONUS = '65'; // 'Invalid liquidity bonus parameter for the reserve' -@@ -909,9 +909,17 @@ library Errors { - 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 -+ string public constant INVALID_MAX_RATE = '92'; // The expect maximum borrow rate is invalid -+ string public constant WITHDRAW_TO_ATOKEN = '93'; // Withdrawing to the aToken is not allowed -+ string public constant SUPPLY_TO_ATOKEN = '94'; // Supplying to the aToken is not allowed -+ string public constant SLOPE_2_MUST_BE_GTE_SLOPE_1 = '95'; // Variable interest rate slope 2 can not be lower than slope 1 -+ string public constant CALLER_NOT_RISK_OR_POOL_OR_EMERGENCY_ADMIN = '96'; // 'The caller of the function is not a risk, pool or emergency admin' -+ 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 - } - --// downloads/MAINNET/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtToken/@aave/core-v3/contracts/protocol/libraries/math/WadRayMath.sol -+// downloads/ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtTokenInstance/src/core/contracts/protocol/libraries/math/WadRayMath.sol - - /** - * @title WadRayMath library -@@ -1037,9 +1045,46 @@ library WadRayMath { - } - } - --// downloads/MAINNET/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtToken/@aave/core-v3/contracts/protocol/libraries/types/DataTypes.sol -+// downloads/ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtTokenInstance/src/core/contracts/protocol/libraries/types/DataTypes.sol - - library DataTypes { -+ /** -+ * This exists specifically to maintain the `getReserveData()` interface, since the new, internal -+ * `ReserveData` struct includes the reserve's `virtualUnderlyingBalance`. -+ */ -+ struct ReserveDataLegacy { -+ //stores the reserve configuration -+ ReserveConfigurationMap configuration; -+ //the liquidity index. Expressed in ray -+ uint128 liquidityIndex; -+ //the current supply rate. Expressed in ray -+ uint128 currentLiquidityRate; -+ //variable borrow index. Expressed in ray -+ uint128 variableBorrowIndex; -+ //the current variable borrow rate. Expressed in ray -+ uint128 currentVariableBorrowRate; -+ //the current stable borrow rate. Expressed in ray -+ uint128 currentStableBorrowRate; -+ //timestamp of last update -+ uint40 lastUpdateTimestamp; -+ //the id of the reserve. Represents the position in the list of the active reserves -+ uint16 id; -+ //aToken address -+ address aTokenAddress; -+ //stableDebtToken address -+ address stableDebtTokenAddress; -+ //variableDebtToken address -+ address variableDebtTokenAddress; -+ //address of the interest rate strategy -+ address interestRateStrategyAddress; -+ //the current treasury balance, scaled -+ uint128 accruedToTreasury; -+ //the outstanding unbacked aTokens minted through the bridging feature -+ uint128 unbacked; -+ //the outstanding debt borrowed against this asset in isolation mode -+ uint128 isolationModeTotalDebt; -+ } -+ - struct ReserveData { - //stores the reserve configuration - ReserveConfigurationMap configuration; -@@ -1057,6 +1102,8 @@ library DataTypes { - uint40 lastUpdateTimestamp; - //the id of the reserve. Represents the position in the list of the active reserves - uint16 id; -+ //timestamp until when liquidations are not allowed on the reserve, if set to past liquidations will be allowed -+ uint40 liquidationGracePeriodUntil; - //aToken address - address aTokenAddress; - //stableDebtToken address -@@ -1071,6 +1118,8 @@ library DataTypes { - uint128 unbacked; - //the outstanding debt borrowed against this asset in isolation mode - uint128 isolationModeTotalDebt; -+ //the amount of underlying accounted for by the protocol -+ uint128 virtualUnderlyingBalance; - } - - struct ReserveConfigurationMap { -@@ -1084,15 +1133,17 @@ library DataTypes { - //bit 59: stable rate borrowing enabled - //bit 60: asset is paused - //bit 61: borrowing in isolation mode is enabled -- //bit 62-63: reserved -+ //bit 62: siloed borrowing enabled -+ //bit 63: flashloaning enabled - //bit 64-79: reserve factor -- //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 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-255 unused -+ //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 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 -+ //bit 253-255 unused - - uint256 data; - } -@@ -1227,6 +1278,7 @@ library DataTypes { - uint256 maxStableRateBorrowSizePercent; - uint256 reservesCount; - address addressesProvider; -+ address pool; - uint8 userEModeCategory; - bool isAuthorizedFlashBorrower; - } -@@ -1291,7 +1343,8 @@ library DataTypes { - uint256 averageStableBorrowRate; - uint256 reserveFactor; - address reserve; -- address aToken; -+ bool usingVirtualBalance; -+ uint256 virtualUnderlyingBalance; - } - - struct InitReserveParams { -@@ -1305,7 +1358,7 @@ library DataTypes { - } - } - --// downloads/MAINNET/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtToken/@aave/core-v3/contracts/protocol/tokenization/base/EIP712Base.sol -+// downloads/ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtTokenInstance/src/core/contracts/protocol/tokenization/base/EIP712Base.sol - - /** - * @title EIP712Base -@@ -1375,7 +1428,7 @@ abstract contract EIP712Base { - function _EIP712BaseId() internal view virtual returns (string memory); - } - --// downloads/MAINNET/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtToken/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol -+// downloads/ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtTokenInstance/src/core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol - - interface IERC20Detailed is IERC20 { - function name() external view returns (string memory); -@@ -1385,7 +1438,7 @@ interface IERC20Detailed is IERC20 { - function decimals() external view returns (uint8); - } - --// downloads/MAINNET/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtToken/@aave/core-v3/contracts/interfaces/IACLManager.sol -+// downloads/ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtTokenInstance/src/core/contracts/interfaces/IACLManager.sol - - /** - * @title IACLManager -@@ -1558,7 +1611,7 @@ interface IACLManager { - function isAssetListingAdmin(address admin) external view returns (bool); - } - --// downloads/MAINNET/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtToken/@aave/core-v3/contracts/interfaces/IPool.sol -+// downloads/ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtTokenInstance/src/core/contracts/interfaces/IPool.sol - - /** - * @title IPool -@@ -1936,6 +1989,14 @@ interface IPool { - */ - 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: -@@ -1977,7 +2038,7 @@ interface IPool { - * @notice Allows smartcontracts to access the liquidity of the pool within one transaction, - * as long as the amount taken plus a fee is returned. - * @dev IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept -- * into consideration. For further details please visit https://developers.aave.com -+ * into consideration. For further details please visit https://docs.aave.com/developers/ - * @param receiverAddress The address of the contract receiving the funds, implementing IFlashLoanReceiver interface - * @param assets The addresses of the assets being flash-borrowed - * @param amounts The amounts of the assets being flash-borrowed -@@ -2004,7 +2065,7 @@ interface IPool { - * @notice Allows smartcontracts to access the liquidity of the pool within one transaction, - * as long as the amount taken plus a fee is returned. - * @dev IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept -- * into consideration. For further details please visit https://developers.aave.com -+ * into consideration. For further details please visit https://docs.aave.com/developers/ - * @param receiverAddress The address of the contract receiving the funds, implementing IFlashLoanSimpleReceiver interface - * @param asset The address of the asset being flash-borrowed - * @param amount The amount of the asset being flash-borrowed -@@ -2080,6 +2141,22 @@ interface IPool { - address rateStrategyAddress - ) external; - -+ /** -+ * @notice Accumulates interest to all indexes of the reserve -+ * @dev Only callable by the PoolConfigurator contract -+ * @dev To be used when required by the configurator, for example when updating interest rates strategy data -+ * @param asset The address of the underlying asset of the reserve -+ */ -+ function syncIndexesState(address asset) external; -+ -+ /** -+ * @notice Updates interest rates on the reserve data -+ * @dev Only callable by the PoolConfigurator contract -+ * @dev To be used when required by the configurator, for example when updating interest rates strategy data -+ * @param asset The address of the underlying asset of the reserve -+ */ -+ function syncRatesState(address asset) external; -+ - /** - * @notice Sets the configuration bitmap of the reserve as a whole - * @dev Only callable by the PoolConfigurator contract -@@ -2135,7 +2212,23 @@ interface IPool { - * @param asset The address of the underlying asset of the reserve - * @return The state and configuration data of the reserve - */ -- function getReserveData(address asset) external view returns (DataTypes.ReserveData memory); -+ function getReserveData(address asset) external view returns (DataTypes.ReserveDataLegacy memory); -+ -+ /** -+ * @notice Returns the state and configuration of the reserve, including extra data included with Aave v3.1 -+ * @param asset The address of the underlying asset of the reserve -+ * @return The state and configuration data of the reserve with virtual accounting -+ */ -+ function getReserveDataExtended( -+ address asset -+ ) external view returns (DataTypes.ReserveData memory); -+ -+ /** -+ * @notice Returns the virtual underlying balance of the reserve -+ * @param asset The address of the underlying asset of the reserve -+ * @return The reserve virtual underlying balance -+ */ -+ function getVirtualUnderlyingBalance(address asset) external view returns (uint128); - - /** - * @notice Validates and finalizes an aToken transfer -@@ -2163,6 +2256,13 @@ interface IPool { - */ - function getReservesList() external view returns (address[] memory); - -+ /** -+ * @notice Returns the number of initialized reserves -+ * @dev It includes dropped reserves -+ * @return The count -+ */ -+ function getReservesCount() external view returns (uint256); -+ - /** - * @notice Returns the address of the underlying asset of a reserve by the reserve id as stored in the DataTypes.ReserveData struct - * @param id The id of the reserve as stored in the DataTypes.ReserveData struct -@@ -2233,6 +2333,22 @@ interface IPool { - */ - function resetIsolationModeTotalDebt(address asset) external; - -+ /** -+ * @notice Sets the liquidation grace period of the given asset -+ * @dev To enable a liquidation grace period, a timestamp in the future should be set, -+ * To disable a liquidation grace period, any timestamp in the past works, like 0 -+ * @param asset The address of the underlying asset to set the liquidationGracePeriod -+ * @param until Timestamp when the liquidation grace period will end -+ **/ -+ function setLiquidationGracePeriod(address asset, uint40 until) external; -+ -+ /** -+ * @notice Returns the liquidation grace period of the given asset -+ * @param asset The address of the underlying asset -+ * @return Timestamp when the liquidation grace period will end -+ **/ -+ 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 -@@ -2290,9 +2406,44 @@ interface IPool { - * 0 if the action is executed directly by the user, without any middle-man - */ - function deposit(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external; -+ -+ /** -+ * @notice Gets the address of the external FlashLoanLogic -+ */ -+ function getFlashLoanLogic() external returns (address); -+ -+ /** -+ * @notice Gets the address of the external BorrowLogic -+ */ -+ function getBorrowLogic() external returns (address); -+ -+ /** -+ * @notice Gets the address of the external BridgeLogic -+ */ -+ function getBridgeLogic() external returns (address); -+ -+ /** -+ * @notice Gets the address of the external EModeLogic -+ */ -+ function getEModeLogic() external returns (address); -+ -+ /** -+ * @notice Gets the address of the external LiquidationLogic -+ */ -+ function getLiquidationLogic() external returns (address); -+ -+ /** -+ * @notice Gets the address of the external PoolLogic -+ */ -+ function getPoolLogic() external returns (address); -+ -+ /** -+ * @notice Gets the address of the external SupplyLogic -+ */ -+ function getSupplyLogic() external returns (address); - } - --// downloads/MAINNET/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtToken/@aave/core-v3/contracts/interfaces/IInitializableDebtToken.sol -+// downloads/ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtTokenInstance/src/core/contracts/interfaces/IInitializableDebtToken.sol - - /** - * @title IInitializableDebtToken -@@ -2341,7 +2492,7 @@ interface IInitializableDebtToken { - ) external; - } - --// downloads/MAINNET/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtToken/@aave/core-v3/contracts/protocol/tokenization/base/DebtTokenBase.sol -+// downloads/ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtTokenInstance/src/core/contracts/protocol/tokenization/base/DebtTokenBase.sol - - /** - * @title DebtTokenBase -@@ -2437,7 +2588,7 @@ abstract contract DebtTokenBase is - } - } - --// downloads/MAINNET/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtToken/@aave/core-v3/contracts/interfaces/IVariableDebtToken.sol -+// downloads/ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtTokenInstance/src/core/contracts/interfaces/IVariableDebtToken.sol - - /** - * @title IVariableDebtToken -@@ -2480,7 +2631,7 @@ interface IVariableDebtToken is IScaledBalanceToken, IInitializableDebtToken { - function UNDERLYING_ASSET_ADDRESS() external view returns (address); - } - + -// downloads/MAINNET/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtToken/@aave/core-v3/contracts/protocol/tokenization/base/IncentivizedERC20.sol +// downloads/ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtTokenInstance/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol - + /** * @title IncentivizedERC20 @@ -2535,15 +2686,15 @@ abstract contract IncentivizedERC20 is Context, IERC20Detailed { @@ -473,32 +31,14 @@ index d195593..885ee20 100644 + _decimals = decimals_; POOL = pool; } - + @@ -2704,7 +2855,7 @@ abstract contract IncentivizedERC20 is Context, IERC20Detailed { } } - --// downloads/MAINNET/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtToken/@aave/core-v3/contracts/protocol/tokenization/base/MintableIncentivizedERC20.sol -+// downloads/ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtTokenInstance/src/core/contracts/protocol/tokenization/base/MintableIncentivizedERC20.sol - - /** - * @title MintableIncentivizedERC20 -@@ -2766,7 +2917,7 @@ abstract contract MintableIncentivizedERC20 is IncentivizedERC20 { - } - } - --// downloads/MAINNET/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtToken/@aave/core-v3/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol -+// downloads/ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtTokenInstance/src/core/contracts/protocol/tokenization/base/ScaledBalanceTokenBase.sol - - /** - * @title ScaledBalanceTokenBase -@@ -2915,7 +3066,7 @@ abstract contract ScaledBalanceTokenBase is MintableIncentivizedERC20, IScaledBa - } - } - + -// downloads/MAINNET/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtToken/@aave/core-v3/contracts/protocol/tokenization/VariableDebtToken.sol +// downloads/ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtTokenInstance/src/core/contracts/protocol/tokenization/VariableDebtToken.sol - + /** * @title VariableDebtToken @@ -2924,12 +3075,10 @@ abstract contract ScaledBalanceTokenBase is MintableIncentivizedERC20, IScaledBa @@ -509,7 +49,7 @@ index d195593..885ee20 100644 +abstract contract VariableDebtToken is DebtTokenBase, ScaledBalanceTokenBase, IVariableDebtToken { using WadRayMath for uint256; using SafeCast for uint256; - + - uint256 public constant DEBT_TOKEN_REVISION = 0x1; - /** @@ -546,7 +86,7 @@ index d195593..885ee20 100644 - return DEBT_TOKEN_REVISION; - } + ) external virtual; - + /// @inheritdoc IERC20 function balanceOf(address user) public view virtual override returns (uint256) { @@ -3056,3 +3180,47 @@ contract VariableDebtToken is DebtTokenBase, ScaledBalanceTokenBase, IVariableDe diff --git a/diffs/MAINNET_ZKSYNC/EMISSION_MANAGER_DIFF.md b/diffs/MAINNET_ZKSYNC/EMISSION_MANAGER_DIFF.md index d86166f8..47fff128 100644 --- a/diffs/MAINNET_ZKSYNC/EMISSION_MANAGER_DIFF.md +++ b/diffs/MAINNET_ZKSYNC/EMISSION_MANAGER_DIFF.md @@ -3,124 +3,5 @@ diff --git a/./downloads/MAINNET/EMISSION_MANAGER.sol b/./downloads/ZKSYNC/EMISS index 0f66685..16d9cb7 100644 --- a/./downloads/MAINNET/EMISSION_MANAGER.sol +++ b/./downloads/ZKSYNC/EMISSION_MANAGER.sol -@@ -1,30 +1,7 @@ --// SPDX-License-Identifier: AGPL-3.0 --pragma solidity =0.8.10 ^0.8.10; -+// SPDX-License-Identifier: BUSL-1.1 -+pragma solidity ^0.8.10; - --// downloads/MAINNET/EMISSION_MANAGER/EmissionManager/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/Context.sol -- --/* -- * @dev Provides information about the current execution context, including the -- * sender of the transaction and its data. While these are generally available -- * via msg.sender and msg.data, they should not be accessed in such a direct -- * manner, since when dealing with GSN meta-transactions the account sending and -- * paying for execution may not be the actual sender (as far as an application -- * is concerned). -- * -- * This contract is only required for intermediate, library-like contracts. -- */ --abstract contract Context { -- function _msgSender() internal view virtual returns (address payable) { -- return payable(msg.sender); -- } -- -- function _msgData() internal view virtual returns (bytes memory) { -- this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 -- return msg.data; -- } --} -- --// downloads/MAINNET/EMISSION_MANAGER/EmissionManager/@aave/periphery-v3/contracts/misc/interfaces/IEACAggregatorProxy.sol -+// downloads/ZKSYNC/EMISSION_MANAGER/EmissionManager/src/periphery/contracts/misc/interfaces/IEACAggregatorProxy.sol - - interface IEACAggregatorProxy { - function decimals() external view returns (uint8); -@@ -43,7 +20,7 @@ interface IEACAggregatorProxy { - event NewRound(uint256 indexed roundId, address indexed startedBy); - } - --// downloads/MAINNET/EMISSION_MANAGER/EmissionManager/@aave/periphery-v3/contracts/rewards/interfaces/IRewardsDistributor.sol -+// downloads/ZKSYNC/EMISSION_MANAGER/EmissionManager/src/periphery/contracts/rewards/interfaces/IRewardsDistributor.sol - - /** - * @title IRewardsDistributor -@@ -220,7 +197,7 @@ interface IRewardsDistributor { - function getEmissionManager() external view returns (address); - } - --// downloads/MAINNET/EMISSION_MANAGER/EmissionManager/@aave/periphery-v3/contracts/rewards/interfaces/ITransferStrategyBase.sol -+// downloads/ZKSYNC/EMISSION_MANAGER/EmissionManager/src/periphery/contracts/rewards/interfaces/ITransferStrategyBase.sol - - interface ITransferStrategyBase { - event EmergencyWithdrawal( -@@ -258,7 +235,30 @@ interface ITransferStrategyBase { - function emergencyWithdrawal(address token, address to, uint256 amount) external; - } - --// downloads/MAINNET/EMISSION_MANAGER/EmissionManager/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/Ownable.sol -+// src/core/contracts/dependencies/openzeppelin/contracts/Context.sol -+ -+/* -+ * @dev Provides information about the current execution context, including the -+ * sender of the transaction and its data. While these are generally available -+ * via msg.sender and msg.data, they should not be accessed in such a direct -+ * manner, since when dealing with GSN meta-transactions the account sending and -+ * paying for execution may not be the actual sender (as far as an application -+ * is concerned). -+ * -+ * This contract is only required for intermediate, library-like contracts. -+ */ -+abstract contract Context { -+ function _msgSender() internal view virtual returns (address payable) { -+ return payable(msg.sender); -+ } -+ -+ function _msgData() internal view virtual returns (bytes memory) { -+ this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 -+ return msg.data; -+ } -+} -+ -+// src/core/contracts/dependencies/openzeppelin/contracts/Ownable.sol - - /** - * @dev Contract module which provides a basic access control mechanism, where -@@ -324,7 +324,7 @@ contract Ownable is Context { - } - } - --// downloads/MAINNET/EMISSION_MANAGER/EmissionManager/@aave/periphery-v3/contracts/rewards/libraries/RewardsDataTypes.sol -+// downloads/ZKSYNC/EMISSION_MANAGER/EmissionManager/src/periphery/contracts/rewards/libraries/RewardsDataTypes.sol - - library RewardsDataTypes { - struct RewardsConfigInput { -@@ -375,7 +375,7 @@ library RewardsDataTypes { - } - } - --// downloads/MAINNET/EMISSION_MANAGER/EmissionManager/@aave/periphery-v3/contracts/rewards/interfaces/IRewardsController.sol -+// downloads/ZKSYNC/EMISSION_MANAGER/EmissionManager/src/periphery/contracts/rewards/interfaces/IRewardsController.sol - - /** - * @title IRewardsController -@@ -573,7 +573,7 @@ interface IRewardsController is IRewardsDistributor { - ) external returns (address[] memory rewardsList, uint256[] memory claimedAmounts); - } - --// downloads/MAINNET/EMISSION_MANAGER/EmissionManager/@aave/periphery-v3/contracts/rewards/interfaces/IEmissionManager.sol -+// downloads/ZKSYNC/EMISSION_MANAGER/EmissionManager/src/periphery/contracts/rewards/interfaces/IEmissionManager.sol - - /** - * @title IEmissionManager -@@ -686,7 +686,7 @@ interface IEmissionManager { - function getEmissionAdmin(address reward) external view returns (address); - } - --// downloads/MAINNET/EMISSION_MANAGER/EmissionManager/@aave/periphery-v3/contracts/rewards/EmissionManager.sol -+// downloads/ZKSYNC/EMISSION_MANAGER/EmissionManager/src/periphery/contracts/rewards/EmissionManager.sol - - /** - * @title EmissionManager + ``` diff --git a/diffs/MAINNET_ZKSYNC/EMODE_LOGIC_DIFF.md b/diffs/MAINNET_ZKSYNC/EMODE_LOGIC_DIFF.md index a1092453..7a92034b 100644 --- a/diffs/MAINNET_ZKSYNC/EMODE_LOGIC_DIFF.md +++ b/diffs/MAINNET_ZKSYNC/EMODE_LOGIC_DIFF.md @@ -3,292 +3,5 @@ diff --git a/./downloads/MAINNET/EMODE_LOGIC.sol b/./downloads/ZKSYNC/EMODE_LOGI index ad40d1b..97162e1 100644 --- a/./downloads/MAINNET/EMODE_LOGIC.sol +++ b/./downloads/ZKSYNC/EMODE_LOGIC.sol -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: BUSL-1.1 - pragma solidity ^0.8.0 ^0.8.10; - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/dependencies/openzeppelin/contracts/Address.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/dependencies/openzeppelin/contracts/Address.sol - - // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) - -@@ -221,7 +221,7 @@ library Address { - } - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/dependencies/openzeppelin/contracts/Context.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/dependencies/openzeppelin/contracts/Context.sol - - /* - * @dev Provides information about the current execution context, including the -@@ -244,7 +244,7 @@ abstract contract Context { - } - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/dependencies/openzeppelin/contracts/IAccessControl.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/dependencies/openzeppelin/contracts/IAccessControl.sol - - /** - * @dev External interface of AccessControl declared to support ERC165 detection. -@@ -334,7 +334,7 @@ interface IAccessControl { - function renounceRole(bytes32 role, address account) external; - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol - - /** - * @dev Interface of the ERC20 standard as defined in the EIP. -@@ -410,7 +410,7 @@ interface IERC20 { - event Approval(address indexed owner, address indexed spender, uint256 value); - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol - - // OpenZeppelin Contracts v4.4.1 (utils/math/SafeCast.sol) - -@@ -666,7 +666,7 @@ library SafeCast { - } - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/interfaces/IAaveIncentivesController.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/interfaces/IAaveIncentivesController.sol - - /** - * @title IAaveIncentivesController -@@ -685,7 +685,7 @@ interface IAaveIncentivesController { - function handleAction(address user, uint256 totalSupply, uint256 userBalance) external; - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/interfaces/IPoolAddressesProvider.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/interfaces/IPoolAddressesProvider.sol - - /** - * @title IPoolAddressesProvider -@@ -912,7 +912,7 @@ interface IPoolAddressesProvider { - function setPoolDataProvider(address newDataProvider) external; - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/interfaces/IPriceOracleGetter.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/interfaces/IPriceOracleGetter.sol - - /** - * @title IPriceOracleGetter -@@ -942,7 +942,7 @@ interface IPriceOracleGetter { - function getAssetPrice(address asset) external view returns (uint256); - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/interfaces/IScaledBalanceToken.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/interfaces/IScaledBalanceToken.sol - - /** - * @title IScaledBalanceToken -@@ -1014,7 +1014,7 @@ interface IScaledBalanceToken { - function getPreviousIndex(address user) external view returns (uint256); - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/protocol/libraries/helpers/Errors.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/protocol/libraries/helpers/Errors.sol - - /** - * @title Errors library -@@ -1122,7 +1122,7 @@ library Errors { - string public constant INVALID_FREEZE_STATE = '99'; // Reserve is already in the passed freeze state - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/protocol/libraries/math/PercentageMath.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/protocol/libraries/math/PercentageMath.sol - - /** - * @title PercentageMath library -@@ -1183,7 +1183,7 @@ library PercentageMath { - } - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/protocol/libraries/math/WadRayMath.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/protocol/libraries/math/WadRayMath.sol - - /** - * @title WadRayMath library -@@ -1309,7 +1309,7 @@ library WadRayMath { - } - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/protocol/libraries/types/DataTypes.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/protocol/libraries/types/DataTypes.sol - - library DataTypes { - /** -@@ -1622,7 +1622,7 @@ library DataTypes { - } - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol - - /// @title Gnosis Protocol v2 Safe ERC20 Transfer Library - /// @author Gnosis Developers -@@ -1735,7 +1735,7 @@ library GPv2SafeERC20 { - } - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol - - interface IERC20Detailed is IERC20 { - function name() external view returns (string memory); -@@ -1745,7 +1745,7 @@ interface IERC20Detailed is IERC20 { - function decimals() external view returns (uint8); - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/interfaces/IACLManager.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/interfaces/IACLManager.sol - - /** - * @title IACLManager -@@ -1918,7 +1918,7 @@ interface IACLManager { - function isAssetListingAdmin(address admin) external view returns (bool); - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/interfaces/IPriceOracleSentinel.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/interfaces/IPriceOracleSentinel.sol - - /** - * @title IPriceOracleSentinel -@@ -1983,7 +1983,7 @@ interface IPriceOracleSentinel { - function getGracePeriod() external view returns (uint256); - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/interfaces/IReserveInterestRateStrategy.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/interfaces/IReserveInterestRateStrategy.sol - - /** - * @title IReserveInterestRateStrategy -@@ -2011,7 +2011,7 @@ interface IReserveInterestRateStrategy { - ) external view returns (uint256, uint256, uint256); - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/protocol/libraries/math/MathUtils.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/protocol/libraries/math/MathUtils.sol - - /** - * @title MathUtils library -@@ -2108,7 +2108,7 @@ library MathUtils { - } - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/interfaces/IPool.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/interfaces/IPool.sol - - /** - * @title IPool -@@ -2940,7 +2940,7 @@ interface IPool { - function getSupplyLogic() external returns (address); - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol - - /** - * @title ReserveConfiguration library -@@ -3577,7 +3577,7 @@ library ReserveConfiguration { - } - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/protocol/libraries/configuration/UserConfiguration.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/protocol/libraries/configuration/UserConfiguration.sol - - /** - * @title UserConfiguration library -@@ -3809,7 +3809,7 @@ library UserConfiguration { - } - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/interfaces/IInitializableAToken.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/interfaces/IInitializableAToken.sol - - /** - * @title IInitializableAToken -@@ -3862,7 +3862,7 @@ interface IInitializableAToken { - ) external; - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/interfaces/IInitializableDebtToken.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/interfaces/IInitializableDebtToken.sol - - /** - * @title IInitializableDebtToken -@@ -3911,7 +3911,7 @@ interface IInitializableDebtToken { - ) external; - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/interfaces/IStableDebtToken.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/interfaces/IStableDebtToken.sol - - /** - * @title IStableDebtToken -@@ -4048,7 +4048,7 @@ interface IStableDebtToken is IInitializableDebtToken { - function UNDERLYING_ASSET_ADDRESS() external view returns (address); - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/interfaces/IVariableDebtToken.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/interfaces/IVariableDebtToken.sol - - /** - * @title IVariableDebtToken -@@ -4091,7 +4091,7 @@ interface IVariableDebtToken is IScaledBalanceToken, IInitializableDebtToken { - function UNDERLYING_ASSET_ADDRESS() external view returns (address); - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/interfaces/IAToken.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/interfaces/IAToken.sol - - /** - * @title IAToken -@@ -4225,7 +4225,7 @@ interface IAToken is IERC20, IScaledBalanceToken, IInitializableAToken { - function rescueTokens(address token, address to, uint256 amount) external; - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol - - /** - * @title IncentivizedERC20 -@@ -4449,7 +4449,7 @@ abstract contract IncentivizedERC20 is Context, IERC20Detailed { - } - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/protocol/libraries/logic/ReserveLogic.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/protocol/libraries/logic/ReserveLogic.sol - - /** - * @title ReserveLogic library -@@ -4809,7 +4809,7 @@ library ReserveLogic { - } - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/protocol/libraries/logic/GenericLogic.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/protocol/libraries/logic/GenericLogic.sol - - /** - * @title GenericLogic library -@@ -5067,7 +5067,7 @@ library GenericLogic { - } - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol - - /** - * @title ReserveLogic library -@@ -5827,7 +5827,7 @@ library ValidationLogic { - } - } - --// downloads/MAINNET/EMODE_LOGIC/EModeLogic/src/core/contracts/protocol/libraries/logic/EModeLogic.sol -+// downloads/ZKSYNC/EMODE_LOGIC/EModeLogic/src/core/contracts/protocol/libraries/logic/EModeLogic.sol - - /** - * @title EModeLogic library + ``` diff --git a/diffs/MAINNET_ZKSYNC/FLASHLOAN_LOGIC_DIFF.md b/diffs/MAINNET_ZKSYNC/FLASHLOAN_LOGIC_DIFF.md index 52e85995..82fe71e2 100644 --- a/diffs/MAINNET_ZKSYNC/FLASHLOAN_LOGIC_DIFF.md +++ b/diffs/MAINNET_ZKSYNC/FLASHLOAN_LOGIC_DIFF.md @@ -3,346 +3,5 @@ diff --git a/./downloads/MAINNET/FLASHLOAN_LOGIC.sol b/./downloads/ZKSYNC/FLASHL index 38cfa3b..5c4cbd2 100644 --- a/./downloads/MAINNET/FLASHLOAN_LOGIC.sol +++ b/./downloads/ZKSYNC/FLASHLOAN_LOGIC.sol -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: BUSL-1.1 - pragma solidity ^0.8.0 ^0.8.10; - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/dependencies/openzeppelin/contracts/Address.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/dependencies/openzeppelin/contracts/Address.sol - - // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) - -@@ -221,7 +221,7 @@ library Address { - } - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/dependencies/openzeppelin/contracts/Context.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/dependencies/openzeppelin/contracts/Context.sol - - /* - * @dev Provides information about the current execution context, including the -@@ -244,7 +244,7 @@ abstract contract Context { - } - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/dependencies/openzeppelin/contracts/IAccessControl.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/dependencies/openzeppelin/contracts/IAccessControl.sol - - /** - * @dev External interface of AccessControl declared to support ERC165 detection. -@@ -334,7 +334,7 @@ interface IAccessControl { - function renounceRole(bytes32 role, address account) external; - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol - - /** - * @dev Interface of the ERC20 standard as defined in the EIP. -@@ -410,7 +410,7 @@ interface IERC20 { - event Approval(address indexed owner, address indexed spender, uint256 value); - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol - - // OpenZeppelin Contracts v4.4.1 (utils/math/SafeCast.sol) - -@@ -666,7 +666,7 @@ library SafeCast { - } - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/interfaces/IAaveIncentivesController.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/interfaces/IAaveIncentivesController.sol - - /** - * @title IAaveIncentivesController -@@ -685,7 +685,7 @@ interface IAaveIncentivesController { - function handleAction(address user, uint256 totalSupply, uint256 userBalance) external; - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/interfaces/IPoolAddressesProvider.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/interfaces/IPoolAddressesProvider.sol - - /** - * @title IPoolAddressesProvider -@@ -912,7 +912,7 @@ interface IPoolAddressesProvider { - function setPoolDataProvider(address newDataProvider) external; - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/interfaces/IPriceOracleGetter.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/interfaces/IPriceOracleGetter.sol - - /** - * @title IPriceOracleGetter -@@ -942,7 +942,7 @@ interface IPriceOracleGetter { - function getAssetPrice(address asset) external view returns (uint256); - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/interfaces/IScaledBalanceToken.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/interfaces/IScaledBalanceToken.sol - - /** - * @title IScaledBalanceToken -@@ -1014,7 +1014,7 @@ interface IScaledBalanceToken { - function getPreviousIndex(address user) external view returns (uint256); - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/helpers/Errors.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/helpers/Errors.sol - - /** - * @title Errors library -@@ -1122,7 +1122,7 @@ library Errors { - string public constant INVALID_FREEZE_STATE = '99'; // Reserve is already in the passed freeze state - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/math/PercentageMath.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/math/PercentageMath.sol - - /** - * @title PercentageMath library -@@ -1183,7 +1183,7 @@ library PercentageMath { - } - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/math/WadRayMath.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/math/WadRayMath.sol - - /** - * @title WadRayMath library -@@ -1309,7 +1309,7 @@ library WadRayMath { - } - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/types/DataTypes.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/types/DataTypes.sol - - library DataTypes { - /** -@@ -1622,7 +1622,7 @@ library DataTypes { - } - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol - - /// @title Gnosis Protocol v2 Safe ERC20 Transfer Library - /// @author Gnosis Developers -@@ -1735,7 +1735,7 @@ library GPv2SafeERC20 { - } - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol - - interface IERC20Detailed is IERC20 { - function name() external view returns (string memory); -@@ -1745,7 +1745,7 @@ interface IERC20Detailed is IERC20 { - function decimals() external view returns (uint8); - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/interfaces/IACLManager.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/interfaces/IACLManager.sol - - /** - * @title IACLManager -@@ -1918,7 +1918,7 @@ interface IACLManager { - function isAssetListingAdmin(address admin) external view returns (bool); - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/interfaces/IPriceOracleSentinel.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/interfaces/IPriceOracleSentinel.sol - - /** - * @title IPriceOracleSentinel -@@ -1983,7 +1983,7 @@ interface IPriceOracleSentinel { - function getGracePeriod() external view returns (uint256); - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/interfaces/IReserveInterestRateStrategy.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/interfaces/IReserveInterestRateStrategy.sol - - /** - * @title IReserveInterestRateStrategy -@@ -2011,7 +2011,7 @@ interface IReserveInterestRateStrategy { - ) external view returns (uint256, uint256, uint256); - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/math/MathUtils.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/math/MathUtils.sol - - /** - * @title MathUtils library -@@ -2108,7 +2108,7 @@ library MathUtils { - } - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/interfaces/IPool.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/interfaces/IPool.sol - - /** - * @title IPool -@@ -2940,7 +2940,7 @@ interface IPool { - function getSupplyLogic() external returns (address); - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol - - /** - * @title ReserveConfiguration library -@@ -3577,7 +3577,7 @@ library ReserveConfiguration { - } - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/helpers/Helpers.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/helpers/Helpers.sol - - /** - * @title Helpers library -@@ -3602,7 +3602,7 @@ library Helpers { - } - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/flashloan/interfaces/IFlashLoanReceiver.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/flashloan/interfaces/IFlashLoanReceiver.sol - - /** - * @title IFlashLoanReceiver -@@ -3635,7 +3635,7 @@ interface IFlashLoanReceiver { - function POOL() external view returns (IPool); - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/flashloan/interfaces/IFlashLoanSimpleReceiver.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/flashloan/interfaces/IFlashLoanSimpleReceiver.sol - - /** - * @title IFlashLoanSimpleReceiver -@@ -3668,7 +3668,7 @@ interface IFlashLoanSimpleReceiver { - function POOL() external view returns (IPool); - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/configuration/UserConfiguration.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/configuration/UserConfiguration.sol - - /** - * @title UserConfiguration library -@@ -3900,7 +3900,7 @@ library UserConfiguration { - } - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/interfaces/IInitializableAToken.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/interfaces/IInitializableAToken.sol - - /** - * @title IInitializableAToken -@@ -3953,7 +3953,7 @@ interface IInitializableAToken { - ) external; - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/interfaces/IInitializableDebtToken.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/interfaces/IInitializableDebtToken.sol - - /** - * @title IInitializableDebtToken -@@ -4002,7 +4002,7 @@ interface IInitializableDebtToken { - ) external; - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/interfaces/IStableDebtToken.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/interfaces/IStableDebtToken.sol - - /** - * @title IStableDebtToken -@@ -4139,7 +4139,7 @@ interface IStableDebtToken is IInitializableDebtToken { - function UNDERLYING_ASSET_ADDRESS() external view returns (address); - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/logic/IsolationModeLogic.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/logic/IsolationModeLogic.sol - - /** - * @title IsolationModeLogic library -@@ -4198,7 +4198,7 @@ library IsolationModeLogic { - } - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/interfaces/IVariableDebtToken.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/interfaces/IVariableDebtToken.sol - - /** - * @title IVariableDebtToken -@@ -4241,7 +4241,7 @@ interface IVariableDebtToken is IScaledBalanceToken, IInitializableDebtToken { - function UNDERLYING_ASSET_ADDRESS() external view returns (address); - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/interfaces/IAToken.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/interfaces/IAToken.sol - - /** - * @title IAToken -@@ -4375,7 +4375,7 @@ interface IAToken is IERC20, IScaledBalanceToken, IInitializableAToken { - function rescueTokens(address token, address to, uint256 amount) external; - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol - - /** - * @title IncentivizedERC20 -@@ -4599,7 +4599,7 @@ abstract contract IncentivizedERC20 is Context, IERC20Detailed { - } - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/logic/ReserveLogic.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/logic/ReserveLogic.sol - - /** - * @title ReserveLogic library -@@ -4959,7 +4959,7 @@ library ReserveLogic { - } - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/logic/EModeLogic.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/logic/EModeLogic.sol - - /** - * @title EModeLogic library -@@ -5060,7 +5060,7 @@ library EModeLogic { - } - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/logic/GenericLogic.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/logic/GenericLogic.sol - - /** - * @title GenericLogic library -@@ -5318,7 +5318,7 @@ library GenericLogic { - } - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol - - /** - * @title ReserveLogic library -@@ -6078,7 +6078,7 @@ library ValidationLogic { - } - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/logic/BorrowLogic.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/logic/BorrowLogic.sol - - /** - * @title BorrowLogic library -@@ -6422,7 +6422,7 @@ library BorrowLogic { - } - } - --// downloads/MAINNET/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/logic/FlashLoanLogic.sol -+// downloads/ZKSYNC/FLASHLOAN_LOGIC/FlashLoanLogic/src/core/contracts/protocol/libraries/logic/FlashLoanLogic.sol - - /** - * @title FlashLoanLogic library + ``` diff --git a/diffs/MAINNET_ZKSYNC/LIQUIDATION_LOGIC_DIFF.md b/diffs/MAINNET_ZKSYNC/LIQUIDATION_LOGIC_DIFF.md index fca2cf74..370e1137 100644 --- a/diffs/MAINNET_ZKSYNC/LIQUIDATION_LOGIC_DIFF.md +++ b/diffs/MAINNET_ZKSYNC/LIQUIDATION_LOGIC_DIFF.md @@ -3,319 +3,5 @@ diff --git a/./downloads/MAINNET/LIQUIDATION_LOGIC.sol b/./downloads/ZKSYNC/LIQU index c52ec07..b6c73df 100644 --- a/./downloads/MAINNET/LIQUIDATION_LOGIC.sol +++ b/./downloads/ZKSYNC/LIQUIDATION_LOGIC.sol -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: BUSL-1.1 - pragma solidity ^0.8.0 ^0.8.10; - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/dependencies/openzeppelin/contracts/Address.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/dependencies/openzeppelin/contracts/Address.sol - - // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) - -@@ -221,7 +221,7 @@ library Address { - } - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/dependencies/openzeppelin/contracts/Context.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/dependencies/openzeppelin/contracts/Context.sol - - /* - * @dev Provides information about the current execution context, including the -@@ -244,7 +244,7 @@ abstract contract Context { - } - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/dependencies/openzeppelin/contracts/IAccessControl.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/dependencies/openzeppelin/contracts/IAccessControl.sol - - /** - * @dev External interface of AccessControl declared to support ERC165 detection. -@@ -334,7 +334,7 @@ interface IAccessControl { - function renounceRole(bytes32 role, address account) external; - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol - - /** - * @dev Interface of the ERC20 standard as defined in the EIP. -@@ -410,7 +410,7 @@ interface IERC20 { - event Approval(address indexed owner, address indexed spender, uint256 value); - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol - - // OpenZeppelin Contracts v4.4.1 (utils/math/SafeCast.sol) - -@@ -666,7 +666,7 @@ library SafeCast { - } - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/interfaces/IAaveIncentivesController.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/interfaces/IAaveIncentivesController.sol - - /** - * @title IAaveIncentivesController -@@ -685,7 +685,7 @@ interface IAaveIncentivesController { - function handleAction(address user, uint256 totalSupply, uint256 userBalance) external; - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/interfaces/IPoolAddressesProvider.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/interfaces/IPoolAddressesProvider.sol - - /** - * @title IPoolAddressesProvider -@@ -912,7 +912,7 @@ interface IPoolAddressesProvider { - function setPoolDataProvider(address newDataProvider) external; - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/interfaces/IPriceOracleGetter.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/interfaces/IPriceOracleGetter.sol - - /** - * @title IPriceOracleGetter -@@ -942,7 +942,7 @@ interface IPriceOracleGetter { - function getAssetPrice(address asset) external view returns (uint256); - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/interfaces/IScaledBalanceToken.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/interfaces/IScaledBalanceToken.sol - - /** - * @title IScaledBalanceToken -@@ -1014,7 +1014,7 @@ interface IScaledBalanceToken { - function getPreviousIndex(address user) external view returns (uint256); - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/helpers/Errors.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/helpers/Errors.sol - - /** - * @title Errors library -@@ -1122,7 +1122,7 @@ library Errors { - string public constant INVALID_FREEZE_STATE = '99'; // Reserve is already in the passed freeze state - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/math/PercentageMath.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/math/PercentageMath.sol - - /** - * @title PercentageMath library -@@ -1183,7 +1183,7 @@ library PercentageMath { - } - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/math/WadRayMath.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/math/WadRayMath.sol - - /** - * @title WadRayMath library -@@ -1309,7 +1309,7 @@ library WadRayMath { - } - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/types/DataTypes.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/types/DataTypes.sol - - library DataTypes { - /** -@@ -1622,7 +1622,7 @@ library DataTypes { - } - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol - - /// @title Gnosis Protocol v2 Safe ERC20 Transfer Library - /// @author Gnosis Developers -@@ -1735,7 +1735,7 @@ library GPv2SafeERC20 { - } - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol - - interface IERC20Detailed is IERC20 { - function name() external view returns (string memory); -@@ -1745,7 +1745,7 @@ interface IERC20Detailed is IERC20 { - function decimals() external view returns (uint8); - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/interfaces/IACLManager.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/interfaces/IACLManager.sol - - /** - * @title IACLManager -@@ -1918,7 +1918,7 @@ interface IACLManager { - function isAssetListingAdmin(address admin) external view returns (bool); - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/interfaces/IPriceOracleSentinel.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/interfaces/IPriceOracleSentinel.sol - - /** - * @title IPriceOracleSentinel -@@ -1983,7 +1983,7 @@ interface IPriceOracleSentinel { - function getGracePeriod() external view returns (uint256); - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/interfaces/IReserveInterestRateStrategy.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/interfaces/IReserveInterestRateStrategy.sol - - /** - * @title IReserveInterestRateStrategy -@@ -2011,7 +2011,7 @@ interface IReserveInterestRateStrategy { - ) external view returns (uint256, uint256, uint256); - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/math/MathUtils.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/math/MathUtils.sol - - /** - * @title MathUtils library -@@ -2108,7 +2108,7 @@ library MathUtils { - } - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/interfaces/IPool.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/interfaces/IPool.sol - - /** - * @title IPool -@@ -2940,7 +2940,7 @@ interface IPool { - function getSupplyLogic() external returns (address); - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol - - /** - * @title ReserveConfiguration library -@@ -3577,7 +3577,7 @@ library ReserveConfiguration { - } - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/helpers/Helpers.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/helpers/Helpers.sol - - /** - * @title Helpers library -@@ -3602,7 +3602,7 @@ library Helpers { - } - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/configuration/UserConfiguration.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/configuration/UserConfiguration.sol - - /** - * @title UserConfiguration library -@@ -3834,7 +3834,7 @@ library UserConfiguration { - } - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/interfaces/IInitializableAToken.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/interfaces/IInitializableAToken.sol - - /** - * @title IInitializableAToken -@@ -3887,7 +3887,7 @@ interface IInitializableAToken { - ) external; - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/interfaces/IInitializableDebtToken.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/interfaces/IInitializableDebtToken.sol - - /** - * @title IInitializableDebtToken -@@ -3936,7 +3936,7 @@ interface IInitializableDebtToken { - ) external; - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/interfaces/IStableDebtToken.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/interfaces/IStableDebtToken.sol - - /** - * @title IStableDebtToken -@@ -4073,7 +4073,7 @@ interface IStableDebtToken is IInitializableDebtToken { - function UNDERLYING_ASSET_ADDRESS() external view returns (address); - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/logic/IsolationModeLogic.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/logic/IsolationModeLogic.sol - - /** - * @title IsolationModeLogic library -@@ -4132,7 +4132,7 @@ library IsolationModeLogic { - } - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/interfaces/IVariableDebtToken.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/interfaces/IVariableDebtToken.sol - - /** - * @title IVariableDebtToken -@@ -4175,7 +4175,7 @@ interface IVariableDebtToken is IScaledBalanceToken, IInitializableDebtToken { - function UNDERLYING_ASSET_ADDRESS() external view returns (address); - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/interfaces/IAToken.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/interfaces/IAToken.sol - - /** - * @title IAToken -@@ -4309,7 +4309,7 @@ interface IAToken is IERC20, IScaledBalanceToken, IInitializableAToken { - function rescueTokens(address token, address to, uint256 amount) external; - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol - - /** - * @title IncentivizedERC20 -@@ -4533,7 +4533,7 @@ abstract contract IncentivizedERC20 is Context, IERC20Detailed { - } - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/logic/ReserveLogic.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/logic/ReserveLogic.sol - - /** - * @title ReserveLogic library -@@ -4893,7 +4893,7 @@ library ReserveLogic { - } - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/logic/EModeLogic.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/logic/EModeLogic.sol - - /** - * @title EModeLogic library -@@ -4994,7 +4994,7 @@ library EModeLogic { - } - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/logic/GenericLogic.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/logic/GenericLogic.sol - - /** - * @title GenericLogic library -@@ -5252,7 +5252,7 @@ library GenericLogic { - } - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol - - /** - * @title ReserveLogic library -@@ -6012,7 +6012,7 @@ library ValidationLogic { - } - } - --// downloads/MAINNET/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/logic/LiquidationLogic.sol -+// downloads/ZKSYNC/LIQUIDATION_LOGIC/LiquidationLogic/src/core/contracts/protocol/libraries/logic/LiquidationLogic.sol - - /** - * @title LiquidationLogic library + ``` diff --git a/diffs/MAINNET_ZKSYNC/ORACLE_DIFF.md b/diffs/MAINNET_ZKSYNC/ORACLE_DIFF.md index 1a75aa80..7d853fd8 100644 --- a/diffs/MAINNET_ZKSYNC/ORACLE_DIFF.md +++ b/diffs/MAINNET_ZKSYNC/ORACLE_DIFF.md @@ -3,88 +3,5 @@ diff --git a/./downloads/MAINNET/ORACLE.sol b/./downloads/ZKSYNC/ORACLE.sol index 389dfc3..a893adf 100644 --- a/./downloads/MAINNET/ORACLE.sol +++ b/./downloads/ZKSYNC/ORACLE.sol -@@ -1,7 +1,7 @@ --// SPDX-License-Identifier: BUSL-1.1 --pragma solidity =0.8.10 ^0.8.0; -+// SPDX-License-Identifier: MIT -+pragma solidity ^0.8.0 ^0.8.10; - --// downloads/MAINNET/ORACLE/AaveOracle/@aave/core-v3/contracts/dependencies/chainlink/AggregatorInterface.sol -+// downloads/ZKSYNC/ORACLE/AaveOracle/src/core/contracts/dependencies/chainlink/AggregatorInterface.sol - - // Chainlink Contracts v0.8 - -@@ -21,7 +21,7 @@ interface AggregatorInterface { - event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt); - } - --// downloads/MAINNET/ORACLE/AaveOracle/@aave/core-v3/contracts/interfaces/IPoolAddressesProvider.sol -+// downloads/ZKSYNC/ORACLE/AaveOracle/src/core/contracts/interfaces/IPoolAddressesProvider.sol - - /** - * @title IPoolAddressesProvider -@@ -248,7 +248,7 @@ interface IPoolAddressesProvider { - function setPoolDataProvider(address newDataProvider) external; - } - --// downloads/MAINNET/ORACLE/AaveOracle/@aave/core-v3/contracts/interfaces/IPriceOracleGetter.sol -+// downloads/ZKSYNC/ORACLE/AaveOracle/src/core/contracts/interfaces/IPriceOracleGetter.sol - - /** - * @title IPriceOracleGetter -@@ -278,7 +278,7 @@ interface IPriceOracleGetter { - function getAssetPrice(address asset) external view returns (uint256); - } - --// downloads/MAINNET/ORACLE/AaveOracle/@aave/core-v3/contracts/protocol/libraries/helpers/Errors.sol -+// downloads/ZKSYNC/ORACLE/AaveOracle/src/core/contracts/protocol/libraries/helpers/Errors.sol - - /** - * @title Errors library -@@ -346,7 +346,7 @@ library Errors { - string public constant PRICE_ORACLE_SENTINEL_CHECK_FAILED = '59'; // 'Price oracle sentinel validation failed' - string public constant ASSET_NOT_BORROWABLE_IN_ISOLATION = '60'; // 'Asset is not borrowable in isolation mode' - string public constant RESERVE_ALREADY_INITIALIZED = '61'; // 'Reserve has already been initialized' -- string public constant USER_IN_ISOLATION_MODE = '62'; // 'User is in isolation mode' -+ string public constant USER_IN_ISOLATION_MODE_OR_LTV_ZERO = '62'; // 'User is in isolation mode or ltv is zero' - string public constant INVALID_LTV = '63'; // 'Invalid ltv parameter for the reserve' - string public constant INVALID_LIQ_THRESHOLD = '64'; // 'Invalid liquidity threshold parameter for the reserve' - string public constant INVALID_LIQ_BONUS = '65'; // 'Invalid liquidity bonus parameter for the reserve' -@@ -376,9 +376,17 @@ library Errors { - 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 -+ string public constant INVALID_MAX_RATE = '92'; // The expect maximum borrow rate is invalid -+ string public constant WITHDRAW_TO_ATOKEN = '93'; // Withdrawing to the aToken is not allowed -+ string public constant SUPPLY_TO_ATOKEN = '94'; // Supplying to the aToken is not allowed -+ string public constant SLOPE_2_MUST_BE_GTE_SLOPE_1 = '95'; // Variable interest rate slope 2 can not be lower than slope 1 -+ string public constant CALLER_NOT_RISK_OR_POOL_OR_EMERGENCY_ADMIN = '96'; // 'The caller of the function is not a risk, pool or emergency admin' -+ 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 - } - --// downloads/MAINNET/ORACLE/AaveOracle/@aave/core-v3/contracts/interfaces/IACLManager.sol -+// downloads/ZKSYNC/ORACLE/AaveOracle/src/core/contracts/interfaces/IACLManager.sol - - /** - * @title IACLManager -@@ -551,7 +559,7 @@ interface IACLManager { - function isAssetListingAdmin(address admin) external view returns (bool); - } - --// downloads/MAINNET/ORACLE/AaveOracle/@aave/core-v3/contracts/interfaces/IAaveOracle.sol -+// downloads/ZKSYNC/ORACLE/AaveOracle/src/core/contracts/interfaces/IAaveOracle.sol - - /** - * @title IAaveOracle -@@ -619,7 +627,7 @@ interface IAaveOracle is IPriceOracleGetter { - function getFallbackOracle() external view returns (address); - } - --// downloads/MAINNET/ORACLE/AaveOracle/@aave/core-v3/contracts/misc/AaveOracle.sol -+// downloads/ZKSYNC/ORACLE/AaveOracle/src/core/contracts/misc/AaveOracle.sol - - /** - * @title AaveOracle + ``` diff --git a/diffs/MAINNET_ZKSYNC/POOL_ADDRESSES_PROVIDER_DIFF.md b/diffs/MAINNET_ZKSYNC/POOL_ADDRESSES_PROVIDER_DIFF.md index 421b6c62..7174ad39 100644 --- a/diffs/MAINNET_ZKSYNC/POOL_ADDRESSES_PROVIDER_DIFF.md +++ b/diffs/MAINNET_ZKSYNC/POOL_ADDRESSES_PROVIDER_DIFF.md @@ -3,229 +3,16 @@ diff --git a/./downloads/MAINNET/POOL_ADDRESSES_PROVIDER.sol b/./downloads/ZKSYN index f6ec86b..7b370c5 100644 --- a/./downloads/MAINNET/POOL_ADDRESSES_PROVIDER.sol +++ b/./downloads/ZKSYNC/POOL_ADDRESSES_PROVIDER.sol -@@ -1,7 +1,9 @@ - // SPDX-License-Identifier: BUSL-1.1 --pragma solidity =0.8.10 ^0.8.0; -+pragma solidity ^0.8.0 ^0.8.10; - --// downloads/MAINNET/POOL_ADDRESSES_PROVIDER/PoolAddressesProvider/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/Address.sol -+// downloads/ZKSYNC/POOL_ADDRESSES_PROVIDER/PoolAddressesProvider/src/core/contracts/dependencies/openzeppelin/contracts/Address.sol -+ -+// OpenZeppelin Contracts v4.4.1 (utils/Address.sol) - - /** - * @dev Collection of functions related to the address type -@@ -25,16 +27,15 @@ library Address { - * ==== - */ - function isContract(address account) internal view returns (bool) { -- // According to EIP-1052, 0x0 is the value returned for not-yet created accounts -- // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned -- // for accounts without code, i.e. `keccak256('')` -- bytes32 codehash; -- bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; -- // solhint-disable-next-line no-inline-assembly -+ // This method relies on extcodesize, which returns 0 for contracts in -+ // construction, since the code is only stored at the end of the -+ // constructor execution. -+ -+ uint256 size; - assembly { -- codehash := extcodehash(account) -+ size := extcodesize(account) - } -- return (codehash != accountHash && codehash != 0x0); -+ return size > 0; - } - - /** -@@ -56,13 +57,171 @@ library Address { - function sendValue(address payable recipient, uint256 amount) internal { - require(address(this).balance >= amount, 'Address: insufficient balance'); - -- // solhint-disable-next-line avoid-low-level-calls, avoid-call-value - (bool success, ) = recipient.call{value: amount}(''); - require(success, 'Address: unable to send value, recipient may have reverted'); - } -+ -+ /** -+ * @dev Performs a Solidity function call using a low level `call`. A -+ * plain `call` is an unsafe replacement for a function call: use this -+ * function instead. -+ * -+ * If `target` reverts with a revert reason, it is bubbled up by this -+ * function (like regular Solidity function calls). -+ * -+ * Returns the raw returned data. To convert to the expected return value, -+ * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. -+ * -+ * Requirements: -+ * -+ * - `target` must be a contract. -+ * - calling `target` with `data` must not revert. -+ * -+ * _Available since v3.1._ -+ */ -+ function functionCall(address target, bytes memory data) internal returns (bytes memory) { -+ return functionCall(target, data, 'Address: low-level call failed'); -+ } -+ -+ /** -+ * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with -+ * `errorMessage` as a fallback revert reason when `target` reverts. -+ * -+ * _Available since v3.1._ -+ */ -+ function functionCall( -+ address target, -+ bytes memory data, -+ string memory errorMessage -+ ) internal returns (bytes memory) { -+ return functionCallWithValue(target, data, 0, errorMessage); -+ } -+ -+ /** -+ * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], -+ * but also transferring `value` wei to `target`. -+ * -+ * Requirements: -+ * -+ * - the calling contract must have an ETH balance of at least `value`. -+ * - the called Solidity function must be `payable`. -+ * -+ * _Available since v3.1._ -+ */ -+ function functionCallWithValue( -+ address target, -+ bytes memory data, -+ uint256 value -+ ) internal returns (bytes memory) { -+ return functionCallWithValue(target, data, value, 'Address: low-level call with value failed'); -+ } -+ -+ /** -+ * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but -+ * with `errorMessage` as a fallback revert reason when `target` reverts. -+ * -+ * _Available since v3.1._ -+ */ -+ function functionCallWithValue( -+ address target, -+ bytes memory data, -+ uint256 value, -+ string memory errorMessage -+ ) internal returns (bytes memory) { -+ require(address(this).balance >= value, 'Address: insufficient balance for call'); -+ require(isContract(target), 'Address: call to non-contract'); -+ -+ (bool success, bytes memory returndata) = target.call{value: value}(data); -+ return verifyCallResult(success, returndata, errorMessage); -+ } -+ -+ /** -+ * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], -+ * but performing a static call. -+ * -+ * _Available since v3.3._ -+ */ -+ function functionStaticCall( -+ address target, -+ bytes memory data -+ ) internal view returns (bytes memory) { -+ return functionStaticCall(target, data, 'Address: low-level static call failed'); -+ } -+ -+ /** -+ * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], -+ * but performing a static call. -+ * -+ * _Available since v3.3._ -+ */ -+ function functionStaticCall( -+ address target, -+ bytes memory data, -+ string memory errorMessage -+ ) internal view returns (bytes memory) { -+ require(isContract(target), 'Address: static call to non-contract'); -+ -+ (bool success, bytes memory returndata) = target.staticcall(data); -+ return verifyCallResult(success, returndata, errorMessage); -+ } -+ -+ /** -+ * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], -+ * but performing a delegate call. -+ * -+ * _Available since v3.4._ -+ */ -+ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { -+ return functionDelegateCall(target, data, 'Address: low-level delegate call failed'); -+ } -+ -+ /** -+ * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], -+ * but performing a delegate call. -+ * -+ * _Available since v3.4._ -+ */ -+ function functionDelegateCall( -+ address target, -+ bytes memory data, -+ string memory errorMessage -+ ) internal returns (bytes memory) { -+ require(isContract(target), 'Address: delegate call to non-contract'); -+ -+ (bool success, bytes memory returndata) = target.delegatecall(data); -+ return verifyCallResult(success, returndata, errorMessage); -+ } -+ -+ /** -+ * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the -+ * revert reason using the provided one. -+ * -+ * _Available since v4.3._ -+ */ -+ function verifyCallResult( -+ bool success, -+ bytes memory returndata, -+ string memory errorMessage -+ ) internal pure returns (bytes memory) { -+ if (success) { -+ return returndata; -+ } else { -+ // Look for revert reason and bubble it up if present -+ if (returndata.length > 0) { -+ // The easiest way to bubble the revert reason is using memory via assembly -+ -+ assembly { -+ let returndata_size := mload(returndata) -+ revert(add(32, returndata), returndata_size) -+ } -+ } else { -+ revert(errorMessage); -+ } -+ } -+ } - } - --// downloads/MAINNET/POOL_ADDRESSES_PROVIDER/PoolAddressesProvider/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/Context.sol -+// downloads/ZKSYNC/POOL_ADDRESSES_PROVIDER/PoolAddressesProvider/src/core/contracts/dependencies/openzeppelin/contracts/Context.sol - - /* - * @dev Provides information about the current execution context, including the -@@ -85,7 +244,7 @@ abstract contract Context { - } - } - + -// downloads/MAINNET/POOL_ADDRESSES_PROVIDER/PoolAddressesProvider/@aave/core-v3/contracts/dependencies/openzeppelin/upgradeability/Proxy.sol +// downloads/ZKSYNC/POOL_ADDRESSES_PROVIDER/PoolAddressesProvider/src/core/contracts/dependencies/openzeppelin/upgradeability/Proxy.sol - + /** * @title Proxy @@ -104,6 +263,14 @@ abstract contract Proxy { _fallback(); } - + + /** + * @dev Fallback function that will run if call data is empty. + * IMPORTANT. receive() on implementation contracts will be unreachable @@ -240,50 +27,14 @@ index f6ec86b..7b370c5 100644 @@ -158,7 +325,7 @@ abstract contract Proxy { } } - --// downloads/MAINNET/POOL_ADDRESSES_PROVIDER/PoolAddressesProvider/@aave/core-v3/contracts/interfaces/IPoolAddressesProvider.sol -+// downloads/ZKSYNC/POOL_ADDRESSES_PROVIDER/PoolAddressesProvider/src/core/contracts/interfaces/IPoolAddressesProvider.sol - - /** - * @title IPoolAddressesProvider -@@ -385,7 +552,7 @@ interface IPoolAddressesProvider { - function setPoolDataProvider(address newDataProvider) external; - } - --// downloads/MAINNET/POOL_ADDRESSES_PROVIDER/PoolAddressesProvider/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/Ownable.sol -+// downloads/ZKSYNC/POOL_ADDRESSES_PROVIDER/PoolAddressesProvider/src/core/contracts/dependencies/openzeppelin/contracts/Ownable.sol - - /** - * @dev Contract module which provides a basic access control mechanism, where -@@ -451,7 +618,7 @@ contract Ownable is Context { - } - } - --// downloads/MAINNET/POOL_ADDRESSES_PROVIDER/PoolAddressesProvider/@aave/core-v3/contracts/dependencies/openzeppelin/upgradeability/BaseUpgradeabilityProxy.sol -+// downloads/ZKSYNC/POOL_ADDRESSES_PROVIDER/PoolAddressesProvider/src/core/contracts/dependencies/openzeppelin/upgradeability/BaseUpgradeabilityProxy.sol - - /** - * @title BaseUpgradeabilityProxy -@@ -514,7 +681,7 @@ contract BaseUpgradeabilityProxy is Proxy { - } - } - --// downloads/MAINNET/POOL_ADDRESSES_PROVIDER/PoolAddressesProvider/@aave/core-v3/contracts/dependencies/openzeppelin/upgradeability/InitializableUpgradeabilityProxy.sol -+// downloads/ZKSYNC/POOL_ADDRESSES_PROVIDER/PoolAddressesProvider/src/core/contracts/dependencies/openzeppelin/upgradeability/InitializableUpgradeabilityProxy.sol - - /** - * @title InitializableUpgradeabilityProxy -@@ -541,7 +708,7 @@ contract InitializableUpgradeabilityProxy is BaseUpgradeabilityProxy { - } - } - + -// downloads/MAINNET/POOL_ADDRESSES_PROVIDER/PoolAddressesProvider/@aave/core-v3/contracts/protocol/libraries/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol +// downloads/ZKSYNC/POOL_ADDRESSES_PROVIDER/PoolAddressesProvider/src/core/contracts/protocol/libraries/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol - + /** * @title BaseImmutableAdminUpgradeabilityProxy @@ -558,10 +725,10 @@ contract BaseImmutableAdminUpgradeabilityProxy is BaseUpgradeabilityProxy { - + /** * @dev Constructor. - * @param admin The address of the admin @@ -294,24 +45,9 @@ index f6ec86b..7b370c5 100644 + constructor(address admin_) { + _admin = admin_; } - + modifier ifAdmin() { @@ -624,7 +791,7 @@ contract BaseImmutableAdminUpgradeabilityProxy is BaseUpgradeabilityProxy { } } - --// downloads/MAINNET/POOL_ADDRESSES_PROVIDER/PoolAddressesProvider/@aave/core-v3/contracts/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol -+// downloads/ZKSYNC/POOL_ADDRESSES_PROVIDER/PoolAddressesProvider/src/core/contracts/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol - - /** - * @title InitializableAdminUpgradeabilityProxy -@@ -649,7 +816,7 @@ contract InitializableImmutableAdminUpgradeabilityProxy is - } - } - --// downloads/MAINNET/POOL_ADDRESSES_PROVIDER/PoolAddressesProvider/@aave/core-v3/contracts/protocol/configuration/PoolAddressesProvider.sol -+// downloads/ZKSYNC/POOL_ADDRESSES_PROVIDER/PoolAddressesProvider/src/core/contracts/protocol/configuration/PoolAddressesProvider.sol - - /** - * @title PoolAddressesProvider ``` diff --git a/diffs/MAINNET_ZKSYNC/POOL_ADDRESSES_PROVIDER_REGISTRY_DIFF.md b/diffs/MAINNET_ZKSYNC/POOL_ADDRESSES_PROVIDER_REGISTRY_DIFF.md index d60d227b..8f3d2ca3 100644 --- a/diffs/MAINNET_ZKSYNC/POOL_ADDRESSES_PROVIDER_REGISTRY_DIFF.md +++ b/diffs/MAINNET_ZKSYNC/POOL_ADDRESSES_PROVIDER_REGISTRY_DIFF.md @@ -3,69 +3,5 @@ diff --git a/./downloads/MAINNET/POOL_ADDRESSES_PROVIDER_REGISTRY.sol b/./downlo index 82267cb..84a6931 100644 --- a/./downloads/MAINNET/POOL_ADDRESSES_PROVIDER_REGISTRY.sol +++ b/./downloads/ZKSYNC/POOL_ADDRESSES_PROVIDER_REGISTRY.sol -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: BUSL-1.1 --pragma solidity =0.8.10 ^0.8.0; -+pragma solidity ^0.8.0 ^0.8.10; - --// downloads/MAINNET/POOL_ADDRESSES_PROVIDER_REGISTRY/PoolAddressesProviderRegistry/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/Context.sol -+// downloads/ZKSYNC/POOL_ADDRESSES_PROVIDER_REGISTRY/PoolAddressesProviderRegistry/src/core/contracts/dependencies/openzeppelin/contracts/Context.sol - - /* - * @dev Provides information about the current execution context, including the -@@ -24,7 +24,7 @@ abstract contract Context { - } - } - --// downloads/MAINNET/POOL_ADDRESSES_PROVIDER_REGISTRY/PoolAddressesProviderRegistry/@aave/core-v3/contracts/interfaces/IPoolAddressesProviderRegistry.sol -+// downloads/ZKSYNC/POOL_ADDRESSES_PROVIDER_REGISTRY/PoolAddressesProviderRegistry/src/core/contracts/interfaces/IPoolAddressesProviderRegistry.sol - - /** - * @title IPoolAddressesProviderRegistry -@@ -84,7 +84,7 @@ interface IPoolAddressesProviderRegistry { - function unregisterAddressesProvider(address provider) external; - } - --// downloads/MAINNET/POOL_ADDRESSES_PROVIDER_REGISTRY/PoolAddressesProviderRegistry/@aave/core-v3/contracts/protocol/libraries/helpers/Errors.sol -+// downloads/ZKSYNC/POOL_ADDRESSES_PROVIDER_REGISTRY/PoolAddressesProviderRegistry/src/core/contracts/protocol/libraries/helpers/Errors.sol - - /** - * @title Errors library -@@ -152,7 +152,7 @@ library Errors { - string public constant PRICE_ORACLE_SENTINEL_CHECK_FAILED = '59'; // 'Price oracle sentinel validation failed' - string public constant ASSET_NOT_BORROWABLE_IN_ISOLATION = '60'; // 'Asset is not borrowable in isolation mode' - string public constant RESERVE_ALREADY_INITIALIZED = '61'; // 'Reserve has already been initialized' -- string public constant USER_IN_ISOLATION_MODE = '62'; // 'User is in isolation mode' -+ string public constant USER_IN_ISOLATION_MODE_OR_LTV_ZERO = '62'; // 'User is in isolation mode or ltv is zero' - string public constant INVALID_LTV = '63'; // 'Invalid ltv parameter for the reserve' - string public constant INVALID_LIQ_THRESHOLD = '64'; // 'Invalid liquidity threshold parameter for the reserve' - string public constant INVALID_LIQ_BONUS = '65'; // 'Invalid liquidity bonus parameter for the reserve' -@@ -182,9 +182,17 @@ library Errors { - 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 -+ string public constant INVALID_MAX_RATE = '92'; // The expect maximum borrow rate is invalid -+ string public constant WITHDRAW_TO_ATOKEN = '93'; // Withdrawing to the aToken is not allowed -+ string public constant SUPPLY_TO_ATOKEN = '94'; // Supplying to the aToken is not allowed -+ string public constant SLOPE_2_MUST_BE_GTE_SLOPE_1 = '95'; // Variable interest rate slope 2 can not be lower than slope 1 -+ string public constant CALLER_NOT_RISK_OR_POOL_OR_EMERGENCY_ADMIN = '96'; // 'The caller of the function is not a risk, pool or emergency admin' -+ 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 - } - --// downloads/MAINNET/POOL_ADDRESSES_PROVIDER_REGISTRY/PoolAddressesProviderRegistry/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/Ownable.sol -+// downloads/ZKSYNC/POOL_ADDRESSES_PROVIDER_REGISTRY/PoolAddressesProviderRegistry/src/core/contracts/dependencies/openzeppelin/contracts/Ownable.sol - - /** - * @dev Contract module which provides a basic access control mechanism, where -@@ -250,7 +258,7 @@ contract Ownable is Context { - } - } - --// downloads/MAINNET/POOL_ADDRESSES_PROVIDER_REGISTRY/PoolAddressesProviderRegistry/@aave/core-v3/contracts/protocol/configuration/PoolAddressesProviderRegistry.sol -+// downloads/ZKSYNC/POOL_ADDRESSES_PROVIDER_REGISTRY/PoolAddressesProviderRegistry/src/core/contracts/protocol/configuration/PoolAddressesProviderRegistry.sol - - /** - * @title PoolAddressesProviderRegistry + ``` diff --git a/diffs/MAINNET_ZKSYNC/POOL_CONFIGURATOR_IMPL_DIFF.md b/diffs/MAINNET_ZKSYNC/POOL_CONFIGURATOR_IMPL_DIFF.md index ab1acdea..aa329730 100644 --- a/diffs/MAINNET_ZKSYNC/POOL_CONFIGURATOR_IMPL_DIFF.md +++ b/diffs/MAINNET_ZKSYNC/POOL_CONFIGURATOR_IMPL_DIFF.md @@ -3,13 +3,5 @@ diff --git a/./downloads/MAINNET/POOL_CONFIGURATOR_IMPL.sol b/./downloads/ZKSYNC index 4d13939..ff9e514 100644 --- a/./downloads/MAINNET/POOL_CONFIGURATOR_IMPL.sol +++ b/./downloads/ZKSYNC/POOL_CONFIGURATOR_IMPL.sol -@@ -5104,7 +5104,7 @@ abstract contract PoolConfigurator is VersionedInitializable, IPoolConfigurator - } - } - --// downloads/MAINNET/POOL_CONFIGURATOR_IMPL/PoolConfiguratorInstance/lib/aave-v3-origin/src/core/instances/PoolConfiguratorInstance.sol -+// downloads/ZKSYNC/POOL_CONFIGURATOR_IMPL/PoolConfiguratorInstance/src/core/instances/PoolConfiguratorInstance.sol - - contract PoolConfiguratorInstance is PoolConfigurator { - uint256 public constant CONFIGURATOR_REVISION = 3; + ``` diff --git a/diffs/MAINNET_ZKSYNC/POOL_LOGIC_DIFF.md b/diffs/MAINNET_ZKSYNC/POOL_LOGIC_DIFF.md index c379b42e..029bd863 100644 --- a/diffs/MAINNET_ZKSYNC/POOL_LOGIC_DIFF.md +++ b/diffs/MAINNET_ZKSYNC/POOL_LOGIC_DIFF.md @@ -3,301 +3,5 @@ diff --git a/./downloads/MAINNET/POOL_LOGIC.sol b/./downloads/ZKSYNC/POOL_LOGIC. index 5517e96..43c9a27 100644 --- a/./downloads/MAINNET/POOL_LOGIC.sol +++ b/./downloads/ZKSYNC/POOL_LOGIC.sol -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: BUSL-1.1 - pragma solidity ^0.8.0 ^0.8.10; - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/dependencies/openzeppelin/contracts/Address.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/dependencies/openzeppelin/contracts/Address.sol - - // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) - -@@ -221,7 +221,7 @@ library Address { - } - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/dependencies/openzeppelin/contracts/Context.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/dependencies/openzeppelin/contracts/Context.sol - - /* - * @dev Provides information about the current execution context, including the -@@ -244,7 +244,7 @@ abstract contract Context { - } - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/dependencies/openzeppelin/contracts/IAccessControl.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/dependencies/openzeppelin/contracts/IAccessControl.sol - - /** - * @dev External interface of AccessControl declared to support ERC165 detection. -@@ -334,7 +334,7 @@ interface IAccessControl { - function renounceRole(bytes32 role, address account) external; - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol - - /** - * @dev Interface of the ERC20 standard as defined in the EIP. -@@ -410,7 +410,7 @@ interface IERC20 { - event Approval(address indexed owner, address indexed spender, uint256 value); - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol - - // OpenZeppelin Contracts v4.4.1 (utils/math/SafeCast.sol) - -@@ -666,7 +666,7 @@ library SafeCast { - } - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/interfaces/IAaveIncentivesController.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/interfaces/IAaveIncentivesController.sol - - /** - * @title IAaveIncentivesController -@@ -685,7 +685,7 @@ interface IAaveIncentivesController { - function handleAction(address user, uint256 totalSupply, uint256 userBalance) external; - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/interfaces/IPoolAddressesProvider.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/interfaces/IPoolAddressesProvider.sol - - /** - * @title IPoolAddressesProvider -@@ -912,7 +912,7 @@ interface IPoolAddressesProvider { - function setPoolDataProvider(address newDataProvider) external; - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/interfaces/IPriceOracleGetter.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/interfaces/IPriceOracleGetter.sol - - /** - * @title IPriceOracleGetter -@@ -942,7 +942,7 @@ interface IPriceOracleGetter { - function getAssetPrice(address asset) external view returns (uint256); - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/interfaces/IScaledBalanceToken.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/interfaces/IScaledBalanceToken.sol - - /** - * @title IScaledBalanceToken -@@ -1014,7 +1014,7 @@ interface IScaledBalanceToken { - function getPreviousIndex(address user) external view returns (uint256); - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/protocol/libraries/helpers/Errors.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/protocol/libraries/helpers/Errors.sol - - /** - * @title Errors library -@@ -1122,7 +1122,7 @@ library Errors { - string public constant INVALID_FREEZE_STATE = '99'; // Reserve is already in the passed freeze state - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/protocol/libraries/math/PercentageMath.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/protocol/libraries/math/PercentageMath.sol - - /** - * @title PercentageMath library -@@ -1183,7 +1183,7 @@ library PercentageMath { - } - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/protocol/libraries/math/WadRayMath.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/protocol/libraries/math/WadRayMath.sol - - /** - * @title WadRayMath library -@@ -1309,7 +1309,7 @@ library WadRayMath { - } - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/protocol/libraries/types/DataTypes.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/protocol/libraries/types/DataTypes.sol - - library DataTypes { - /** -@@ -1622,7 +1622,7 @@ library DataTypes { - } - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol - - /// @title Gnosis Protocol v2 Safe ERC20 Transfer Library - /// @author Gnosis Developers -@@ -1735,7 +1735,7 @@ library GPv2SafeERC20 { - } - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol - - interface IERC20Detailed is IERC20 { - function name() external view returns (string memory); -@@ -1745,7 +1745,7 @@ interface IERC20Detailed is IERC20 { - function decimals() external view returns (uint8); - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/interfaces/IACLManager.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/interfaces/IACLManager.sol - - /** - * @title IACLManager -@@ -1918,7 +1918,7 @@ interface IACLManager { - function isAssetListingAdmin(address admin) external view returns (bool); - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/interfaces/IPriceOracleSentinel.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/interfaces/IPriceOracleSentinel.sol - - /** - * @title IPriceOracleSentinel -@@ -1983,7 +1983,7 @@ interface IPriceOracleSentinel { - function getGracePeriod() external view returns (uint256); - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/interfaces/IReserveInterestRateStrategy.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/interfaces/IReserveInterestRateStrategy.sol - - /** - * @title IReserveInterestRateStrategy -@@ -2011,7 +2011,7 @@ interface IReserveInterestRateStrategy { - ) external view returns (uint256, uint256, uint256); - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/protocol/libraries/math/MathUtils.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/protocol/libraries/math/MathUtils.sol - - /** - * @title MathUtils library -@@ -2108,7 +2108,7 @@ library MathUtils { - } - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/interfaces/IPool.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/interfaces/IPool.sol - - /** - * @title IPool -@@ -2940,7 +2940,7 @@ interface IPool { - function getSupplyLogic() external returns (address); - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol - - /** - * @title ReserveConfiguration library -@@ -3577,7 +3577,7 @@ library ReserveConfiguration { - } - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/protocol/libraries/configuration/UserConfiguration.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/protocol/libraries/configuration/UserConfiguration.sol - - /** - * @title UserConfiguration library -@@ -3809,7 +3809,7 @@ library UserConfiguration { - } - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/interfaces/IInitializableAToken.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/interfaces/IInitializableAToken.sol - - /** - * @title IInitializableAToken -@@ -3862,7 +3862,7 @@ interface IInitializableAToken { - ) external; - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/interfaces/IInitializableDebtToken.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/interfaces/IInitializableDebtToken.sol - - /** - * @title IInitializableDebtToken -@@ -3911,7 +3911,7 @@ interface IInitializableDebtToken { - ) external; - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/interfaces/IStableDebtToken.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/interfaces/IStableDebtToken.sol - - /** - * @title IStableDebtToken -@@ -4048,7 +4048,7 @@ interface IStableDebtToken is IInitializableDebtToken { - function UNDERLYING_ASSET_ADDRESS() external view returns (address); - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/interfaces/IVariableDebtToken.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/interfaces/IVariableDebtToken.sol - - /** - * @title IVariableDebtToken -@@ -4091,7 +4091,7 @@ interface IVariableDebtToken is IScaledBalanceToken, IInitializableDebtToken { - function UNDERLYING_ASSET_ADDRESS() external view returns (address); - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/interfaces/IAToken.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/interfaces/IAToken.sol - - /** - * @title IAToken -@@ -4225,7 +4225,7 @@ interface IAToken is IERC20, IScaledBalanceToken, IInitializableAToken { - function rescueTokens(address token, address to, uint256 amount) external; - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol - - /** - * @title IncentivizedERC20 -@@ -4449,7 +4449,7 @@ abstract contract IncentivizedERC20 is Context, IERC20Detailed { - } - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/protocol/libraries/logic/ReserveLogic.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/protocol/libraries/logic/ReserveLogic.sol - - /** - * @title ReserveLogic library -@@ -4809,7 +4809,7 @@ library ReserveLogic { - } - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/protocol/libraries/logic/EModeLogic.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/protocol/libraries/logic/EModeLogic.sol - - /** - * @title EModeLogic library -@@ -4910,7 +4910,7 @@ library EModeLogic { - } - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/protocol/libraries/logic/GenericLogic.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/protocol/libraries/logic/GenericLogic.sol - - /** - * @title GenericLogic library -@@ -5168,7 +5168,7 @@ library GenericLogic { - } - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol - - /** - * @title ReserveLogic library -@@ -5928,7 +5928,7 @@ library ValidationLogic { - } - } - --// downloads/MAINNET/POOL_LOGIC/PoolLogic/src/core/contracts/protocol/libraries/logic/PoolLogic.sol -+// downloads/ZKSYNC/POOL_LOGIC/PoolLogic/src/core/contracts/protocol/libraries/logic/PoolLogic.sol - - /** - * @title PoolLogic library + ``` diff --git a/diffs/MAINNET_ZKSYNC/SUPPLY_LOGIC_DIFF.md b/diffs/MAINNET_ZKSYNC/SUPPLY_LOGIC_DIFF.md index fe2a9d8d..dbfe6e5d 100644 --- a/diffs/MAINNET_ZKSYNC/SUPPLY_LOGIC_DIFF.md +++ b/diffs/MAINNET_ZKSYNC/SUPPLY_LOGIC_DIFF.md @@ -3,301 +3,5 @@ diff --git a/./downloads/MAINNET/SUPPLY_LOGIC.sol b/./downloads/ZKSYNC/SUPPLY_LO index db8902c..5e3116d 100644 --- a/./downloads/MAINNET/SUPPLY_LOGIC.sol +++ b/./downloads/ZKSYNC/SUPPLY_LOGIC.sol -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: BUSL-1.1 - pragma solidity ^0.8.0 ^0.8.10; - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/dependencies/openzeppelin/contracts/Address.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/dependencies/openzeppelin/contracts/Address.sol - - // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) - -@@ -221,7 +221,7 @@ library Address { - } - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/dependencies/openzeppelin/contracts/Context.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/dependencies/openzeppelin/contracts/Context.sol - - /* - * @dev Provides information about the current execution context, including the -@@ -244,7 +244,7 @@ abstract contract Context { - } - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/dependencies/openzeppelin/contracts/IAccessControl.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/dependencies/openzeppelin/contracts/IAccessControl.sol - - /** - * @dev External interface of AccessControl declared to support ERC165 detection. -@@ -334,7 +334,7 @@ interface IAccessControl { - function renounceRole(bytes32 role, address account) external; - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol - - /** - * @dev Interface of the ERC20 standard as defined in the EIP. -@@ -410,7 +410,7 @@ interface IERC20 { - event Approval(address indexed owner, address indexed spender, uint256 value); - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol - - // OpenZeppelin Contracts v4.4.1 (utils/math/SafeCast.sol) - -@@ -666,7 +666,7 @@ library SafeCast { - } - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/interfaces/IAaveIncentivesController.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/interfaces/IAaveIncentivesController.sol - - /** - * @title IAaveIncentivesController -@@ -685,7 +685,7 @@ interface IAaveIncentivesController { - function handleAction(address user, uint256 totalSupply, uint256 userBalance) external; - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/interfaces/IPoolAddressesProvider.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/interfaces/IPoolAddressesProvider.sol - - /** - * @title IPoolAddressesProvider -@@ -912,7 +912,7 @@ interface IPoolAddressesProvider { - function setPoolDataProvider(address newDataProvider) external; - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/interfaces/IPriceOracleGetter.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/interfaces/IPriceOracleGetter.sol - - /** - * @title IPriceOracleGetter -@@ -942,7 +942,7 @@ interface IPriceOracleGetter { - function getAssetPrice(address asset) external view returns (uint256); - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/interfaces/IScaledBalanceToken.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/interfaces/IScaledBalanceToken.sol - - /** - * @title IScaledBalanceToken -@@ -1014,7 +1014,7 @@ interface IScaledBalanceToken { - function getPreviousIndex(address user) external view returns (uint256); - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/protocol/libraries/helpers/Errors.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/protocol/libraries/helpers/Errors.sol - - /** - * @title Errors library -@@ -1122,7 +1122,7 @@ library Errors { - string public constant INVALID_FREEZE_STATE = '99'; // Reserve is already in the passed freeze state - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/protocol/libraries/math/PercentageMath.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/protocol/libraries/math/PercentageMath.sol - - /** - * @title PercentageMath library -@@ -1183,7 +1183,7 @@ library PercentageMath { - } - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/protocol/libraries/math/WadRayMath.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/protocol/libraries/math/WadRayMath.sol - - /** - * @title WadRayMath library -@@ -1309,7 +1309,7 @@ library WadRayMath { - } - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/protocol/libraries/types/DataTypes.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/protocol/libraries/types/DataTypes.sol - - library DataTypes { - /** -@@ -1622,7 +1622,7 @@ library DataTypes { - } - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol - - /// @title Gnosis Protocol v2 Safe ERC20 Transfer Library - /// @author Gnosis Developers -@@ -1735,7 +1735,7 @@ library GPv2SafeERC20 { - } - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol - - interface IERC20Detailed is IERC20 { - function name() external view returns (string memory); -@@ -1745,7 +1745,7 @@ interface IERC20Detailed is IERC20 { - function decimals() external view returns (uint8); - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/interfaces/IACLManager.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/interfaces/IACLManager.sol - - /** - * @title IACLManager -@@ -1918,7 +1918,7 @@ interface IACLManager { - function isAssetListingAdmin(address admin) external view returns (bool); - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/interfaces/IPriceOracleSentinel.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/interfaces/IPriceOracleSentinel.sol - - /** - * @title IPriceOracleSentinel -@@ -1983,7 +1983,7 @@ interface IPriceOracleSentinel { - function getGracePeriod() external view returns (uint256); - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/interfaces/IReserveInterestRateStrategy.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/interfaces/IReserveInterestRateStrategy.sol - - /** - * @title IReserveInterestRateStrategy -@@ -2011,7 +2011,7 @@ interface IReserveInterestRateStrategy { - ) external view returns (uint256, uint256, uint256); - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/protocol/libraries/math/MathUtils.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/protocol/libraries/math/MathUtils.sol - - /** - * @title MathUtils library -@@ -2108,7 +2108,7 @@ library MathUtils { - } - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/interfaces/IPool.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/interfaces/IPool.sol - - /** - * @title IPool -@@ -2940,7 +2940,7 @@ interface IPool { - function getSupplyLogic() external returns (address); - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol - - /** - * @title ReserveConfiguration library -@@ -3577,7 +3577,7 @@ library ReserveConfiguration { - } - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/protocol/libraries/configuration/UserConfiguration.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/protocol/libraries/configuration/UserConfiguration.sol - - /** - * @title UserConfiguration library -@@ -3809,7 +3809,7 @@ library UserConfiguration { - } - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/interfaces/IInitializableAToken.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/interfaces/IInitializableAToken.sol - - /** - * @title IInitializableAToken -@@ -3862,7 +3862,7 @@ interface IInitializableAToken { - ) external; - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/interfaces/IInitializableDebtToken.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/interfaces/IInitializableDebtToken.sol - - /** - * @title IInitializableDebtToken -@@ -3911,7 +3911,7 @@ interface IInitializableDebtToken { - ) external; - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/interfaces/IStableDebtToken.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/interfaces/IStableDebtToken.sol - - /** - * @title IStableDebtToken -@@ -4048,7 +4048,7 @@ interface IStableDebtToken is IInitializableDebtToken { - function UNDERLYING_ASSET_ADDRESS() external view returns (address); - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/interfaces/IVariableDebtToken.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/interfaces/IVariableDebtToken.sol - - /** - * @title IVariableDebtToken -@@ -4091,7 +4091,7 @@ interface IVariableDebtToken is IScaledBalanceToken, IInitializableDebtToken { - function UNDERLYING_ASSET_ADDRESS() external view returns (address); - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/interfaces/IAToken.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/interfaces/IAToken.sol - - /** - * @title IAToken -@@ -4225,7 +4225,7 @@ interface IAToken is IERC20, IScaledBalanceToken, IInitializableAToken { - function rescueTokens(address token, address to, uint256 amount) external; - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol - - /** - * @title IncentivizedERC20 -@@ -4449,7 +4449,7 @@ abstract contract IncentivizedERC20 is Context, IERC20Detailed { - } - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/protocol/libraries/logic/ReserveLogic.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/protocol/libraries/logic/ReserveLogic.sol - - /** - * @title ReserveLogic library -@@ -4809,7 +4809,7 @@ library ReserveLogic { - } - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/protocol/libraries/logic/EModeLogic.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/protocol/libraries/logic/EModeLogic.sol - - /** - * @title EModeLogic library -@@ -4910,7 +4910,7 @@ library EModeLogic { - } - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/protocol/libraries/logic/GenericLogic.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/protocol/libraries/logic/GenericLogic.sol - - /** - * @title GenericLogic library -@@ -5168,7 +5168,7 @@ library GenericLogic { - } - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/protocol/libraries/logic/ValidationLogic.sol - - /** - * @title ReserveLogic library -@@ -5928,7 +5928,7 @@ library ValidationLogic { - } - } - --// downloads/MAINNET/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/protocol/libraries/logic/SupplyLogic.sol -+// downloads/ZKSYNC/SUPPLY_LOGIC/SupplyLogic/src/core/contracts/protocol/libraries/logic/SupplyLogic.sol - - /** - * @title SupplyLogic library + ``` diff --git a/diffs/MAINNET_ZKSYNC/UI_INCENTIVE_DATA_PROVIDER_DIFF.md b/diffs/MAINNET_ZKSYNC/UI_INCENTIVE_DATA_PROVIDER_DIFF.md index a41238b8..359e941d 100644 --- a/diffs/MAINNET_ZKSYNC/UI_INCENTIVE_DATA_PROVIDER_DIFF.md +++ b/diffs/MAINNET_ZKSYNC/UI_INCENTIVE_DATA_PROVIDER_DIFF.md @@ -3,1167 +3,10 @@ diff --git a/./downloads/MAINNET/UI_INCENTIVE_DATA_PROVIDER.sol b/./downloads/ZK index df8b21f..8a55fee 100644 --- a/./downloads/MAINNET/UI_INCENTIVE_DATA_PROVIDER.sol +++ b/./downloads/ZKSYNC/UI_INCENTIVE_DATA_PROVIDER.sol -@@ -1,7 +1,241 @@ --// SPDX-License-Identifier: AGPL-3.0 --pragma solidity =0.8.10 ^0.8.0 ^0.8.10; -+// SPDX-License-Identifier: BUSL-1.1 -+pragma solidity ^0.8.0 ^0.8.10; - --// downloads/MAINNET/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/Context.sol -+// downloads/ZKSYNC/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/src/periphery/contracts/misc/interfaces/IEACAggregatorProxy.sol -+ -+interface IEACAggregatorProxy { -+ function decimals() external view returns (uint8); -+ -+ function latestAnswer() external view returns (int256); -+ -+ function latestTimestamp() external view returns (uint256); -+ -+ function latestRound() external view returns (uint256); -+ -+ function getAnswer(uint256 roundId) external view returns (int256); -+ -+ function getTimestamp(uint256 roundId) external view returns (uint256); -+ -+ event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 timestamp); -+ event NewRound(uint256 indexed roundId, address indexed startedBy); -+} -+ -+// downloads/ZKSYNC/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/src/periphery/contracts/rewards/interfaces/IRewardsDistributor.sol -+ -+/** -+ * @title IRewardsDistributor -+ * @author Aave -+ * @notice Defines the basic interface for a Rewards Distributor. -+ */ -+interface IRewardsDistributor { -+ /** -+ * @dev Emitted when the configuration of the rewards of an asset is updated. -+ * @param asset The address of the incentivized asset -+ * @param reward The address of the reward token -+ * @param oldEmission The old emissions per second value of the reward distribution -+ * @param newEmission The new emissions per second value of the reward distribution -+ * @param oldDistributionEnd The old end timestamp of the reward distribution -+ * @param newDistributionEnd The new end timestamp of the reward distribution -+ * @param assetIndex The index of the asset distribution -+ */ -+ event AssetConfigUpdated( -+ address indexed asset, -+ address indexed reward, -+ uint256 oldEmission, -+ uint256 newEmission, -+ uint256 oldDistributionEnd, -+ uint256 newDistributionEnd, -+ uint256 assetIndex -+ ); -+ -+ /** -+ * @dev Emitted when rewards of an asset are accrued on behalf of a user. -+ * @param asset The address of the incentivized asset -+ * @param reward The address of the reward token -+ * @param user The address of the user that rewards are accrued on behalf of -+ * @param assetIndex The index of the asset distribution -+ * @param userIndex The index of the asset distribution on behalf of the user -+ * @param rewardsAccrued The amount of rewards accrued -+ */ -+ event Accrued( -+ address indexed asset, -+ address indexed reward, -+ address indexed user, -+ uint256 assetIndex, -+ uint256 userIndex, -+ uint256 rewardsAccrued -+ ); -+ -+ /** -+ * @dev Sets the end date for the distribution -+ * @param asset The asset to incentivize -+ * @param reward The reward token that incentives the asset -+ * @param newDistributionEnd The end date of the incentivization, in unix time format -+ **/ -+ function setDistributionEnd(address asset, address reward, uint32 newDistributionEnd) external; -+ -+ /** -+ * @dev Sets the emission per second of a set of reward distributions -+ * @param asset The asset is being incentivized -+ * @param rewards List of reward addresses are being distributed -+ * @param newEmissionsPerSecond List of new reward emissions per second -+ */ -+ function setEmissionPerSecond( -+ address asset, -+ address[] calldata rewards, -+ uint88[] calldata newEmissionsPerSecond -+ ) external; -+ -+ /** -+ * @dev Gets the end date for the distribution -+ * @param asset The incentivized asset -+ * @param reward The reward token of the incentivized asset -+ * @return The timestamp with the end of the distribution, in unix time format -+ **/ -+ function getDistributionEnd(address asset, address reward) external view returns (uint256); -+ -+ /** -+ * @dev Returns the index of a user on a reward distribution -+ * @param user Address of the user -+ * @param asset The incentivized asset -+ * @param reward The reward token of the incentivized asset -+ * @return The current user asset index, not including new distributions -+ **/ -+ function getUserAssetIndex( -+ address user, -+ address asset, -+ address reward -+ ) external view returns (uint256); -+ -+ /** -+ * @dev Returns the configuration of the distribution reward for a certain asset -+ * @param asset The incentivized asset -+ * @param reward The reward token of the incentivized asset -+ * @return The index of the asset distribution -+ * @return The emission per second of the reward distribution -+ * @return The timestamp of the last update of the index -+ * @return The timestamp of the distribution end -+ **/ -+ function getRewardsData( -+ address asset, -+ address reward -+ ) external view returns (uint256, uint256, uint256, uint256); -+ -+ /** -+ * @dev Calculates the next value of an specific distribution index, with validations. -+ * @param asset The incentivized asset -+ * @param reward The reward token of the incentivized asset -+ * @return The old index of the asset distribution -+ * @return The new index of the asset distribution -+ **/ -+ function getAssetIndex(address asset, address reward) external view returns (uint256, uint256); -+ -+ /** -+ * @dev Returns the list of available reward token addresses of an incentivized asset -+ * @param asset The incentivized asset -+ * @return List of rewards addresses of the input asset -+ **/ -+ function getRewardsByAsset(address asset) external view returns (address[] memory); -+ -+ /** -+ * @dev Returns the list of available reward addresses -+ * @return List of rewards supported in this contract -+ **/ -+ function getRewardsList() external view returns (address[] memory); -+ -+ /** -+ * @dev Returns the accrued rewards balance of a user, not including virtually accrued rewards since last distribution. -+ * @param user The address of the user -+ * @param reward The address of the reward token -+ * @return Unclaimed rewards, not including new distributions -+ **/ -+ function getUserAccruedRewards(address user, address reward) external view returns (uint256); -+ -+ /** -+ * @dev Returns a single rewards balance of a user, including virtually accrued and unrealized claimable rewards. -+ * @param assets List of incentivized assets to check eligible distributions -+ * @param user The address of the user -+ * @param reward The address of the reward token -+ * @return The rewards amount -+ **/ -+ function getUserRewards( -+ address[] calldata assets, -+ address user, -+ address reward -+ ) external view returns (uint256); -+ -+ /** -+ * @dev Returns a list all rewards of a user, including already accrued and unrealized claimable rewards -+ * @param assets List of incentivized assets to check eligible distributions -+ * @param user The address of the user -+ * @return The list of reward addresses -+ * @return The list of unclaimed amount of rewards -+ **/ -+ function getAllUserRewards( -+ address[] calldata assets, -+ address user -+ ) external view returns (address[] memory, uint256[] memory); -+ -+ /** -+ * @dev Returns the decimals of an asset to calculate the distribution delta -+ * @param asset The address to retrieve decimals -+ * @return The decimals of an underlying asset -+ */ -+ function getAssetDecimals(address asset) external view returns (uint8); -+ -+ /** -+ * @dev Returns the address of the emission manager -+ * @return The address of the EmissionManager -+ */ -+ function EMISSION_MANAGER() external view returns (address); -+ -+ /** -+ * @dev Returns the address of the emission manager. -+ * Deprecated: This getter is maintained for compatibility purposes. Use the `EMISSION_MANAGER()` function instead. -+ * @return The address of the EmissionManager -+ */ -+ function getEmissionManager() external view returns (address); -+} -+ -+// downloads/ZKSYNC/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/src/periphery/contracts/rewards/interfaces/ITransferStrategyBase.sol -+ -+interface ITransferStrategyBase { -+ event EmergencyWithdrawal( -+ address indexed caller, -+ address indexed token, -+ address indexed to, -+ uint256 amount -+ ); -+ -+ /** -+ * @dev Perform custom transfer logic via delegate call from source contract to a TransferStrategy implementation -+ * @param to Account to transfer rewards -+ * @param reward Address of the reward token -+ * @param amount Amount to transfer to the "to" address parameter -+ * @return Returns true bool if transfer logic succeeds -+ */ -+ function performTransfer(address to, address reward, uint256 amount) external returns (bool); -+ -+ /** -+ * @return Returns the address of the Incentives Controller -+ */ -+ function getIncentivesController() external view returns (address); -+ -+ /** -+ * @return Returns the address of the Rewards admin -+ */ -+ function getRewardsAdmin() external view returns (address); -+ -+ /** -+ * @dev Perform an emergency token withdrawal only callable by the Rewards admin -+ * @param token Address of the token to withdraw funds from this contract -+ * @param to Address of the recipient of the withdrawal -+ * @param amount Amount of the withdrawal -+ */ -+ function emergencyWithdrawal(address token, address to, uint256 amount) external; -+} -+ -+// src/core/contracts/dependencies/openzeppelin/contracts/Context.sol - - /* - * @dev Provides information about the current execution context, including the -@@ -24,7 +258,7 @@ abstract contract Context { - } - } - --// downloads/MAINNET/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/IERC20.sol -+// src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol - - /** - * @dev Interface of the ERC20 standard as defined in the EIP. -@@ -100,7 +334,7 @@ interface IERC20 { - event Approval(address indexed owner, address indexed spender, uint256 value); - } - --// downloads/MAINNET/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/SafeCast.sol -+// src/core/contracts/dependencies/openzeppelin/contracts/SafeCast.sol - - // OpenZeppelin Contracts v4.4.1 (utils/math/SafeCast.sol) - -@@ -356,7 +590,7 @@ library SafeCast { - } - } - --// downloads/MAINNET/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/@aave/core-v3/contracts/interfaces/IAaveIncentivesController.sol -+// src/core/contracts/interfaces/IAaveIncentivesController.sol - - /** - * @title IAaveIncentivesController -@@ -375,7 +609,7 @@ interface IAaveIncentivesController { - function handleAction(address user, uint256 totalSupply, uint256 userBalance) external; - } - --// downloads/MAINNET/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/@aave/core-v3/contracts/interfaces/IPoolAddressesProvider.sol -+// src/core/contracts/interfaces/IPoolAddressesProvider.sol - - /** - * @title IPoolAddressesProvider -@@ -602,7 +836,7 @@ interface IPoolAddressesProvider { - function setPoolDataProvider(address newDataProvider) external; - } - --// downloads/MAINNET/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/@aave/core-v3/contracts/protocol/libraries/helpers/Errors.sol -+// src/core/contracts/protocol/libraries/helpers/Errors.sol - - /** - * @title Errors library -@@ -670,7 +904,7 @@ library Errors { - string public constant PRICE_ORACLE_SENTINEL_CHECK_FAILED = '59'; // 'Price oracle sentinel validation failed' - string public constant ASSET_NOT_BORROWABLE_IN_ISOLATION = '60'; // 'Asset is not borrowable in isolation mode' - string public constant RESERVE_ALREADY_INITIALIZED = '61'; // 'Reserve has already been initialized' -- string public constant USER_IN_ISOLATION_MODE = '62'; // 'User is in isolation mode' -+ string public constant USER_IN_ISOLATION_MODE_OR_LTV_ZERO = '62'; // 'User is in isolation mode or ltv is zero' - string public constant INVALID_LTV = '63'; // 'Invalid ltv parameter for the reserve' - string public constant INVALID_LIQ_THRESHOLD = '64'; // 'Invalid liquidity threshold parameter for the reserve' - string public constant INVALID_LIQ_BONUS = '65'; // 'Invalid liquidity bonus parameter for the reserve' -@@ -700,9 +934,17 @@ library Errors { - 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 -+ string public constant INVALID_MAX_RATE = '92'; // The expect maximum borrow rate is invalid -+ string public constant WITHDRAW_TO_ATOKEN = '93'; // Withdrawing to the aToken is not allowed -+ string public constant SUPPLY_TO_ATOKEN = '94'; // Supplying to the aToken is not allowed -+ string public constant SLOPE_2_MUST_BE_GTE_SLOPE_1 = '95'; // Variable interest rate slope 2 can not be lower than slope 1 -+ string public constant CALLER_NOT_RISK_OR_POOL_OR_EMERGENCY_ADMIN = '96'; // 'The caller of the function is not a risk, pool or emergency admin' -+ 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 - } - --// downloads/MAINNET/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/@aave/core-v3/contracts/protocol/libraries/math/WadRayMath.sol -+// src/core/contracts/protocol/libraries/math/WadRayMath.sol - - /** - * @title WadRayMath library -@@ -828,9 +1070,46 @@ library WadRayMath { - } - } - --// downloads/MAINNET/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/@aave/core-v3/contracts/protocol/libraries/types/DataTypes.sol -+// src/core/contracts/protocol/libraries/types/DataTypes.sol - - library DataTypes { -+ /** -+ * This exists specifically to maintain the `getReserveData()` interface, since the new, internal -+ * `ReserveData` struct includes the reserve's `virtualUnderlyingBalance`. -+ */ -+ struct ReserveDataLegacy { -+ //stores the reserve configuration -+ ReserveConfigurationMap configuration; -+ //the liquidity index. Expressed in ray -+ uint128 liquidityIndex; -+ //the current supply rate. Expressed in ray -+ uint128 currentLiquidityRate; -+ //variable borrow index. Expressed in ray -+ uint128 variableBorrowIndex; -+ //the current variable borrow rate. Expressed in ray -+ uint128 currentVariableBorrowRate; -+ //the current stable borrow rate. Expressed in ray -+ uint128 currentStableBorrowRate; -+ //timestamp of last update -+ uint40 lastUpdateTimestamp; -+ //the id of the reserve. Represents the position in the list of the active reserves -+ uint16 id; -+ //aToken address -+ address aTokenAddress; -+ //stableDebtToken address -+ address stableDebtTokenAddress; -+ //variableDebtToken address -+ address variableDebtTokenAddress; -+ //address of the interest rate strategy -+ address interestRateStrategyAddress; -+ //the current treasury balance, scaled -+ uint128 accruedToTreasury; -+ //the outstanding unbacked aTokens minted through the bridging feature -+ uint128 unbacked; -+ //the outstanding debt borrowed against this asset in isolation mode -+ uint128 isolationModeTotalDebt; -+ } -+ - struct ReserveData { - //stores the reserve configuration - ReserveConfigurationMap configuration; -@@ -848,6 +1127,8 @@ library DataTypes { - uint40 lastUpdateTimestamp; - //the id of the reserve. Represents the position in the list of the active reserves - uint16 id; -+ //timestamp until when liquidations are not allowed on the reserve, if set to past liquidations will be allowed -+ uint40 liquidationGracePeriodUntil; - //aToken address - address aTokenAddress; - //stableDebtToken address -@@ -862,6 +1143,8 @@ library DataTypes { - uint128 unbacked; - //the outstanding debt borrowed against this asset in isolation mode - uint128 isolationModeTotalDebt; -+ //the amount of underlying accounted for by the protocol -+ uint128 virtualUnderlyingBalance; - } - - struct ReserveConfigurationMap { -@@ -875,15 +1158,17 @@ library DataTypes { - //bit 59: stable rate borrowing enabled - //bit 60: asset is paused - //bit 61: borrowing in isolation mode is enabled -- //bit 62-63: reserved -+ //bit 62: siloed borrowing enabled -+ //bit 63: flashloaning enabled - //bit 64-79: reserve factor -- //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 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-255 unused -+ //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 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 -+ //bit 253-255 unused - - uint256 data; - } -@@ -1018,6 +1303,7 @@ library DataTypes { - uint256 maxStableRateBorrowSizePercent; - uint256 reservesCount; - address addressesProvider; -+ address pool; - uint8 userEModeCategory; - bool isAuthorizedFlashBorrower; - } -@@ -1082,7 +1368,8 @@ library DataTypes { - uint256 averageStableBorrowRate; - uint256 reserveFactor; - address reserve; -- address aToken; -+ bool usingVirtualBalance; -+ uint256 virtualUnderlyingBalance; - } - - struct InitReserveParams { -@@ -1096,241 +1383,80 @@ library DataTypes { - } - } - --// downloads/MAINNET/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/@aave/periphery-v3/contracts/misc/interfaces/IEACAggregatorProxy.sol -- --interface IEACAggregatorProxy { -- function decimals() external view returns (uint8); -- -- function latestAnswer() external view returns (int256); -- -- function latestTimestamp() external view returns (uint256); -- -- function latestRound() external view returns (uint256); -- -- function getAnswer(uint256 roundId) external view returns (int256); -- -- function getTimestamp(uint256 roundId) external view returns (uint256); -- -- event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 timestamp); -- event NewRound(uint256 indexed roundId, address indexed startedBy); --} -- --// downloads/MAINNET/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/@aave/periphery-v3/contracts/rewards/interfaces/IRewardsDistributor.sol -- --/** -- * @title IRewardsDistributor -- * @author Aave -- * @notice Defines the basic interface for a Rewards Distributor. -- */ --interface IRewardsDistributor { -- /** -- * @dev Emitted when the configuration of the rewards of an asset is updated. -- * @param asset The address of the incentivized asset -- * @param reward The address of the reward token -- * @param oldEmission The old emissions per second value of the reward distribution -- * @param newEmission The new emissions per second value of the reward distribution -- * @param oldDistributionEnd The old end timestamp of the reward distribution -- * @param newDistributionEnd The new end timestamp of the reward distribution -- * @param assetIndex The index of the asset distribution -- */ -- event AssetConfigUpdated( -- address indexed asset, -- address indexed reward, -- uint256 oldEmission, -- uint256 newEmission, -- uint256 oldDistributionEnd, -- uint256 newDistributionEnd, -- uint256 assetIndex -- ); -- -- /** -- * @dev Emitted when rewards of an asset are accrued on behalf of a user. -- * @param asset The address of the incentivized asset -- * @param reward The address of the reward token -- * @param user The address of the user that rewards are accrued on behalf of -- * @param assetIndex The index of the asset distribution -- * @param userIndex The index of the asset distribution on behalf of the user -- * @param rewardsAccrued The amount of rewards accrued -- */ -- event Accrued( -- address indexed asset, -- address indexed reward, -- address indexed user, -- uint256 assetIndex, -- uint256 userIndex, -- uint256 rewardsAccrued -- ); -- -- /** -- * @dev Sets the end date for the distribution -- * @param asset The asset to incentivize -- * @param reward The reward token that incentives the asset -- * @param newDistributionEnd The end date of the incentivization, in unix time format -- **/ -- function setDistributionEnd(address asset, address reward, uint32 newDistributionEnd) external; -- -- /** -- * @dev Sets the emission per second of a set of reward distributions -- * @param asset The asset is being incentivized -- * @param rewards List of reward addresses are being distributed -- * @param newEmissionsPerSecond List of new reward emissions per second -- */ -- function setEmissionPerSecond( -- address asset, -- address[] calldata rewards, -- uint88[] calldata newEmissionsPerSecond -- ) external; -- -- /** -- * @dev Gets the end date for the distribution -- * @param asset The incentivized asset -- * @param reward The reward token of the incentivized asset -- * @return The timestamp with the end of the distribution, in unix time format -- **/ -- function getDistributionEnd(address asset, address reward) external view returns (uint256); -- -- /** -- * @dev Returns the index of a user on a reward distribution -- * @param user Address of the user -- * @param asset The incentivized asset -- * @param reward The reward token of the incentivized asset -- * @return The current user asset index, not including new distributions -- **/ -- function getUserAssetIndex( -- address user, -- address asset, -- address reward -- ) external view returns (uint256); -- -- /** -- * @dev Returns the configuration of the distribution reward for a certain asset -- * @param asset The incentivized asset -- * @param reward The reward token of the incentivized asset -- * @return The index of the asset distribution -- * @return The emission per second of the reward distribution -- * @return The timestamp of the last update of the index -- * @return The timestamp of the distribution end -- **/ -- function getRewardsData( -- address asset, -- address reward -- ) external view returns (uint256, uint256, uint256, uint256); -- -- /** -- * @dev Calculates the next value of an specific distribution index, with validations. -- * @param asset The incentivized asset -- * @param reward The reward token of the incentivized asset -- * @return The old index of the asset distribution -- * @return The new index of the asset distribution -- **/ -- function getAssetIndex(address asset, address reward) external view returns (uint256, uint256); -- -- /** -- * @dev Returns the list of available reward token addresses of an incentivized asset -- * @param asset The incentivized asset -- * @return List of rewards addresses of the input asset -- **/ -- function getRewardsByAsset(address asset) external view returns (address[] memory); -- -- /** -- * @dev Returns the list of available reward addresses -- * @return List of rewards supported in this contract -- **/ -- function getRewardsList() external view returns (address[] memory); -- -- /** -- * @dev Returns the accrued rewards balance of a user, not including virtually accrued rewards since last distribution. -- * @param user The address of the user -- * @param reward The address of the reward token -- * @return Unclaimed rewards, not including new distributions -- **/ -- function getUserAccruedRewards(address user, address reward) external view returns (uint256); -- -- /** -- * @dev Returns a single rewards balance of a user, including virtually accrued and unrealized claimable rewards. -- * @param assets List of incentivized assets to check eligible distributions -- * @param user The address of the user -- * @param reward The address of the reward token -- * @return The rewards amount -- **/ -- function getUserRewards( -- address[] calldata assets, -- address user, -- address reward -- ) external view returns (uint256); -- -- /** -- * @dev Returns a list all rewards of a user, including already accrued and unrealized claimable rewards -- * @param assets List of incentivized assets to check eligible distributions -- * @param user The address of the user -- * @return The list of reward addresses -- * @return The list of unclaimed amount of rewards -- **/ -- function getAllUserRewards( -- address[] calldata assets, -+// downloads/ZKSYNC/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/src/periphery/contracts/misc/interfaces/IUiIncentiveDataProviderV3.sol -+ -+interface IUiIncentiveDataProviderV3 { -+ struct AggregatedReserveIncentiveData { -+ address underlyingAsset; -+ IncentiveData aIncentiveData; -+ IncentiveData vIncentiveData; -+ IncentiveData sIncentiveData; -+ } -+ -+ struct IncentiveData { -+ address tokenAddress; -+ address incentiveControllerAddress; -+ RewardInfo[] rewardsTokenInformation; -+ } -+ -+ struct RewardInfo { -+ string rewardTokenSymbol; -+ address rewardTokenAddress; -+ address rewardOracleAddress; -+ uint256 emissionPerSecond; -+ uint256 incentivesLastUpdateTimestamp; -+ uint256 tokenIncentivesIndex; -+ uint256 emissionEndTimestamp; -+ int256 rewardPriceFeed; -+ uint8 rewardTokenDecimals; -+ uint8 precision; -+ uint8 priceFeedDecimals; -+ } -+ -+ struct UserReserveIncentiveData { -+ address underlyingAsset; -+ UserIncentiveData aTokenIncentivesUserData; -+ UserIncentiveData vTokenIncentivesUserData; -+ UserIncentiveData sTokenIncentivesUserData; -+ } -+ -+ struct UserIncentiveData { -+ address tokenAddress; -+ address incentiveControllerAddress; -+ UserRewardInfo[] userRewardsInformation; -+ } -+ -+ struct UserRewardInfo { -+ string rewardTokenSymbol; -+ address rewardOracleAddress; -+ address rewardTokenAddress; -+ uint256 userUnclaimedRewards; -+ uint256 tokenIncentivesUserIndex; -+ int256 rewardPriceFeed; -+ uint8 priceFeedDecimals; -+ uint8 rewardTokenDecimals; -+ } -+ -+ function getReservesIncentivesData( -+ IPoolAddressesProvider provider -+ ) external view returns (AggregatedReserveIncentiveData[] memory); -+ -+ function getUserReservesIncentivesData( -+ IPoolAddressesProvider provider, - address user -- ) external view returns (address[] memory, uint256[] memory); -- -- /** -- * @dev Returns the decimals of an asset to calculate the distribution delta -- * @param asset The address to retrieve decimals -- * @return The decimals of an underlying asset -- */ -- function getAssetDecimals(address asset) external view returns (uint8); -- -- /** -- * @dev Returns the address of the emission manager -- * @return The address of the EmissionManager -- */ -- function EMISSION_MANAGER() external view returns (address); -+ ) external view returns (UserReserveIncentiveData[] memory); - -- /** -- * @dev Returns the address of the emission manager. -- * Deprecated: This getter is maintained for compatibility purposes. Use the `EMISSION_MANAGER()` function instead. -- * @return The address of the EmissionManager -- */ -- function getEmissionManager() external view returns (address); --} -- --// downloads/MAINNET/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/@aave/periphery-v3/contracts/rewards/interfaces/ITransferStrategyBase.sol -- --interface ITransferStrategyBase { -- event EmergencyWithdrawal( -- address indexed caller, -- address indexed token, -- address indexed to, -- uint256 amount -- ); -- -- /** -- * @dev Perform custom transfer logic via delegate call from source contract to a TransferStrategy implementation -- * @param to Account to transfer rewards -- * @param reward Address of the reward token -- * @param amount Amount to transfer to the "to" address parameter -- * @return Returns true bool if transfer logic succeeds -- */ -- function performTransfer(address to, address reward, uint256 amount) external returns (bool); -- -- /** -- * @return Returns the address of the Incentives Controller -- */ -- function getIncentivesController() external view returns (address); -- -- /** -- * @return Returns the address of the Rewards admin -- */ -- function getRewardsAdmin() external view returns (address); -- -- /** -- * @dev Perform an emergency token withdrawal only callable by the Rewards admin -- * @param token Address of the token to withdraw funds from this contract -- * @param to Address of the recipient of the withdrawal -- * @param amount Amount of the withdrawal -- */ -- function emergencyWithdrawal(address token, address to, uint256 amount) external; -+ // generic method with full data -+ function getFullReservesIncentiveData( -+ IPoolAddressesProvider provider, -+ address user -+ ) -+ external -+ view -+ returns (AggregatedReserveIncentiveData[] memory, UserReserveIncentiveData[] memory); - } - --// downloads/MAINNET/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol -+// src/core/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol - - interface IERC20Detailed is IERC20 { - function name() external view returns (string memory); -@@ -1340,7 +1466,7 @@ interface IERC20Detailed is IERC20 { - function decimals() external view returns (uint8); - } - --// downloads/MAINNET/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/@aave/core-v3/contracts/interfaces/IACLManager.sol -+// src/core/contracts/interfaces/IACLManager.sol - - /** - * @title IACLManager -@@ -1513,80 +1639,58 @@ interface IACLManager { - function isAssetListingAdmin(address admin) external view returns (bool); - } - --// downloads/MAINNET/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/@aave/periphery-v3/contracts/misc/interfaces/IUiIncentiveDataProviderV3.sol -- --interface IUiIncentiveDataProviderV3 { -- struct AggregatedReserveIncentiveData { -- address underlyingAsset; -- IncentiveData aIncentiveData; -- IncentiveData vIncentiveData; -- IncentiveData sIncentiveData; -- } -- -- struct IncentiveData { -- address tokenAddress; -- address incentiveControllerAddress; -- RewardInfo[] rewardsTokenInformation; -+// downloads/ZKSYNC/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/src/periphery/contracts/rewards/libraries/RewardsDataTypes.sol -+ -+library RewardsDataTypes { -+ struct RewardsConfigInput { -+ uint88 emissionPerSecond; -+ uint256 totalSupply; -+ uint32 distributionEnd; -+ address asset; -+ address reward; -+ ITransferStrategyBase transferStrategy; -+ IEACAggregatorProxy rewardOracle; - } - -- struct RewardInfo { -- string rewardTokenSymbol; -- address rewardTokenAddress; -- address rewardOracleAddress; -- uint256 emissionPerSecond; -- uint256 incentivesLastUpdateTimestamp; -- uint256 tokenIncentivesIndex; -- uint256 emissionEndTimestamp; -- int256 rewardPriceFeed; -- uint8 rewardTokenDecimals; -- uint8 precision; -- uint8 priceFeedDecimals; -+ struct UserAssetBalance { -+ address asset; -+ uint256 userBalance; -+ uint256 totalSupply; - } - -- struct UserReserveIncentiveData { -- address underlyingAsset; -- UserIncentiveData aTokenIncentivesUserData; -- UserIncentiveData vTokenIncentivesUserData; -- UserIncentiveData sTokenIncentivesUserData; -+ struct UserData { -+ // Liquidity index of the reward distribution for the user -+ uint104 index; -+ // Amount of accrued rewards for the user since last user index update -+ uint128 accrued; - } - -- struct UserIncentiveData { -- address tokenAddress; -- address incentiveControllerAddress; -- UserRewardInfo[] userRewardsInformation; -+ struct RewardData { -+ // Liquidity index of the reward distribution -+ uint104 index; -+ // Amount of reward tokens distributed per second -+ uint88 emissionPerSecond; -+ // Timestamp of the last reward index update -+ uint32 lastUpdateTimestamp; -+ // The end of the distribution of rewards (in seconds) -+ uint32 distributionEnd; -+ // Map of user addresses and their rewards data (userAddress => userData) -+ mapping(address => UserData) usersData; - } - -- struct UserRewardInfo { -- string rewardTokenSymbol; -- address rewardOracleAddress; -- address rewardTokenAddress; -- uint256 userUnclaimedRewards; -- uint256 tokenIncentivesUserIndex; -- int256 rewardPriceFeed; -- uint8 priceFeedDecimals; -- uint8 rewardTokenDecimals; -+ struct AssetData { -+ // Map of reward token addresses and their data (rewardTokenAddress => rewardData) -+ mapping(address => RewardData) rewards; -+ // List of reward token addresses for the asset -+ mapping(uint128 => address) availableRewards; -+ // Count of reward tokens for the asset -+ uint128 availableRewardsCount; -+ // Number of decimals of the asset -+ uint8 decimals; - } -- -- function getReservesIncentivesData( -- IPoolAddressesProvider provider -- ) external view returns (AggregatedReserveIncentiveData[] memory); -- -- function getUserReservesIncentivesData( -- IPoolAddressesProvider provider, -- address user -- ) external view returns (UserReserveIncentiveData[] memory); -- -- // generic method with full data -- function getFullReservesIncentiveData( -- IPoolAddressesProvider provider, -- address user -- ) -- external -- view -- returns (AggregatedReserveIncentiveData[] memory, UserReserveIncentiveData[] memory); - } - --// downloads/MAINNET/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/@aave/core-v3/contracts/interfaces/IPool.sol -+// src/core/contracts/interfaces/IPool.sol - - /** - * @title IPool -@@ -1964,6 +2068,14 @@ interface IPool { - */ - 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: -@@ -2005,7 +2117,7 @@ interface IPool { - * @notice Allows smartcontracts to access the liquidity of the pool within one transaction, - * as long as the amount taken plus a fee is returned. - * @dev IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept -- * into consideration. For further details please visit https://developers.aave.com -+ * into consideration. For further details please visit https://docs.aave.com/developers/ - * @param receiverAddress The address of the contract receiving the funds, implementing IFlashLoanReceiver interface - * @param assets The addresses of the assets being flash-borrowed - * @param amounts The amounts of the assets being flash-borrowed -@@ -2032,7 +2144,7 @@ interface IPool { - * @notice Allows smartcontracts to access the liquidity of the pool within one transaction, - * as long as the amount taken plus a fee is returned. - * @dev IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept -- * into consideration. For further details please visit https://developers.aave.com -+ * into consideration. For further details please visit https://docs.aave.com/developers/ - * @param receiverAddress The address of the contract receiving the funds, implementing IFlashLoanSimpleReceiver interface - * @param asset The address of the asset being flash-borrowed - * @param amount The amount of the asset being flash-borrowed -@@ -2108,6 +2220,22 @@ interface IPool { - address rateStrategyAddress - ) external; - -+ /** -+ * @notice Accumulates interest to all indexes of the reserve -+ * @dev Only callable by the PoolConfigurator contract -+ * @dev To be used when required by the configurator, for example when updating interest rates strategy data -+ * @param asset The address of the underlying asset of the reserve -+ */ -+ function syncIndexesState(address asset) external; -+ -+ /** -+ * @notice Updates interest rates on the reserve data -+ * @dev Only callable by the PoolConfigurator contract -+ * @dev To be used when required by the configurator, for example when updating interest rates strategy data -+ * @param asset The address of the underlying asset of the reserve -+ */ -+ function syncRatesState(address asset) external; -+ - /** - * @notice Sets the configuration bitmap of the reserve as a whole - * @dev Only callable by the PoolConfigurator contract -@@ -2163,7 +2291,23 @@ interface IPool { - * @param asset The address of the underlying asset of the reserve - * @return The state and configuration data of the reserve - */ -- function getReserveData(address asset) external view returns (DataTypes.ReserveData memory); -+ function getReserveData(address asset) external view returns (DataTypes.ReserveDataLegacy memory); -+ -+ /** -+ * @notice Returns the state and configuration of the reserve, including extra data included with Aave v3.1 -+ * @param asset The address of the underlying asset of the reserve -+ * @return The state and configuration data of the reserve with virtual accounting -+ */ -+ function getReserveDataExtended( -+ address asset -+ ) external view returns (DataTypes.ReserveData memory); -+ -+ /** -+ * @notice Returns the virtual underlying balance of the reserve -+ * @param asset The address of the underlying asset of the reserve -+ * @return The reserve virtual underlying balance -+ */ -+ function getVirtualUnderlyingBalance(address asset) external view returns (uint128); - - /** - * @notice Validates and finalizes an aToken transfer -@@ -2191,6 +2335,13 @@ interface IPool { - */ - function getReservesList() external view returns (address[] memory); - -+ /** -+ * @notice Returns the number of initialized reserves -+ * @dev It includes dropped reserves -+ * @return The count -+ */ -+ function getReservesCount() external view returns (uint256); -+ - /** - * @notice Returns the address of the underlying asset of a reserve by the reserve id as stored in the DataTypes.ReserveData struct - * @param id The id of the reserve as stored in the DataTypes.ReserveData struct -@@ -2261,6 +2412,22 @@ interface IPool { - */ - function resetIsolationModeTotalDebt(address asset) external; - -+ /** -+ * @notice Sets the liquidation grace period of the given asset -+ * @dev To enable a liquidation grace period, a timestamp in the future should be set, -+ * To disable a liquidation grace period, any timestamp in the past works, like 0 -+ * @param asset The address of the underlying asset to set the liquidationGracePeriod -+ * @param until Timestamp when the liquidation grace period will end -+ **/ -+ function setLiquidationGracePeriod(address asset, uint40 until) external; -+ -+ /** -+ * @notice Returns the liquidation grace period of the given asset -+ * @param asset The address of the underlying asset -+ * @return Timestamp when the liquidation grace period will end -+ **/ -+ 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 -@@ -2318,9 +2485,44 @@ interface IPool { - * 0 if the action is executed directly by the user, without any middle-man - */ - function deposit(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external; -+ -+ /** -+ * @notice Gets the address of the external FlashLoanLogic -+ */ -+ function getFlashLoanLogic() external view returns (address); -+ -+ /** -+ * @notice Gets the address of the external BorrowLogic -+ */ -+ function getBorrowLogic() external view returns (address); -+ -+ /** -+ * @notice Gets the address of the external BridgeLogic -+ */ -+ function getBridgeLogic() external view returns (address); -+ -+ /** -+ * @notice Gets the address of the external EModeLogic -+ */ -+ function getEModeLogic() external view returns (address); -+ -+ /** -+ * @notice Gets the address of the external LiquidationLogic -+ */ -+ function getLiquidationLogic() external view returns (address); -+ -+ /** -+ * @notice Gets the address of the external PoolLogic -+ */ -+ function getPoolLogic() external view returns (address); -+ -+ /** -+ * @notice Gets the address of the external SupplyLogic -+ */ -+ function getSupplyLogic() external view returns (address); - } - --// downloads/MAINNET/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/@aave/core-v3/contracts/protocol/libraries/configuration/ReserveConfiguration.sol -+// src/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol - - /** - * @title ReserveConfiguration library -@@ -2347,6 +2549,7 @@ library ReserveConfiguration { - uint256 internal constant EMODE_CATEGORY_MASK = 0xFFFFFFFFFFFFFFFFFFFF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; // prettier-ignore - 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 - - /// @dev For the LTV, the start bit is 0 (up to 15), hence no bitshifting is needed - uint256 internal constant LIQUIDATION_THRESHOLD_START_BIT_POSITION = 16; -@@ -2367,6 +2570,7 @@ library ReserveConfiguration { - uint256 internal constant EMODE_CATEGORY_START_BIT_POSITION = 168; - 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; - - uint256 internal constant MAX_VALID_LTV = 65535; - uint256 internal constant MAX_VALID_LIQUIDATION_THRESHOLD = 65535; -@@ -2862,6 +3066,33 @@ library ReserveConfiguration { - return (self.data & ~FLASHLOAN_ENABLED_MASK) != 0; - } - -+ /** -+ * @notice Sets the virtual account active/not state of the reserve -+ * @param self The reserve configuration -+ * @param active The active state -+ */ -+ function setVirtualAccActive( -+ DataTypes.ReserveConfigurationMap memory self, -+ bool active -+ ) internal pure { -+ self.data = -+ (self.data & VIRTUAL_ACC_ACTIVE_MASK) | -+ (uint256(active ? 1 : 0) << VIRTUAL_ACC_START_BIT_POSITION); -+ } -+ -+ /** -+ * @notice Gets the virtual account active/not state of the reserve -+ * @dev The state should be true for all normal assets and should be false -+ * only in special cases (ex. GHO) where an asset is minted instead of supplied. -+ * @param self The reserve configuration -+ * @return The active state -+ */ -+ function getIsVirtualAccActive( -+ DataTypes.ReserveConfigurationMap memory self -+ ) internal pure returns (bool) { -+ return (self.data & ~VIRTUAL_ACC_ACTIVE_MASK) != 0; -+ } -+ - /** - * @notice Gets the configuration flags of the reserve - * @param self The reserve configuration -@@ -2928,58 +3159,7 @@ library ReserveConfiguration { - } - } - --// downloads/MAINNET/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/@aave/periphery-v3/contracts/rewards/libraries/RewardsDataTypes.sol -- --library RewardsDataTypes { -- struct RewardsConfigInput { -- uint88 emissionPerSecond; -- uint256 totalSupply; -- uint32 distributionEnd; -- address asset; -- address reward; -- ITransferStrategyBase transferStrategy; -- IEACAggregatorProxy rewardOracle; -- } -- -- struct UserAssetBalance { -- address asset; -- uint256 userBalance; -- uint256 totalSupply; -- } -- -- struct UserData { -- // Liquidity index of the reward distribution for the user -- uint104 index; -- // Amount of accrued rewards for the user since last user index update -- uint128 accrued; -- } -- -- struct RewardData { -- // Liquidity index of the reward distribution -- uint104 index; -- // Amount of reward tokens distributed per second -- uint88 emissionPerSecond; -- // Timestamp of the last reward index update -- uint32 lastUpdateTimestamp; -- // The end of the distribution of rewards (in seconds) -- uint32 distributionEnd; -- // Map of user addresses and their rewards data (userAddress => userData) -- mapping(address => UserData) usersData; -- } -- -- struct AssetData { -- // Map of reward token addresses and their data (rewardTokenAddress => rewardData) -- mapping(address => RewardData) rewards; -- // List of reward token addresses for the asset -- mapping(uint128 => address) availableRewards; -- // Count of reward tokens for the asset -- uint128 availableRewardsCount; -- // Number of decimals of the asset -- uint8 decimals; -- } --} -- --// downloads/MAINNET/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/@aave/core-v3/contracts/protocol/libraries/configuration/UserConfiguration.sol -+// src/core/contracts/protocol/libraries/configuration/UserConfiguration.sol - - /** - * @title UserConfiguration library -@@ -3211,7 +3391,7 @@ library UserConfiguration { - } - } - --// downloads/MAINNET/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/@aave/periphery-v3/contracts/rewards/interfaces/IRewardsController.sol -+// downloads/ZKSYNC/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/src/periphery/contracts/rewards/interfaces/IRewardsController.sol - - /** - * @title IRewardsController -@@ -3409,7 +3589,7 @@ interface IRewardsController is IRewardsDistributor { - ) external returns (address[] memory rewardsList, uint256[] memory claimedAmounts); - } - + -// downloads/MAINNET/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/@aave/core-v3/contracts/protocol/tokenization/base/IncentivizedERC20.sol +// src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol - + /** * @title IncentivizedERC20 @@ -3464,15 +3644,15 @@ abstract contract IncentivizedERC20 is Context, IERC20Detailed { @@ -1188,23 +31,23 @@ index df8b21f..8a55fee 100644 + _decimals = decimals_; POOL = pool; } - + @@ -3633,7 +3813,7 @@ abstract contract IncentivizedERC20 is Context, IERC20Detailed { } } - + -// downloads/MAINNET/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/@aave/periphery-v3/contracts/misc/UiIncentiveDataProviderV3.sol +// downloads/ZKSYNC/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/src/periphery/contracts/misc/UiIncentiveDataProviderV3.sol - + contract UiIncentiveDataProviderV3 is IUiIncentiveDataProviderV3 { using UserConfiguration for DataTypes.UserConfigurationMap; @@ -3668,7 +3848,7 @@ contract UiIncentiveDataProviderV3 is IUiIncentiveDataProviderV3 { AggregatedReserveIncentiveData memory reserveIncentiveData = reservesIncentiveData[i]; reserveIncentiveData.underlyingAsset = reserves[i]; - + - DataTypes.ReserveData memory baseData = pool.getReserveData(reserves[i]); + DataTypes.ReserveDataLegacy memory baseData = pool.getReserveData(reserves[i]); - + // Get aTokens rewards information // TODO: check that this is deployed correctly on contract and remove casting @@ -3730,12 +3910,11 @@ contract UiIncentiveDataProviderV3 is IUiIncentiveDataProviderV3 { @@ -1241,11 +84,11 @@ index df8b21f..8a55fee 100644 RewardInfo memory rewardInformation; @@ -3859,7 +4037,7 @@ contract UiIncentiveDataProviderV3 is IUiIncentiveDataProviderV3 { ); - + for (uint256 i = 0; i < reserves.length; i++) { - DataTypes.ReserveData memory baseData = pool.getReserveData(reserves[i]); + DataTypes.ReserveDataLegacy memory baseData = pool.getReserveData(reserves[i]); - + // user reserve data userReservesIncentivesData[i].underlyingAsset = reserves[i]; ``` diff --git a/diffs/MAINNET_ZKSYNC/UI_POOL_DATA_PROVIDER_DIFF.md b/diffs/MAINNET_ZKSYNC/UI_POOL_DATA_PROVIDER_DIFF.md index 678b9257..d2650cb7 100644 --- a/diffs/MAINNET_ZKSYNC/UI_POOL_DATA_PROVIDER_DIFF.md +++ b/diffs/MAINNET_ZKSYNC/UI_POOL_DATA_PROVIDER_DIFF.md @@ -3,40 +3,5 @@ diff --git a/./downloads/MAINNET/UI_POOL_DATA_PROVIDER.sol b/./downloads/ZKSYNC/ index a888c89..91ed1e2 100644 --- a/./downloads/MAINNET/UI_POOL_DATA_PROVIDER.sol +++ b/./downloads/ZKSYNC/UI_POOL_DATA_PROVIDER.sol -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: BUSL-1.1 - pragma solidity ^0.8.0 ^0.8.10; - --// downloads/MAINNET/UI_POOL_DATA_PROVIDER/UiPoolDataProviderV3/src/periphery/contracts/misc/interfaces/IEACAggregatorProxy.sol -+// downloads/ZKSYNC/UI_POOL_DATA_PROVIDER/UiPoolDataProviderV3/src/periphery/contracts/misc/interfaces/IEACAggregatorProxy.sol - - interface IEACAggregatorProxy { - function decimals() external view returns (uint8); -@@ -991,7 +991,7 @@ library DataTypes { - } - } - --// downloads/MAINNET/UI_POOL_DATA_PROVIDER/UiPoolDataProviderV3/src/periphery/contracts/misc/interfaces/IERC20DetailedBytes.sol -+// downloads/ZKSYNC/UI_POOL_DATA_PROVIDER/UiPoolDataProviderV3/src/periphery/contracts/misc/interfaces/IERC20DetailedBytes.sol - - interface IERC20DetailedBytes is IERC20 { - function name() external view returns (bytes32); -@@ -1001,7 +1001,7 @@ interface IERC20DetailedBytes is IERC20 { - function decimals() external view returns (uint8); - } - --// downloads/MAINNET/UI_POOL_DATA_PROVIDER/UiPoolDataProviderV3/src/periphery/contracts/misc/interfaces/IUiPoolDataProviderV3.sol -+// downloads/ZKSYNC/UI_POOL_DATA_PROVIDER/UiPoolDataProviderV3/src/periphery/contracts/misc/interfaces/IUiPoolDataProviderV3.sol - - interface IUiPoolDataProviderV3 { - struct InterestRates { -@@ -4051,7 +4051,7 @@ contract AaveProtocolDataProvider is IPoolDataProvider { - } - } - --// downloads/MAINNET/UI_POOL_DATA_PROVIDER/UiPoolDataProviderV3/src/periphery/contracts/misc/UiPoolDataProviderV3.sol -+// downloads/ZKSYNC/UI_POOL_DATA_PROVIDER/UiPoolDataProviderV3/src/periphery/contracts/misc/UiPoolDataProviderV3.sol - - contract UiPoolDataProviderV3 is IUiPoolDataProviderV3 { - using WadRayMath for uint256; + ``` diff --git a/diffs/MAINNET_ZKSYNC/WALLET_BALANCE_PROVIDER_DIFF.md b/diffs/MAINNET_ZKSYNC/WALLET_BALANCE_PROVIDER_DIFF.md index 0d077d41..a4a88d47 100644 --- a/diffs/MAINNET_ZKSYNC/WALLET_BALANCE_PROVIDER_DIFF.md +++ b/diffs/MAINNET_ZKSYNC/WALLET_BALANCE_PROVIDER_DIFF.md @@ -3,603 +3,5 @@ diff --git a/./downloads/MAINNET/WALLET_BALANCE_PROVIDER.sol b/./downloads/ZKSYN index 5d96b38..0fcc8b1 100644 --- a/./downloads/MAINNET/WALLET_BALANCE_PROVIDER.sol +++ b/./downloads/ZKSYNC/WALLET_BALANCE_PROVIDER.sol -@@ -1,7 +1,9 @@ --// SPDX-License-Identifier: AGPL-3.0 --pragma solidity =0.8.10 ^0.8.0 ^0.8.10; -+// SPDX-License-Identifier: BUSL-1.1 -+pragma solidity ^0.8.0 ^0.8.10; - --// downloads/MAINNET/WALLET_BALANCE_PROVIDER/WalletBalanceProvider/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/Address.sol -+// src/core/contracts/dependencies/openzeppelin/contracts/Address.sol -+ -+// OpenZeppelin Contracts v4.4.1 (utils/Address.sol) - - /** - * @dev Collection of functions related to the address type -@@ -25,16 +27,15 @@ library Address { - * ==== - */ - function isContract(address account) internal view returns (bool) { -- // According to EIP-1052, 0x0 is the value returned for not-yet created accounts -- // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned -- // for accounts without code, i.e. `keccak256('')` -- bytes32 codehash; -- bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; -- // solhint-disable-next-line no-inline-assembly -+ // This method relies on extcodesize, which returns 0 for contracts in -+ // construction, since the code is only stored at the end of the -+ // constructor execution. -+ -+ uint256 size; - assembly { -- codehash := extcodehash(account) -+ size := extcodesize(account) - } -- return (codehash != accountHash && codehash != 0x0); -+ return size > 0; - } - - /** -@@ -56,13 +57,171 @@ library Address { - function sendValue(address payable recipient, uint256 amount) internal { - require(address(this).balance >= amount, 'Address: insufficient balance'); - -- // solhint-disable-next-line avoid-low-level-calls, avoid-call-value - (bool success, ) = recipient.call{value: amount}(''); - require(success, 'Address: unable to send value, recipient may have reverted'); - } -+ -+ /** -+ * @dev Performs a Solidity function call using a low level `call`. A -+ * plain `call` is an unsafe replacement for a function call: use this -+ * function instead. -+ * -+ * If `target` reverts with a revert reason, it is bubbled up by this -+ * function (like regular Solidity function calls). -+ * -+ * Returns the raw returned data. To convert to the expected return value, -+ * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. -+ * -+ * Requirements: -+ * -+ * - `target` must be a contract. -+ * - calling `target` with `data` must not revert. -+ * -+ * _Available since v3.1._ -+ */ -+ function functionCall(address target, bytes memory data) internal returns (bytes memory) { -+ return functionCall(target, data, 'Address: low-level call failed'); -+ } -+ -+ /** -+ * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with -+ * `errorMessage` as a fallback revert reason when `target` reverts. -+ * -+ * _Available since v3.1._ -+ */ -+ function functionCall( -+ address target, -+ bytes memory data, -+ string memory errorMessage -+ ) internal returns (bytes memory) { -+ return functionCallWithValue(target, data, 0, errorMessage); -+ } -+ -+ /** -+ * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], -+ * but also transferring `value` wei to `target`. -+ * -+ * Requirements: -+ * -+ * - the calling contract must have an ETH balance of at least `value`. -+ * - the called Solidity function must be `payable`. -+ * -+ * _Available since v3.1._ -+ */ -+ function functionCallWithValue( -+ address target, -+ bytes memory data, -+ uint256 value -+ ) internal returns (bytes memory) { -+ return functionCallWithValue(target, data, value, 'Address: low-level call with value failed'); -+ } -+ -+ /** -+ * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but -+ * with `errorMessage` as a fallback revert reason when `target` reverts. -+ * -+ * _Available since v3.1._ -+ */ -+ function functionCallWithValue( -+ address target, -+ bytes memory data, -+ uint256 value, -+ string memory errorMessage -+ ) internal returns (bytes memory) { -+ require(address(this).balance >= value, 'Address: insufficient balance for call'); -+ require(isContract(target), 'Address: call to non-contract'); -+ -+ (bool success, bytes memory returndata) = target.call{value: value}(data); -+ return verifyCallResult(success, returndata, errorMessage); -+ } -+ -+ /** -+ * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], -+ * but performing a static call. -+ * -+ * _Available since v3.3._ -+ */ -+ function functionStaticCall( -+ address target, -+ bytes memory data -+ ) internal view returns (bytes memory) { -+ return functionStaticCall(target, data, 'Address: low-level static call failed'); -+ } -+ -+ /** -+ * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], -+ * but performing a static call. -+ * -+ * _Available since v3.3._ -+ */ -+ function functionStaticCall( -+ address target, -+ bytes memory data, -+ string memory errorMessage -+ ) internal view returns (bytes memory) { -+ require(isContract(target), 'Address: static call to non-contract'); -+ -+ (bool success, bytes memory returndata) = target.staticcall(data); -+ return verifyCallResult(success, returndata, errorMessage); -+ } -+ -+ /** -+ * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], -+ * but performing a delegate call. -+ * -+ * _Available since v3.4._ -+ */ -+ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { -+ return functionDelegateCall(target, data, 'Address: low-level delegate call failed'); -+ } -+ -+ /** -+ * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], -+ * but performing a delegate call. -+ * -+ * _Available since v3.4._ -+ */ -+ function functionDelegateCall( -+ address target, -+ bytes memory data, -+ string memory errorMessage -+ ) internal returns (bytes memory) { -+ require(isContract(target), 'Address: delegate call to non-contract'); -+ -+ (bool success, bytes memory returndata) = target.delegatecall(data); -+ return verifyCallResult(success, returndata, errorMessage); -+ } -+ -+ /** -+ * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the -+ * revert reason using the provided one. -+ * -+ * _Available since v4.3._ -+ */ -+ function verifyCallResult( -+ bool success, -+ bytes memory returndata, -+ string memory errorMessage -+ ) internal pure returns (bytes memory) { -+ if (success) { -+ return returndata; -+ } else { -+ // Look for revert reason and bubble it up if present -+ if (returndata.length > 0) { -+ // The easiest way to bubble the revert reason is using memory via assembly -+ -+ assembly { -+ let returndata_size := mload(returndata) -+ revert(add(32, returndata), returndata_size) -+ } -+ } else { -+ revert(errorMessage); -+ } -+ } -+ } - } - --// downloads/MAINNET/WALLET_BALANCE_PROVIDER/WalletBalanceProvider/@aave/core-v3/contracts/dependencies/openzeppelin/contracts/IERC20.sol -+// src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol - - /** - * @dev Interface of the ERC20 standard as defined in the EIP. -@@ -138,7 +297,7 @@ interface IERC20 { - event Approval(address indexed owner, address indexed spender, uint256 value); - } - --// downloads/MAINNET/WALLET_BALANCE_PROVIDER/WalletBalanceProvider/@aave/core-v3/contracts/interfaces/IPoolAddressesProvider.sol -+// src/core/contracts/interfaces/IPoolAddressesProvider.sol - - /** - * @title IPoolAddressesProvider -@@ -365,7 +524,7 @@ interface IPoolAddressesProvider { - function setPoolDataProvider(address newDataProvider) external; - } - --// downloads/MAINNET/WALLET_BALANCE_PROVIDER/WalletBalanceProvider/@aave/core-v3/contracts/protocol/libraries/helpers/Errors.sol -+// src/core/contracts/protocol/libraries/helpers/Errors.sol - - /** - * @title Errors library -@@ -433,7 +592,7 @@ library Errors { - string public constant PRICE_ORACLE_SENTINEL_CHECK_FAILED = '59'; // 'Price oracle sentinel validation failed' - string public constant ASSET_NOT_BORROWABLE_IN_ISOLATION = '60'; // 'Asset is not borrowable in isolation mode' - string public constant RESERVE_ALREADY_INITIALIZED = '61'; // 'Reserve has already been initialized' -- string public constant USER_IN_ISOLATION_MODE = '62'; // 'User is in isolation mode' -+ string public constant USER_IN_ISOLATION_MODE_OR_LTV_ZERO = '62'; // 'User is in isolation mode or ltv is zero' - string public constant INVALID_LTV = '63'; // 'Invalid ltv parameter for the reserve' - string public constant INVALID_LIQ_THRESHOLD = '64'; // 'Invalid liquidity threshold parameter for the reserve' - string public constant INVALID_LIQ_BONUS = '65'; // 'Invalid liquidity bonus parameter for the reserve' -@@ -463,11 +622,56 @@ library Errors { - 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 -+ string public constant INVALID_MAX_RATE = '92'; // The expect maximum borrow rate is invalid -+ string public constant WITHDRAW_TO_ATOKEN = '93'; // Withdrawing to the aToken is not allowed -+ string public constant SUPPLY_TO_ATOKEN = '94'; // Supplying to the aToken is not allowed -+ string public constant SLOPE_2_MUST_BE_GTE_SLOPE_1 = '95'; // Variable interest rate slope 2 can not be lower than slope 1 -+ string public constant CALLER_NOT_RISK_OR_POOL_OR_EMERGENCY_ADMIN = '96'; // 'The caller of the function is not a risk, pool or emergency admin' -+ 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 - } - --// downloads/MAINNET/WALLET_BALANCE_PROVIDER/WalletBalanceProvider/@aave/core-v3/contracts/protocol/libraries/types/DataTypes.sol -+// src/core/contracts/protocol/libraries/types/DataTypes.sol - - library DataTypes { -+ /** -+ * This exists specifically to maintain the `getReserveData()` interface, since the new, internal -+ * `ReserveData` struct includes the reserve's `virtualUnderlyingBalance`. -+ */ -+ struct ReserveDataLegacy { -+ //stores the reserve configuration -+ ReserveConfigurationMap configuration; -+ //the liquidity index. Expressed in ray -+ uint128 liquidityIndex; -+ //the current supply rate. Expressed in ray -+ uint128 currentLiquidityRate; -+ //variable borrow index. Expressed in ray -+ uint128 variableBorrowIndex; -+ //the current variable borrow rate. Expressed in ray -+ uint128 currentVariableBorrowRate; -+ //the current stable borrow rate. Expressed in ray -+ uint128 currentStableBorrowRate; -+ //timestamp of last update -+ uint40 lastUpdateTimestamp; -+ //the id of the reserve. Represents the position in the list of the active reserves -+ uint16 id; -+ //aToken address -+ address aTokenAddress; -+ //stableDebtToken address -+ address stableDebtTokenAddress; -+ //variableDebtToken address -+ address variableDebtTokenAddress; -+ //address of the interest rate strategy -+ address interestRateStrategyAddress; -+ //the current treasury balance, scaled -+ uint128 accruedToTreasury; -+ //the outstanding unbacked aTokens minted through the bridging feature -+ uint128 unbacked; -+ //the outstanding debt borrowed against this asset in isolation mode -+ uint128 isolationModeTotalDebt; -+ } -+ - struct ReserveData { - //stores the reserve configuration - ReserveConfigurationMap configuration; -@@ -485,6 +689,8 @@ library DataTypes { - uint40 lastUpdateTimestamp; - //the id of the reserve. Represents the position in the list of the active reserves - uint16 id; -+ //timestamp until when liquidations are not allowed on the reserve, if set to past liquidations will be allowed -+ uint40 liquidationGracePeriodUntil; - //aToken address - address aTokenAddress; - //stableDebtToken address -@@ -499,6 +705,8 @@ library DataTypes { - uint128 unbacked; - //the outstanding debt borrowed against this asset in isolation mode - uint128 isolationModeTotalDebt; -+ //the amount of underlying accounted for by the protocol -+ uint128 virtualUnderlyingBalance; - } - - struct ReserveConfigurationMap { -@@ -512,15 +720,17 @@ library DataTypes { - //bit 59: stable rate borrowing enabled - //bit 60: asset is paused - //bit 61: borrowing in isolation mode is enabled -- //bit 62-63: reserved -+ //bit 62: siloed borrowing enabled -+ //bit 63: flashloaning enabled - //bit 64-79: reserve factor -- //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 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-255 unused -+ //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 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 -+ //bit 253-255 unused - - uint256 data; - } -@@ -655,6 +865,7 @@ library DataTypes { - uint256 maxStableRateBorrowSizePercent; - uint256 reservesCount; - address addressesProvider; -+ address pool; - uint8 userEModeCategory; - bool isAuthorizedFlashBorrower; - } -@@ -719,7 +930,8 @@ library DataTypes { - uint256 averageStableBorrowRate; - uint256 reserveFactor; - address reserve; -- address aToken; -+ bool usingVirtualBalance; -+ uint256 virtualUnderlyingBalance; - } - - struct InitReserveParams { -@@ -733,7 +945,7 @@ library DataTypes { - } - } - --// downloads/MAINNET/WALLET_BALANCE_PROVIDER/WalletBalanceProvider/@aave/core-v3/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol -+// src/core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol - - /// @title Gnosis Protocol v2 Safe ERC20 Transfer Library - /// @author Gnosis Developers -@@ -846,7 +1058,7 @@ library GPv2SafeERC20 { - } - } - --// downloads/MAINNET/WALLET_BALANCE_PROVIDER/WalletBalanceProvider/@aave/core-v3/contracts/interfaces/IPool.sol -+// src/core/contracts/interfaces/IPool.sol - - /** - * @title IPool -@@ -1224,6 +1436,14 @@ interface IPool { - */ - 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: -@@ -1265,7 +1485,7 @@ interface IPool { - * @notice Allows smartcontracts to access the liquidity of the pool within one transaction, - * as long as the amount taken plus a fee is returned. - * @dev IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept -- * into consideration. For further details please visit https://developers.aave.com -+ * into consideration. For further details please visit https://docs.aave.com/developers/ - * @param receiverAddress The address of the contract receiving the funds, implementing IFlashLoanReceiver interface - * @param assets The addresses of the assets being flash-borrowed - * @param amounts The amounts of the assets being flash-borrowed -@@ -1292,7 +1512,7 @@ interface IPool { - * @notice Allows smartcontracts to access the liquidity of the pool within one transaction, - * as long as the amount taken plus a fee is returned. - * @dev IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept -- * into consideration. For further details please visit https://developers.aave.com -+ * into consideration. For further details please visit https://docs.aave.com/developers/ - * @param receiverAddress The address of the contract receiving the funds, implementing IFlashLoanSimpleReceiver interface - * @param asset The address of the asset being flash-borrowed - * @param amount The amount of the asset being flash-borrowed -@@ -1368,6 +1588,22 @@ interface IPool { - address rateStrategyAddress - ) external; - -+ /** -+ * @notice Accumulates interest to all indexes of the reserve -+ * @dev Only callable by the PoolConfigurator contract -+ * @dev To be used when required by the configurator, for example when updating interest rates strategy data -+ * @param asset The address of the underlying asset of the reserve -+ */ -+ function syncIndexesState(address asset) external; -+ -+ /** -+ * @notice Updates interest rates on the reserve data -+ * @dev Only callable by the PoolConfigurator contract -+ * @dev To be used when required by the configurator, for example when updating interest rates strategy data -+ * @param asset The address of the underlying asset of the reserve -+ */ -+ function syncRatesState(address asset) external; -+ - /** - * @notice Sets the configuration bitmap of the reserve as a whole - * @dev Only callable by the PoolConfigurator contract -@@ -1423,7 +1659,23 @@ interface IPool { - * @param asset The address of the underlying asset of the reserve - * @return The state and configuration data of the reserve - */ -- function getReserveData(address asset) external view returns (DataTypes.ReserveData memory); -+ function getReserveData(address asset) external view returns (DataTypes.ReserveDataLegacy memory); -+ -+ /** -+ * @notice Returns the state and configuration of the reserve, including extra data included with Aave v3.1 -+ * @param asset The address of the underlying asset of the reserve -+ * @return The state and configuration data of the reserve with virtual accounting -+ */ -+ function getReserveDataExtended( -+ address asset -+ ) external view returns (DataTypes.ReserveData memory); -+ -+ /** -+ * @notice Returns the virtual underlying balance of the reserve -+ * @param asset The address of the underlying asset of the reserve -+ * @return The reserve virtual underlying balance -+ */ -+ function getVirtualUnderlyingBalance(address asset) external view returns (uint128); - - /** - * @notice Validates and finalizes an aToken transfer -@@ -1451,6 +1703,13 @@ interface IPool { - */ - function getReservesList() external view returns (address[] memory); - -+ /** -+ * @notice Returns the number of initialized reserves -+ * @dev It includes dropped reserves -+ * @return The count -+ */ -+ function getReservesCount() external view returns (uint256); -+ - /** - * @notice Returns the address of the underlying asset of a reserve by the reserve id as stored in the DataTypes.ReserveData struct - * @param id The id of the reserve as stored in the DataTypes.ReserveData struct -@@ -1521,6 +1780,22 @@ interface IPool { - */ - function resetIsolationModeTotalDebt(address asset) external; - -+ /** -+ * @notice Sets the liquidation grace period of the given asset -+ * @dev To enable a liquidation grace period, a timestamp in the future should be set, -+ * To disable a liquidation grace period, any timestamp in the past works, like 0 -+ * @param asset The address of the underlying asset to set the liquidationGracePeriod -+ * @param until Timestamp when the liquidation grace period will end -+ **/ -+ function setLiquidationGracePeriod(address asset, uint40 until) external; -+ -+ /** -+ * @notice Returns the liquidation grace period of the given asset -+ * @param asset The address of the underlying asset -+ * @return Timestamp when the liquidation grace period will end -+ **/ -+ 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 -@@ -1578,9 +1853,44 @@ interface IPool { - * 0 if the action is executed directly by the user, without any middle-man - */ - function deposit(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external; -+ -+ /** -+ * @notice Gets the address of the external FlashLoanLogic -+ */ -+ function getFlashLoanLogic() external view returns (address); -+ -+ /** -+ * @notice Gets the address of the external BorrowLogic -+ */ -+ function getBorrowLogic() external view returns (address); -+ -+ /** -+ * @notice Gets the address of the external BridgeLogic -+ */ -+ function getBridgeLogic() external view returns (address); -+ -+ /** -+ * @notice Gets the address of the external EModeLogic -+ */ -+ function getEModeLogic() external view returns (address); -+ -+ /** -+ * @notice Gets the address of the external LiquidationLogic -+ */ -+ function getLiquidationLogic() external view returns (address); -+ -+ /** -+ * @notice Gets the address of the external PoolLogic -+ */ -+ function getPoolLogic() external view returns (address); -+ -+ /** -+ * @notice Gets the address of the external SupplyLogic -+ */ -+ function getSupplyLogic() external view returns (address); - } - --// downloads/MAINNET/WALLET_BALANCE_PROVIDER/WalletBalanceProvider/@aave/core-v3/contracts/protocol/libraries/configuration/ReserveConfiguration.sol -+// src/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol - - /** - * @title ReserveConfiguration library -@@ -1607,6 +1917,7 @@ library ReserveConfiguration { - uint256 internal constant EMODE_CATEGORY_MASK = 0xFFFFFFFFFFFFFFFFFFFF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; // prettier-ignore - 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 - - /// @dev For the LTV, the start bit is 0 (up to 15), hence no bitshifting is needed - uint256 internal constant LIQUIDATION_THRESHOLD_START_BIT_POSITION = 16; -@@ -1627,6 +1938,7 @@ library ReserveConfiguration { - uint256 internal constant EMODE_CATEGORY_START_BIT_POSITION = 168; - 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; - - uint256 internal constant MAX_VALID_LTV = 65535; - uint256 internal constant MAX_VALID_LIQUIDATION_THRESHOLD = 65535; -@@ -2122,6 +2434,33 @@ library ReserveConfiguration { - return (self.data & ~FLASHLOAN_ENABLED_MASK) != 0; - } - -+ /** -+ * @notice Sets the virtual account active/not state of the reserve -+ * @param self The reserve configuration -+ * @param active The active state -+ */ -+ function setVirtualAccActive( -+ DataTypes.ReserveConfigurationMap memory self, -+ bool active -+ ) internal pure { -+ self.data = -+ (self.data & VIRTUAL_ACC_ACTIVE_MASK) | -+ (uint256(active ? 1 : 0) << VIRTUAL_ACC_START_BIT_POSITION); -+ } -+ -+ /** -+ * @notice Gets the virtual account active/not state of the reserve -+ * @dev The state should be true for all normal assets and should be false -+ * only in special cases (ex. GHO) where an asset is minted instead of supplied. -+ * @param self The reserve configuration -+ * @return The active state -+ */ -+ function getIsVirtualAccActive( -+ DataTypes.ReserveConfigurationMap memory self -+ ) internal pure returns (bool) { -+ return (self.data & ~VIRTUAL_ACC_ACTIVE_MASK) != 0; -+ } -+ - /** - * @notice Gets the configuration flags of the reserve - * @param self The reserve configuration -@@ -2188,7 +2527,7 @@ library ReserveConfiguration { - } - } - --// downloads/MAINNET/WALLET_BALANCE_PROVIDER/WalletBalanceProvider/@aave/periphery-v3/contracts/misc/WalletBalanceProvider.sol -+// downloads/ZKSYNC/WALLET_BALANCE_PROVIDER/WalletBalanceProvider/src/periphery/contracts/misc/WalletBalanceProvider.sol - - /** - * @title WalletBalanceProvider contract + ``` diff --git a/diffs/MAINNET_ZKSYNC/WETH_GATEWAY_DIFF.md b/diffs/MAINNET_ZKSYNC/WETH_GATEWAY_DIFF.md index ebbdca9a..4cc6c4ab 100644 --- a/diffs/MAINNET_ZKSYNC/WETH_GATEWAY_DIFF.md +++ b/diffs/MAINNET_ZKSYNC/WETH_GATEWAY_DIFF.md @@ -3,570 +3,21 @@ diff --git a/./downloads/MAINNET/WETH_GATEWAY.sol b/./downloads/ZKSYNC/WETH_GATE index 15fdf35..c07f0ff 100644 --- a/./downloads/MAINNET/WETH_GATEWAY.sol +++ b/./downloads/ZKSYNC/WETH_GATEWAY.sol -@@ -1,7 +1,39 @@ --// SPDX-License-Identifier: AGPL-3.0 -+// SPDX-License-Identifier: BUSL-1.1 - pragma solidity ^0.8.0 ^0.8.10; - --// downloads/MAINNET/WETH_GATEWAY/WrappedTokenGatewayV3/lib/aave-v3-core/contracts/dependencies/openzeppelin/contracts/Context.sol -+// downloads/ZKSYNC/WETH_GATEWAY/WrappedTokenGatewayV3/src/periphery/contracts/misc/interfaces/IWrappedTokenGatewayV3.sol -+ -+interface IWrappedTokenGatewayV3 { -+ function depositETH(address pool, address onBehalfOf, uint16 referralCode) external payable; -+ -+ function withdrawETH(address pool, uint256 amount, address onBehalfOf) external; -+ -+ function repayETH( -+ address pool, -+ uint256 amount, -+ uint256 rateMode, -+ address onBehalfOf -+ ) external payable; -+ -+ function borrowETH( -+ address pool, -+ uint256 amount, -+ uint256 interestRateMode, -+ uint16 referralCode -+ ) external; -+ -+ function withdrawETHWithPermit( -+ address pool, -+ uint256 amount, -+ address to, -+ uint256 deadline, -+ uint8 permitV, -+ bytes32 permitR, -+ bytes32 permitS -+ ) external; -+} -+ -+// src/core/contracts/dependencies/openzeppelin/contracts/Context.sol - - /* - * @dev Provides information about the current execution context, including the -@@ -24,7 +56,7 @@ abstract contract Context { - } - } - --// downloads/MAINNET/WETH_GATEWAY/WrappedTokenGatewayV3/lib/aave-v3-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol -+// src/core/contracts/dependencies/openzeppelin/contracts/IERC20.sol - - /** - * @dev Interface of the ERC20 standard as defined in the EIP. -@@ -100,7 +132,7 @@ interface IERC20 { - event Approval(address indexed owner, address indexed spender, uint256 value); - } - --// downloads/MAINNET/WETH_GATEWAY/WrappedTokenGatewayV3/lib/aave-v3-core/contracts/interfaces/IAaveIncentivesController.sol -+// src/core/contracts/interfaces/IAaveIncentivesController.sol - - /** - * @title IAaveIncentivesController -@@ -119,7 +151,7 @@ interface IAaveIncentivesController { - function handleAction(address user, uint256 totalSupply, uint256 userBalance) external; - } - --// downloads/MAINNET/WETH_GATEWAY/WrappedTokenGatewayV3/lib/aave-v3-core/contracts/interfaces/IPoolAddressesProvider.sol -+// src/core/contracts/interfaces/IPoolAddressesProvider.sol - - /** - * @title IPoolAddressesProvider -@@ -346,7 +378,7 @@ interface IPoolAddressesProvider { - function setPoolDataProvider(address newDataProvider) external; - } - --// downloads/MAINNET/WETH_GATEWAY/WrappedTokenGatewayV3/lib/aave-v3-core/contracts/interfaces/IScaledBalanceToken.sol -+// src/core/contracts/interfaces/IScaledBalanceToken.sol - - /** - * @title IScaledBalanceToken -@@ -418,7 +450,7 @@ interface IScaledBalanceToken { - function getPreviousIndex(address user) external view returns (uint256); - } - --// downloads/MAINNET/WETH_GATEWAY/WrappedTokenGatewayV3/lib/aave-v3-core/contracts/misc/interfaces/IWETH.sol -+// src/core/contracts/misc/interfaces/IWETH.sol - - interface IWETH { - function deposit() external payable; -@@ -430,7 +462,7 @@ interface IWETH { - function transferFrom(address src, address dst, uint256 wad) external returns (bool); - } - --// downloads/MAINNET/WETH_GATEWAY/WrappedTokenGatewayV3/lib/aave-v3-core/contracts/protocol/libraries/helpers/Errors.sol -+// src/core/contracts/protocol/libraries/helpers/Errors.sol - - /** - * @title Errors library -@@ -528,11 +560,56 @@ library Errors { - 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 -+ string public constant INVALID_MAX_RATE = '92'; // The expect maximum borrow rate is invalid -+ string public constant WITHDRAW_TO_ATOKEN = '93'; // Withdrawing to the aToken is not allowed -+ string public constant SUPPLY_TO_ATOKEN = '94'; // Supplying to the aToken is not allowed -+ string public constant SLOPE_2_MUST_BE_GTE_SLOPE_1 = '95'; // Variable interest rate slope 2 can not be lower than slope 1 -+ string public constant CALLER_NOT_RISK_OR_POOL_OR_EMERGENCY_ADMIN = '96'; // 'The caller of the function is not a risk, pool or emergency admin' -+ 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 - } - --// downloads/MAINNET/WETH_GATEWAY/WrappedTokenGatewayV3/lib/aave-v3-core/contracts/protocol/libraries/types/DataTypes.sol -+// src/core/contracts/protocol/libraries/types/DataTypes.sol - - library DataTypes { -+ /** -+ * This exists specifically to maintain the `getReserveData()` interface, since the new, internal -+ * `ReserveData` struct includes the reserve's `virtualUnderlyingBalance`. -+ */ -+ struct ReserveDataLegacy { -+ //stores the reserve configuration -+ ReserveConfigurationMap configuration; -+ //the liquidity index. Expressed in ray -+ uint128 liquidityIndex; -+ //the current supply rate. Expressed in ray -+ uint128 currentLiquidityRate; -+ //variable borrow index. Expressed in ray -+ uint128 variableBorrowIndex; -+ //the current variable borrow rate. Expressed in ray -+ uint128 currentVariableBorrowRate; -+ //the current stable borrow rate. Expressed in ray -+ uint128 currentStableBorrowRate; -+ //timestamp of last update -+ uint40 lastUpdateTimestamp; -+ //the id of the reserve. Represents the position in the list of the active reserves -+ uint16 id; -+ //aToken address -+ address aTokenAddress; -+ //stableDebtToken address -+ address stableDebtTokenAddress; -+ //variableDebtToken address -+ address variableDebtTokenAddress; -+ //address of the interest rate strategy -+ address interestRateStrategyAddress; -+ //the current treasury balance, scaled -+ uint128 accruedToTreasury; -+ //the outstanding unbacked aTokens minted through the bridging feature -+ uint128 unbacked; -+ //the outstanding debt borrowed against this asset in isolation mode -+ uint128 isolationModeTotalDebt; -+ } -+ - struct ReserveData { - //stores the reserve configuration - ReserveConfigurationMap configuration; -@@ -550,6 +627,8 @@ library DataTypes { - uint40 lastUpdateTimestamp; - //the id of the reserve. Represents the position in the list of the active reserves - uint16 id; -+ //timestamp until when liquidations are not allowed on the reserve, if set to past liquidations will be allowed -+ uint40 liquidationGracePeriodUntil; - //aToken address - address aTokenAddress; - //stableDebtToken address -@@ -564,6 +643,8 @@ library DataTypes { - uint128 unbacked; - //the outstanding debt borrowed against this asset in isolation mode - uint128 isolationModeTotalDebt; -+ //the amount of underlying accounted for by the protocol -+ uint128 virtualUnderlyingBalance; - } - - struct ReserveConfigurationMap { -@@ -580,13 +661,14 @@ library DataTypes { - //bit 62: siloed borrowing enabled - //bit 63: flashloaning enabled - //bit 64-79: reserve factor -- //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 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-255 unused -+ //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 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 -+ //bit 253-255 unused - - uint256 data; - } -@@ -721,6 +803,7 @@ library DataTypes { - uint256 maxStableRateBorrowSizePercent; - uint256 reservesCount; - address addressesProvider; -+ address pool; - uint8 userEModeCategory; - bool isAuthorizedFlashBorrower; - } -@@ -785,7 +868,8 @@ library DataTypes { - uint256 averageStableBorrowRate; - uint256 reserveFactor; - address reserve; -- address aToken; -+ bool usingVirtualBalance; -+ uint256 virtualUnderlyingBalance; - } - - struct InitReserveParams { -@@ -799,39 +883,7 @@ library DataTypes { - } - } - --// downloads/MAINNET/WETH_GATEWAY/WrappedTokenGatewayV3/lib/aave-v3-periphery/contracts/misc/interfaces/IWrappedTokenGatewayV3.sol -- --interface IWrappedTokenGatewayV3 { -- function depositETH(address pool, address onBehalfOf, uint16 referralCode) external payable; -- -- function withdrawETH(address pool, uint256 amount, address onBehalfOf) external; -- -- function repayETH( -- address pool, -- uint256 amount, -- uint256 rateMode, -- address onBehalfOf -- ) external payable; -- -- function borrowETH( -- address pool, -- uint256 amount, -- uint256 interestRateMode, -- uint16 referralCode -- ) external; -- -- function withdrawETHWithPermit( -- address pool, -- uint256 amount, -- address to, -- uint256 deadline, -- uint8 permitV, -- bytes32 permitR, -- bytes32 permitS -- ) external; --} -- --// downloads/MAINNET/WETH_GATEWAY/WrappedTokenGatewayV3/lib/aave-v3-core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol -+// src/core/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol - - /// @title Gnosis Protocol v2 Safe ERC20 Transfer Library - /// @author Gnosis Developers -@@ -944,7 +996,7 @@ library GPv2SafeERC20 { - } - } - --// downloads/MAINNET/WETH_GATEWAY/WrappedTokenGatewayV3/lib/aave-v3-core/contracts/dependencies/openzeppelin/contracts/Ownable.sol -+// src/core/contracts/dependencies/openzeppelin/contracts/Ownable.sol - - /** - * @dev Contract module which provides a basic access control mechanism, where -@@ -1010,7 +1062,33 @@ contract Ownable is Context { - } - } - --// downloads/MAINNET/WETH_GATEWAY/WrappedTokenGatewayV3/lib/aave-v3-core/contracts/interfaces/IPool.sol -+// downloads/ZKSYNC/WETH_GATEWAY/WrappedTokenGatewayV3/src/periphery/contracts/libraries/DataTypesHelper.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) -+ ); -+ } -+} -+ -+// src/core/contracts/interfaces/IPool.sol - - /** - * @title IPool -@@ -1388,6 +1466,14 @@ interface IPool { - */ - 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: -@@ -1532,6 +1618,22 @@ interface IPool { - address rateStrategyAddress - ) external; - -+ /** -+ * @notice Accumulates interest to all indexes of the reserve -+ * @dev Only callable by the PoolConfigurator contract -+ * @dev To be used when required by the configurator, for example when updating interest rates strategy data -+ * @param asset The address of the underlying asset of the reserve -+ */ -+ function syncIndexesState(address asset) external; -+ -+ /** -+ * @notice Updates interest rates on the reserve data -+ * @dev Only callable by the PoolConfigurator contract -+ * @dev To be used when required by the configurator, for example when updating interest rates strategy data -+ * @param asset The address of the underlying asset of the reserve -+ */ -+ function syncRatesState(address asset) external; -+ - /** - * @notice Sets the configuration bitmap of the reserve as a whole - * @dev Only callable by the PoolConfigurator contract -@@ -1587,7 +1689,23 @@ interface IPool { - * @param asset The address of the underlying asset of the reserve - * @return The state and configuration data of the reserve - */ -- function getReserveData(address asset) external view returns (DataTypes.ReserveData memory); -+ function getReserveData(address asset) external view returns (DataTypes.ReserveDataLegacy memory); -+ -+ /** -+ * @notice Returns the state and configuration of the reserve, including extra data included with Aave v3.1 -+ * @param asset The address of the underlying asset of the reserve -+ * @return The state and configuration data of the reserve with virtual accounting -+ */ -+ function getReserveDataExtended( -+ address asset -+ ) external view returns (DataTypes.ReserveData memory); -+ -+ /** -+ * @notice Returns the virtual underlying balance of the reserve -+ * @param asset The address of the underlying asset of the reserve -+ * @return The reserve virtual underlying balance -+ */ -+ function getVirtualUnderlyingBalance(address asset) external view returns (uint128); - - /** - * @notice Validates and finalizes an aToken transfer -@@ -1615,6 +1733,13 @@ interface IPool { - */ - function getReservesList() external view returns (address[] memory); - -+ /** -+ * @notice Returns the number of initialized reserves -+ * @dev It includes dropped reserves -+ * @return The count -+ */ -+ function getReservesCount() external view returns (uint256); -+ - /** - * @notice Returns the address of the underlying asset of a reserve by the reserve id as stored in the DataTypes.ReserveData struct - * @param id The id of the reserve as stored in the DataTypes.ReserveData struct -@@ -1685,6 +1810,22 @@ interface IPool { - */ - function resetIsolationModeTotalDebt(address asset) external; - -+ /** -+ * @notice Sets the liquidation grace period of the given asset -+ * @dev To enable a liquidation grace period, a timestamp in the future should be set, -+ * To disable a liquidation grace period, any timestamp in the past works, like 0 -+ * @param asset The address of the underlying asset to set the liquidationGracePeriod -+ * @param until Timestamp when the liquidation grace period will end -+ **/ -+ function setLiquidationGracePeriod(address asset, uint40 until) external; -+ -+ /** -+ * @notice Returns the liquidation grace period of the given asset -+ * @param asset The address of the underlying asset -+ * @return Timestamp when the liquidation grace period will end -+ **/ -+ 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 -@@ -1742,9 +1883,44 @@ interface IPool { - * 0 if the action is executed directly by the user, without any middle-man - */ - function deposit(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external; -+ -+ /** -+ * @notice Gets the address of the external FlashLoanLogic -+ */ -+ function getFlashLoanLogic() external view returns (address); -+ -+ /** -+ * @notice Gets the address of the external BorrowLogic -+ */ -+ function getBorrowLogic() external view returns (address); -+ -+ /** -+ * @notice Gets the address of the external BridgeLogic -+ */ -+ function getBridgeLogic() external view returns (address); -+ -+ /** -+ * @notice Gets the address of the external EModeLogic -+ */ -+ function getEModeLogic() external view returns (address); -+ -+ /** -+ * @notice Gets the address of the external LiquidationLogic -+ */ -+ function getLiquidationLogic() external view returns (address); -+ -+ /** -+ * @notice Gets the address of the external PoolLogic -+ */ -+ function getPoolLogic() external view returns (address); -+ -+ /** -+ * @notice Gets the address of the external SupplyLogic -+ */ -+ function getSupplyLogic() external view returns (address); - } - --// downloads/MAINNET/WETH_GATEWAY/WrappedTokenGatewayV3/lib/aave-v3-core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol -+// src/core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol - - /** - * @title ReserveConfiguration library -@@ -1771,6 +1947,7 @@ library ReserveConfiguration { - uint256 internal constant EMODE_CATEGORY_MASK = 0xFFFFFFFFFFFFFFFFFFFF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; // prettier-ignore - 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 - - /// @dev For the LTV, the start bit is 0 (up to 15), hence no bitshifting is needed - uint256 internal constant LIQUIDATION_THRESHOLD_START_BIT_POSITION = 16; -@@ -1791,6 +1968,7 @@ library ReserveConfiguration { - uint256 internal constant EMODE_CATEGORY_START_BIT_POSITION = 168; - 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; - - uint256 internal constant MAX_VALID_LTV = 65535; - uint256 internal constant MAX_VALID_LIQUIDATION_THRESHOLD = 65535; -@@ -2286,6 +2464,33 @@ library ReserveConfiguration { - return (self.data & ~FLASHLOAN_ENABLED_MASK) != 0; - } - -+ /** -+ * @notice Sets the virtual account active/not state of the reserve -+ * @param self The reserve configuration -+ * @param active The active state -+ */ -+ function setVirtualAccActive( -+ DataTypes.ReserveConfigurationMap memory self, -+ bool active -+ ) internal pure { -+ self.data = -+ (self.data & VIRTUAL_ACC_ACTIVE_MASK) | -+ (uint256(active ? 1 : 0) << VIRTUAL_ACC_START_BIT_POSITION); -+ } -+ -+ /** -+ * @notice Gets the virtual account active/not state of the reserve -+ * @dev The state should be true for all normal assets and should be false -+ * only in special cases (ex. GHO) where an asset is minted instead of supplied. -+ * @param self The reserve configuration -+ * @return The active state -+ */ -+ function getIsVirtualAccActive( -+ DataTypes.ReserveConfigurationMap memory self -+ ) internal pure returns (bool) { -+ return (self.data & ~VIRTUAL_ACC_ACTIVE_MASK) != 0; -+ } -+ - /** - * @notice Gets the configuration flags of the reserve - * @param self The reserve configuration -@@ -2352,33 +2557,7 @@ library ReserveConfiguration { - } - } - --// downloads/MAINNET/WETH_GATEWAY/WrappedTokenGatewayV3/lib/aave-v3-periphery/contracts/libraries/DataTypesHelper.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.ReserveData memory reserve -- ) internal view returns (uint256, uint256) { -- return ( -- IERC20(reserve.stableDebtTokenAddress).balanceOf(user), -- IERC20(reserve.variableDebtTokenAddress).balanceOf(user) -- ); -- } --} -- --// downloads/MAINNET/WETH_GATEWAY/WrappedTokenGatewayV3/lib/aave-v3-core/contracts/protocol/libraries/configuration/UserConfiguration.sol -+// src/core/contracts/protocol/libraries/configuration/UserConfiguration.sol - - /** - * @title UserConfiguration library -@@ -2610,7 +2789,7 @@ library UserConfiguration { - } - } - --// downloads/MAINNET/WETH_GATEWAY/WrappedTokenGatewayV3/lib/aave-v3-core/contracts/interfaces/IInitializableAToken.sol -+// src/core/contracts/interfaces/IInitializableAToken.sol - - /** - * @title IInitializableAToken -@@ -2663,7 +2842,7 @@ interface IInitializableAToken { - ) external; - } - --// downloads/MAINNET/WETH_GATEWAY/WrappedTokenGatewayV3/lib/aave-v3-core/contracts/interfaces/IAToken.sol -+// src/core/contracts/interfaces/IAToken.sol - - /** - * @title IAToken -@@ -2797,7 +2976,7 @@ interface IAToken is IERC20, IScaledBalanceToken, IInitializableAToken { - function rescueTokens(address token, address to, uint256 amount) external; - } - + -// downloads/MAINNET/WETH_GATEWAY/WrappedTokenGatewayV3/src/contracts/WrappedTokenGatewayV3.sol +// downloads/ZKSYNC/WETH_GATEWAY/WrappedTokenGatewayV3/src/periphery/contracts/misc/WrappedTokenGatewayV3.sol - + /** * @dev This contract is an upgrade of the WrappedTokenGatewayV3 contract, with immutable pool address. @@ -2808,8 +2987,8 @@ contract WrappedTokenGatewayV3 is IWrappedTokenGatewayV3, Ownable { using UserConfiguration for DataTypes.UserConfigurationMap; using GPv2SafeERC20 for IERC20; - + - IWETH public immutable WETH; - IPool public immutable POOL; + IWETH internal immutable WETH; + IPool internal immutable POOL; - + /** * @dev Sets the WETH address and the PoolAddressesProvider address. Infinite approves pool. ```