diff --git a/.gitignore b/.gitignore index 92845bde..349f6ba2 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ out/ # artifacts reports/ -diffs/ downloads/ # editors diff --git a/Makefile b/Makefile index f46c33c3..df8eb40f 100644 --- a/Makefile +++ b/Makefile @@ -36,3 +36,4 @@ download :; cast etherscan-source --chain ${chain} -d src/etherscan/${chain}_${a git-diff : @mkdir -p diffs @printf '%s\n%s\n%s\n' "\`\`\`diff" "$$(git diff --no-index --diff-algorithm=patience --ignore-space-at-eol ${before} ${after})" "\`\`\`" > diffs/${out}.md + diff --git a/diffs/MAINNET_ZKSYNC/AAVE_PROTOCOL_DATA_PROVIDER_DIFF.md b/diffs/MAINNET_ZKSYNC/AAVE_PROTOCOL_DATA_PROVIDER_DIFF.md new file mode 100644 index 00000000..bf7b3ef5 --- /dev/null +++ b/diffs/MAINNET_ZKSYNC/AAVE_PROTOCOL_DATA_PROVIDER_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/MAINNET/AAVE_PROTOCOL_DATA_PROVIDER.sol b/./downloads/ZKSYNC/AAVE_PROTOCOL_DATA_PROVIDER.sol +index 91cc016..35ccb13 100644 +--- a/./downloads/MAINNET/AAVE_PROTOCOL_DATA_PROVIDER.sol ++++ b/./downloads/ZKSYNC/AAVE_PROTOCOL_DATA_PROVIDER.sol + +``` diff --git a/diffs/MAINNET_ZKSYNC/ACL_MANAGER_DIFF.md b/diffs/MAINNET_ZKSYNC/ACL_MANAGER_DIFF.md new file mode 100644 index 00000000..0efeae09 --- /dev/null +++ b/diffs/MAINNET_ZKSYNC/ACL_MANAGER_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/MAINNET/ACL_MANAGER.sol b/./downloads/ZKSYNC/ACL_MANAGER.sol +index 8e5aac3..88e1973 100644 +--- a/./downloads/MAINNET/ACL_MANAGER.sol ++++ b/./downloads/ZKSYNC/ACL_MANAGER.sol + +``` diff --git a/diffs/MAINNET_ZKSYNC/BORROW_LOGIC_DIFF.md b/diffs/MAINNET_ZKSYNC/BORROW_LOGIC_DIFF.md new file mode 100644 index 00000000..c93a32ac --- /dev/null +++ b/diffs/MAINNET_ZKSYNC/BORROW_LOGIC_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/MAINNET/BORROW_LOGIC.sol b/./downloads/ZKSYNC/BORROW_LOGIC.sol +index 1a60f5e..d61106e 100644 +--- a/./downloads/MAINNET/BORROW_LOGIC.sol ++++ b/./downloads/ZKSYNC/BORROW_LOGIC.sol + +``` diff --git a/diffs/MAINNET_ZKSYNC/BRIDGE_LOGIC_DIFF.md b/diffs/MAINNET_ZKSYNC/BRIDGE_LOGIC_DIFF.md new file mode 100644 index 00000000..d7ac960e --- /dev/null +++ b/diffs/MAINNET_ZKSYNC/BRIDGE_LOGIC_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/MAINNET/BRIDGE_LOGIC.sol b/./downloads/ZKSYNC/BRIDGE_LOGIC.sol +index af3d37e..202afd6 100644 +--- a/./downloads/MAINNET/BRIDGE_LOGIC.sol ++++ b/./downloads/ZKSYNC/BRIDGE_LOGIC.sol + +``` diff --git a/diffs/MAINNET_ZKSYNC/COLLECTOR_IMPL_DIFF.md b/diffs/MAINNET_ZKSYNC/COLLECTOR_IMPL_DIFF.md new file mode 100644 index 00000000..8b43bcf9 --- /dev/null +++ b/diffs/MAINNET_ZKSYNC/COLLECTOR_IMPL_DIFF.md @@ -0,0 +1,31 @@ +```diff +diff --git a/./downloads/MAINNET/COLLECTOR_IMPL.sol b/./downloads/ZKSYNC/COLLECTOR_IMPL.sol +index 63ccda0..e453c1f 100644 +--- a/./downloads/MAINNET/COLLECTOR_IMPL.sol ++++ b/./downloads/ZKSYNC/COLLECTOR_IMPL.sol + +-// 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 {} +- + /// @inheritdoc ICollector + function setFundsAdmin(address admin) external onlyFundsAdmin { + _setFundsAdmin(admin); +``` diff --git a/diffs/MAINNET_ZKSYNC/CONFIGURATOR_LOGIC_DIFF.md b/diffs/MAINNET_ZKSYNC/CONFIGURATOR_LOGIC_DIFF.md new file mode 100644 index 00000000..3ab88180 --- /dev/null +++ b/diffs/MAINNET_ZKSYNC/CONFIGURATOR_LOGIC_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/MAINNET/CONFIGURATOR_LOGIC.sol b/./downloads/ZKSYNC/CONFIGURATOR_LOGIC.sol +index 54ee17a..70934b0 100644 +--- a/./downloads/MAINNET/CONFIGURATOR_LOGIC.sol ++++ b/./downloads/ZKSYNC/CONFIGURATOR_LOGIC.sol + +``` diff --git a/diffs/MAINNET_ZKSYNC/DEFAULT_A_TOKEN_IMPL_DIFF.md b/diffs/MAINNET_ZKSYNC/DEFAULT_A_TOKEN_IMPL_DIFF.md new file mode 100644 index 00000000..6fdd8005 --- /dev/null +++ b/diffs/MAINNET_ZKSYNC/DEFAULT_A_TOKEN_IMPL_DIFF.md @@ -0,0 +1,151 @@ +```diff +diff --git a/./downloads/MAINNET/DEFAULT_A_TOKEN_IMPL.sol b/./downloads/ZKSYNC/DEFAULT_A_TOKEN_IMPL.sol +index 36ee10c..459d34e 100644 +--- a/./downloads/MAINNET/DEFAULT_A_TOKEN_IMPL.sol ++++ b/./downloads/ZKSYNC/DEFAULT_A_TOKEN_IMPL.sol + +-// 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 { + /** + * @dev Constructor. + * @param pool The reference to the main Pool contract +- * @param name The name of the token +- * @param symbol The symbol of the token +- * @param decimals The number of decimals of the token ++ * @param name_ The name of the token ++ * @param symbol_ The symbol of the token ++ * @param decimals_ The number of decimals of the token + */ +- constructor(IPool pool, string memory name, string memory symbol, uint8 decimals) { ++ constructor(IPool pool, string memory name_, string memory symbol_, uint8 decimals_) { + _addressesProvider = pool.ADDRESSES_PROVIDER(); +- _name = name; +- _symbol = symbol; +- _decimals = decimals; ++ _name = name_; ++ _symbol = symbol_; ++ _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/AToken.sol ++// downloads/ZKSYNC/DEFAULT_A_TOKEN_IMPL/ATokenInstance/src/core/contracts/protocol/tokenization/AToken.sol + + /** + * @title Aave ERC20 AToken + * @author Aave + * @notice Implementation of the interest bearing token for the Aave protocol + */ +-contract AToken is VersionedInitializable, ScaledBalanceTokenBase, EIP712Base, IAToken { ++abstract contract AToken is VersionedInitializable, ScaledBalanceTokenBase, EIP712Base, IAToken { + using WadRayMath for uint256; + using SafeCast for uint256; + using GPv2SafeERC20 for IERC20; +@@ -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; +- } +- + /** + * @dev Constructor. + * @param pool The address of the Pool contract +@@ -3012,29 +3156,7 @@ contract AToken is VersionedInitializable, ScaledBalanceTokenBase, EIP712Base, I + string calldata aTokenName, + string calldata aTokenSymbol, + bytes calldata params +- ) public virtual override initializer { +- require(initializingPool == POOL, Errors.POOL_ADDRESSES_DO_NOT_MATCH); +- _setName(aTokenName); +- _setSymbol(aTokenSymbol); +- _setDecimals(aTokenDecimals); +- +- _treasury = treasury; +- _underlyingAsset = underlyingAsset; +- _incentivesController = incentivesController; +- +- _domainSeparator = _calculateDomainSeparator(); +- +- emit Initialized( +- underlyingAsset, +- address(POOL), +- treasury, +- address(incentivesController), +- aTokenDecimals, +- aTokenName, +- aTokenSymbol, +- params +- ); +- } ++ ) public virtual; + + /// @inheritdoc IAToken + function mint( +@@ -3208,3 +3330,50 @@ contract AToken is VersionedInitializable, ScaledBalanceTokenBase, EIP712Base, I + IERC20(token).safeTransfer(to, amount); + } + } ++ ++// downloads/ZKSYNC/DEFAULT_A_TOKEN_IMPL/ATokenInstance/src/core/instances/ATokenInstance.sol ++ ++contract ATokenInstance is AToken { ++ uint256 public constant ATOKEN_REVISION = 1; ++ ++ constructor(IPool pool) AToken(pool) {} ++ ++ /// @inheritdoc VersionedInitializable ++ function getRevision() internal pure virtual override returns (uint256) { ++ return ATOKEN_REVISION; ++ } ++ ++ /// @inheritdoc IInitializableAToken ++ function initialize( ++ IPool initializingPool, ++ address treasury, ++ address underlyingAsset, ++ IAaveIncentivesController incentivesController, ++ uint8 aTokenDecimals, ++ string calldata aTokenName, ++ string calldata aTokenSymbol, ++ bytes calldata params ++ ) public virtual override initializer { ++ require(initializingPool == POOL, Errors.POOL_ADDRESSES_DO_NOT_MATCH); ++ _setName(aTokenName); ++ _setSymbol(aTokenSymbol); ++ _setDecimals(aTokenDecimals); ++ ++ _treasury = treasury; ++ _underlyingAsset = underlyingAsset; ++ _incentivesController = incentivesController; ++ ++ _domainSeparator = _calculateDomainSeparator(); ++ ++ emit Initialized( ++ underlyingAsset, ++ address(POOL), ++ treasury, ++ address(incentivesController), ++ aTokenDecimals, ++ aTokenName, ++ aTokenSymbol, ++ params ++ ); ++ } ++} +``` diff --git a/diffs/MAINNET_ZKSYNC/DEFAULT_INCENTIVES_CONTROLLER_IMPL_DIFF.md b/diffs/MAINNET_ZKSYNC/DEFAULT_INCENTIVES_CONTROLLER_IMPL_DIFF.md new file mode 100644 index 00000000..2dd78b39 --- /dev/null +++ b/diffs/MAINNET_ZKSYNC/DEFAULT_INCENTIVES_CONTROLLER_IMPL_DIFF.md @@ -0,0 +1,34 @@ +```diff +diff --git a/./downloads/MAINNET/DEFAULT_INCENTIVES_CONTROLLER_IMPL.sol b/./downloads/ZKSYNC/DEFAULT_INCENTIVES_CONTROLLER_IMPL.sol +index e94b837..455ec9b 100644 +--- a/./downloads/MAINNET/DEFAULT_INCENTIVES_CONTROLLER_IMPL.sol ++++ b/./downloads/ZKSYNC/DEFAULT_INCENTIVES_CONTROLLER_IMPL.sol + +-// 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 { + function getRewardsData( + address asset, + address reward +- ) public view override returns (uint256, uint256, uint256, uint256) { ++ ) external view override returns (uint256, uint256, uint256, uint256) { + return ( + _assets[asset].rewards[reward].index, + _assets[asset].rewards[reward].emissionPerSecond, +@@ -1067,7 +1067,7 @@ abstract contract RewardsDistributor is IRewardsDistributor { + address user, + address asset, + address reward +- ) public view override returns (uint256) { ++ ) external view override returns (uint256) { + return _assets[asset].rewards[reward].usersData[user].index; + } + +@@ -1506,7 +1506,7 @@ abstract contract RewardsDistributor is IRewardsDistributor { + } + } + +``` diff --git a/diffs/MAINNET_ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL_DIFF.md b/diffs/MAINNET_ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL_DIFF.md new file mode 100644 index 00000000..f7d6c22e --- /dev/null +++ b/diffs/MAINNET_ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL_DIFF.md @@ -0,0 +1,509 @@ +```diff +diff --git a/./downloads/MAINNET/DEFAULT_STABLE_DEBT_TOKEN_IMPL.sol b/./downloads/ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL.sol +index 87f3628..35e192c 100644 +--- a/./downloads/MAINNET/DEFAULT_STABLE_DEBT_TOKEN_IMPL.sol ++++ b/./downloads/ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL.sol + +-// 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 { + /** + * @dev Constructor. + * @param pool The reference to the main Pool contract +- * @param name The name of the token +- * @param symbol The symbol of the token +- * @param decimals The number of decimals of the token ++ * @param name_ The name of the token ++ * @param symbol_ The symbol of the token ++ * @param decimals_ The number of decimals of the token + */ +- constructor(IPool pool, string memory name, string memory symbol, uint8 decimals) { ++ constructor(IPool pool, string memory name_, string memory symbol_, uint8 decimals_) { + _addressesProvider = pool.ADDRESSES_PROVIDER(); +- _name = name; +- _symbol = symbol; +- _decimals = decimals; ++ _name = name_; ++ _symbol = symbol_; ++ _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 { + * at stable rate mode + * @dev Transfer and approve functionalities are disabled since its a non-transferable token + */ +-contract StableDebtToken is DebtTokenBase, IncentivizedERC20, IStableDebtToken { +- using WadRayMath for uint256; +- using SafeCast for uint256; +- +- uint256 public constant DEBT_TOKEN_REVISION = 0x1; +- +- // Map of users address and the timestamp of their last update (userAddress => lastUpdateTimestamp) +- mapping(address => uint40) internal _timestamps; +- +- uint128 internal _avgStableRate; +- +- // Timestamp of the last update of the total supply +- uint40 internal _totalSupplyTimestamp; +- ++abstract contract StableDebtToken is DebtTokenBase, IncentivizedERC20, IStableDebtToken { + /** + * @dev Constructor. + * @param pool The address of the Pool contract +@@ -2856,6 +2897,128 @@ contract StableDebtToken is DebtTokenBase, IncentivizedERC20, IStableDebtToken { + // Intentionally left blank + } + ++ /// @inheritdoc IInitializableDebtToken ++ function initialize( ++ IPool initializingPool, ++ address underlyingAsset, ++ IAaveIncentivesController incentivesController, ++ uint8 debtTokenDecimals, ++ string memory debtTokenName, ++ string memory debtTokenSymbol, ++ bytes calldata params ++ ) external virtual; ++ ++ /// @inheritdoc IStableDebtToken ++ function getAverageStableRate() external pure virtual override returns (uint256) { ++ return 0; ++ } ++ ++ /// @inheritdoc IStableDebtToken ++ function getUserLastUpdated(address) external pure virtual override returns (uint40) { ++ return 0; ++ } ++ ++ /// @inheritdoc IStableDebtToken ++ function getUserStableRate(address) external pure virtual override returns (uint256) { ++ return 0; ++ } ++ ++ /// @inheritdoc IERC20 ++ function balanceOf(address) public pure virtual override returns (uint256) { ++ return 0; ++ } ++ ++ /// @inheritdoc IStableDebtToken ++ function mint( ++ address, ++ address, ++ uint256, ++ uint256 ++ ) external virtual override onlyPool returns (bool, uint256, uint256) { ++ revert(Errors.OPERATION_NOT_SUPPORTED); ++ } ++ ++ /// @inheritdoc IStableDebtToken ++ function burn(address, uint256) external virtual override onlyPool returns (uint256, uint256) { ++ revert(Errors.OPERATION_NOT_SUPPORTED); ++ } ++ ++ /// @inheritdoc IStableDebtToken ++ function getSupplyData() external pure override returns (uint256, uint256, uint256, uint40) { ++ return (0, 0, 0, 0); ++ } ++ ++ /// @inheritdoc IStableDebtToken ++ function getTotalSupplyAndAvgRate() external pure override returns (uint256, uint256) { ++ return (0, 0); ++ } ++ ++ /// @inheritdoc IERC20 ++ function totalSupply() public pure virtual override returns (uint256) { ++ return 0; ++ } ++ ++ /// @inheritdoc IStableDebtToken ++ function getTotalSupplyLastUpdated() external pure override returns (uint40) { ++ return 0; ++ } ++ ++ /// @inheritdoc IStableDebtToken ++ function principalBalanceOf(address) external pure virtual override returns (uint256) { ++ return 0; ++ } ++ ++ /// @inheritdoc IStableDebtToken ++ function UNDERLYING_ASSET_ADDRESS() external view override returns (address) { ++ return _underlyingAsset; ++ } ++ ++ /// @inheritdoc EIP712Base ++ function _EIP712BaseId() internal view override returns (string memory) { ++ return name(); ++ } ++ ++ /** ++ * @dev Being non transferrable, the debt token does not implement any of the ++ * standard ERC20 functions for transfer and allowance. ++ */ ++ function transfer(address, uint256) external virtual override returns (bool) { ++ revert(Errors.OPERATION_NOT_SUPPORTED); ++ } ++ ++ function allowance(address, address) external view virtual override returns (uint256) { ++ revert(Errors.OPERATION_NOT_SUPPORTED); ++ } ++ ++ function approve(address, uint256) external virtual override returns (bool) { ++ revert(Errors.OPERATION_NOT_SUPPORTED); ++ } ++ ++ function transferFrom(address, address, uint256) external virtual override returns (bool) { ++ revert(Errors.OPERATION_NOT_SUPPORTED); ++ } ++ ++ function increaseAllowance(address, uint256) external virtual override returns (bool) { ++ revert(Errors.OPERATION_NOT_SUPPORTED); ++ } ++ ++ function decreaseAllowance(address, uint256) external virtual override returns (bool) { ++ revert(Errors.OPERATION_NOT_SUPPORTED); ++ } ++} ++ ++// downloads/ZKSYNC/DEFAULT_STABLE_DEBT_TOKEN_IMPL/StableDebtTokenInstance/src/core/instances/StableDebtTokenInstance.sol ++ ++contract StableDebtTokenInstance is StableDebtToken { ++ uint256 public constant DEBT_TOKEN_REVISION = 1; ++ ++ constructor(IPool pool) StableDebtToken(pool) {} ++ ++ /// @inheritdoc VersionedInitializable ++ function getRevision() internal pure virtual override returns (uint256) { ++ return DEBT_TOKEN_REVISION; ++ } ++ + /// @inheritdoc IInitializableDebtToken + function initialize( + IPool initializingPool, +@@ -2886,313 +3049,4 @@ contract StableDebtToken is DebtTokenBase, IncentivizedERC20, IStableDebtToken { + params + ); + } +- +- /// @inheritdoc VersionedInitializable +- function getRevision() internal pure virtual override returns (uint256) { +- return DEBT_TOKEN_REVISION; +- } +- +- /// @inheritdoc IStableDebtToken +- function getAverageStableRate() external view virtual override returns (uint256) { +- return _avgStableRate; +- } +- +- /// @inheritdoc IStableDebtToken +- function getUserLastUpdated(address user) external view virtual override returns (uint40) { +- return _timestamps[user]; +- } +- +- /// @inheritdoc IStableDebtToken +- function getUserStableRate(address user) external view virtual override returns (uint256) { +- return _userState[user].additionalData; +- } +- +- /// @inheritdoc IERC20 +- function balanceOf(address account) public view virtual override returns (uint256) { +- uint256 accountBalance = super.balanceOf(account); +- uint256 stableRate = _userState[account].additionalData; +- if (accountBalance == 0) { +- return 0; +- } +- uint256 cumulatedInterest = MathUtils.calculateCompoundedInterest( +- stableRate, +- _timestamps[account] +- ); +- return accountBalance.rayMul(cumulatedInterest); +- } +- +- struct MintLocalVars { +- uint256 previousSupply; +- uint256 nextSupply; +- uint256 amountInRay; +- uint256 currentStableRate; +- uint256 nextStableRate; +- uint256 currentAvgStableRate; +- } +- +- /// @inheritdoc IStableDebtToken +- function mint( +- address user, +- address onBehalfOf, +- uint256 amount, +- uint256 rate +- ) external virtual override onlyPool returns (bool, uint256, uint256) { +- MintLocalVars memory vars; +- +- if (user != onBehalfOf) { +- _decreaseBorrowAllowance(onBehalfOf, user, amount); +- } +- +- (, uint256 currentBalance, uint256 balanceIncrease) = _calculateBalanceIncrease(onBehalfOf); +- +- vars.previousSupply = totalSupply(); +- vars.currentAvgStableRate = _avgStableRate; +- vars.nextSupply = _totalSupply = vars.previousSupply + amount; +- +- vars.amountInRay = amount.wadToRay(); +- +- vars.currentStableRate = _userState[onBehalfOf].additionalData; +- vars.nextStableRate = (vars.currentStableRate.rayMul(currentBalance.wadToRay()) + +- vars.amountInRay.rayMul(rate)).rayDiv((currentBalance + amount).wadToRay()); +- +- _userState[onBehalfOf].additionalData = vars.nextStableRate.toUint128(); +- +- //solium-disable-next-line +- _totalSupplyTimestamp = _timestamps[onBehalfOf] = uint40(block.timestamp); +- +- // Calculates the updated average stable rate +- vars.currentAvgStableRate = _avgStableRate = ( +- (vars.currentAvgStableRate.rayMul(vars.previousSupply.wadToRay()) + +- rate.rayMul(vars.amountInRay)).rayDiv(vars.nextSupply.wadToRay()) +- ).toUint128(); +- +- uint256 amountToMint = amount + balanceIncrease; +- _mint(onBehalfOf, amountToMint, vars.previousSupply); +- +- emit Transfer(address(0), onBehalfOf, amountToMint); +- emit Mint( +- user, +- onBehalfOf, +- amountToMint, +- currentBalance, +- balanceIncrease, +- vars.nextStableRate, +- vars.currentAvgStableRate, +- vars.nextSupply +- ); +- +- return (currentBalance == 0, vars.nextSupply, vars.currentAvgStableRate); +- } +- +- /// @inheritdoc IStableDebtToken +- function burn( +- address from, +- uint256 amount +- ) external virtual override onlyPool returns (uint256, uint256) { +- (, uint256 currentBalance, uint256 balanceIncrease) = _calculateBalanceIncrease(from); +- +- uint256 previousSupply = totalSupply(); +- uint256 nextAvgStableRate = 0; +- uint256 nextSupply = 0; +- uint256 userStableRate = _userState[from].additionalData; +- +- // Since the total supply and each single user debt accrue separately, +- // there might be accumulation errors so that the last borrower repaying +- // might actually try to repay more than the available debt supply. +- // In this case we simply set the total supply and the avg stable rate to 0 +- if (previousSupply <= amount) { +- _avgStableRate = 0; +- _totalSupply = 0; +- } else { +- nextSupply = _totalSupply = previousSupply - amount; +- uint256 firstTerm = uint256(_avgStableRate).rayMul(previousSupply.wadToRay()); +- uint256 secondTerm = userStableRate.rayMul(amount.wadToRay()); +- +- // For the same reason described above, when the last user is repaying it might +- // happen that user rate * user balance > avg rate * total supply. In that case, +- // we simply set the avg rate to 0 +- if (secondTerm >= firstTerm) { +- nextAvgStableRate = _totalSupply = _avgStableRate = 0; +- } else { +- nextAvgStableRate = _avgStableRate = ( +- (firstTerm - secondTerm).rayDiv(nextSupply.wadToRay()) +- ).toUint128(); +- } +- } +- +- if (amount == currentBalance) { +- _userState[from].additionalData = 0; +- _timestamps[from] = 0; +- } else { +- //solium-disable-next-line +- _timestamps[from] = uint40(block.timestamp); +- } +- //solium-disable-next-line +- _totalSupplyTimestamp = uint40(block.timestamp); +- +- if (balanceIncrease > amount) { +- uint256 amountToMint = balanceIncrease - amount; +- _mint(from, amountToMint, previousSupply); +- emit Transfer(address(0), from, amountToMint); +- emit Mint( +- from, +- from, +- amountToMint, +- currentBalance, +- balanceIncrease, +- userStableRate, +- nextAvgStableRate, +- nextSupply +- ); +- } else { +- uint256 amountToBurn = amount - balanceIncrease; +- _burn(from, amountToBurn, previousSupply); +- emit Transfer(from, address(0), amountToBurn); +- emit Burn(from, amountToBurn, currentBalance, balanceIncrease, nextAvgStableRate, nextSupply); +- } +- +- return (nextSupply, nextAvgStableRate); +- } +- +- /** +- * @notice Calculates the increase in balance since the last user interaction +- * @param user The address of the user for which the interest is being accumulated +- * @return The previous principal balance +- * @return The new principal balance +- * @return The balance increase +- */ +- function _calculateBalanceIncrease( +- address user +- ) internal view returns (uint256, uint256, uint256) { +- uint256 previousPrincipalBalance = super.balanceOf(user); +- +- if (previousPrincipalBalance == 0) { +- return (0, 0, 0); +- } +- +- uint256 newPrincipalBalance = balanceOf(user); +- +- return ( +- previousPrincipalBalance, +- newPrincipalBalance, +- newPrincipalBalance - previousPrincipalBalance +- ); +- } +- +- /// @inheritdoc IStableDebtToken +- function getSupplyData() external view override returns (uint256, uint256, uint256, uint40) { +- uint256 avgRate = _avgStableRate; +- return (super.totalSupply(), _calcTotalSupply(avgRate), avgRate, _totalSupplyTimestamp); +- } +- +- /// @inheritdoc IStableDebtToken +- function getTotalSupplyAndAvgRate() external view override returns (uint256, uint256) { +- uint256 avgRate = _avgStableRate; +- return (_calcTotalSupply(avgRate), avgRate); +- } +- +- /// @inheritdoc IERC20 +- function totalSupply() public view virtual override returns (uint256) { +- return _calcTotalSupply(_avgStableRate); +- } +- +- /// @inheritdoc IStableDebtToken +- function getTotalSupplyLastUpdated() external view override returns (uint40) { +- return _totalSupplyTimestamp; +- } +- +- /// @inheritdoc IStableDebtToken +- function principalBalanceOf(address user) external view virtual override returns (uint256) { +- return super.balanceOf(user); +- } +- +- /// @inheritdoc IStableDebtToken +- function UNDERLYING_ASSET_ADDRESS() external view override returns (address) { +- return _underlyingAsset; +- } +- +- /** +- * @notice Calculates the total supply +- * @param avgRate The average rate at which the total supply increases +- * @return The debt balance of the user since the last burn/mint action +- */ +- function _calcTotalSupply(uint256 avgRate) internal view returns (uint256) { +- uint256 principalSupply = super.totalSupply(); +- +- if (principalSupply == 0) { +- return 0; +- } +- +- uint256 cumulatedInterest = MathUtils.calculateCompoundedInterest( +- avgRate, +- _totalSupplyTimestamp +- ); +- +- return principalSupply.rayMul(cumulatedInterest); +- } +- +- /** +- * @notice Mints stable debt tokens to a user +- * @param account The account receiving the debt tokens +- * @param amount The amount being minted +- * @param oldTotalSupply The total supply before the minting event +- */ +- function _mint(address account, uint256 amount, uint256 oldTotalSupply) internal { +- uint128 castAmount = amount.toUint128(); +- uint128 oldAccountBalance = _userState[account].balance; +- _userState[account].balance = oldAccountBalance + castAmount; +- +- if (address(_incentivesController) != address(0)) { +- _incentivesController.handleAction(account, oldTotalSupply, oldAccountBalance); +- } +- } +- +- /** +- * @notice Burns stable debt tokens of a user +- * @param account The user getting his debt burned +- * @param amount The amount being burned +- * @param oldTotalSupply The total supply before the burning event +- */ +- function _burn(address account, uint256 amount, uint256 oldTotalSupply) internal { +- uint128 castAmount = amount.toUint128(); +- uint128 oldAccountBalance = _userState[account].balance; +- _userState[account].balance = oldAccountBalance - castAmount; +- +- if (address(_incentivesController) != address(0)) { +- _incentivesController.handleAction(account, oldTotalSupply, oldAccountBalance); +- } +- } +- +- /// @inheritdoc EIP712Base +- function _EIP712BaseId() internal view override returns (string memory) { +- return name(); +- } +- +- /** +- * @dev Being non transferrable, the debt token does not implement any of the +- * standard ERC20 functions for transfer and allowance. +- */ +- function transfer(address, uint256) external virtual override returns (bool) { +- revert(Errors.OPERATION_NOT_SUPPORTED); +- } +- +- function allowance(address, address) external view virtual override returns (uint256) { +- revert(Errors.OPERATION_NOT_SUPPORTED); +- } +- +- function approve(address, uint256) external virtual override returns (bool) { +- revert(Errors.OPERATION_NOT_SUPPORTED); +- } +- +- function transferFrom(address, address, uint256) external virtual override returns (bool) { +- revert(Errors.OPERATION_NOT_SUPPORTED); +- } +- +- function increaseAllowance(address, uint256) external virtual override returns (bool) { +- revert(Errors.OPERATION_NOT_SUPPORTED); +- } +- +- function decreaseAllowance(address, uint256) external virtual override returns (bool) { +- revert(Errors.OPERATION_NOT_SUPPORTED); +- } + } +``` diff --git a/diffs/MAINNET_ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL_DIFF.md b/diffs/MAINNET_ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL_DIFF.md new file mode 100644 index 00000000..22c7d126 --- /dev/null +++ b/diffs/MAINNET_ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL_DIFF.md @@ -0,0 +1,140 @@ +```diff +diff --git a/./downloads/MAINNET/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL.sol b/./downloads/ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL.sol +index d195593..885ee20 100644 +--- a/./downloads/MAINNET/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL.sol ++++ b/./downloads/ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL.sol + +-// 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 { + /** + * @dev Constructor. + * @param pool The reference to the main Pool contract +- * @param name The name of the token +- * @param symbol The symbol of the token +- * @param decimals The number of decimals of the token ++ * @param name_ The name of the token ++ * @param symbol_ The symbol of the token ++ * @param decimals_ The number of decimals of the token + */ +- constructor(IPool pool, string memory name, string memory symbol, uint8 decimals) { ++ constructor(IPool pool, string memory name_, string memory symbol_, uint8 decimals_) { + _addressesProvider = pool.ADDRESSES_PROVIDER(); +- _name = name; +- _symbol = symbol; +- _decimals = decimals; ++ _name = name_; ++ _symbol = symbol_; ++ _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/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 + * at variable rate mode + * @dev Transfer and approve functionalities are disabled since its a non-transferable token + */ +-contract VariableDebtToken is DebtTokenBase, ScaledBalanceTokenBase, IVariableDebtToken { ++abstract contract VariableDebtToken is DebtTokenBase, ScaledBalanceTokenBase, IVariableDebtToken { + using WadRayMath for uint256; + using SafeCast for uint256; + +- uint256 public constant DEBT_TOKEN_REVISION = 0x1; +- + /** + * @dev Constructor. + * @param pool The address of the Pool contract +@@ -2952,32 +3101,7 @@ contract VariableDebtToken is DebtTokenBase, ScaledBalanceTokenBase, IVariableDe + string memory debtTokenName, + string memory debtTokenSymbol, + bytes calldata params +- ) external override initializer { +- require(initializingPool == POOL, Errors.POOL_ADDRESSES_DO_NOT_MATCH); +- _setName(debtTokenName); +- _setSymbol(debtTokenSymbol); +- _setDecimals(debtTokenDecimals); +- +- _underlyingAsset = underlyingAsset; +- _incentivesController = incentivesController; +- +- _domainSeparator = _calculateDomainSeparator(); +- +- emit Initialized( +- underlyingAsset, +- address(POOL), +- address(incentivesController), +- debtTokenDecimals, +- debtTokenName, +- debtTokenSymbol, +- params +- ); +- } +- +- /// @inheritdoc VersionedInitializable +- function getRevision() internal pure virtual override returns (uint256) { +- 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 + return _underlyingAsset; + } + } ++ ++// downloads/ZKSYNC/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtTokenInstance/src/core/instances/VariableDebtTokenInstance.sol ++ ++contract VariableDebtTokenInstance is VariableDebtToken { ++ uint256 public constant DEBT_TOKEN_REVISION = 1; ++ ++ constructor(IPool pool) VariableDebtToken(pool) {} ++ ++ /// @inheritdoc VersionedInitializable ++ function getRevision() internal pure virtual override returns (uint256) { ++ return DEBT_TOKEN_REVISION; ++ } ++ ++ /// @inheritdoc IInitializableDebtToken ++ function initialize( ++ IPool initializingPool, ++ address underlyingAsset, ++ IAaveIncentivesController incentivesController, ++ uint8 debtTokenDecimals, ++ string memory debtTokenName, ++ string memory debtTokenSymbol, ++ bytes calldata params ++ ) external override initializer { ++ require(initializingPool == POOL, Errors.POOL_ADDRESSES_DO_NOT_MATCH); ++ _setName(debtTokenName); ++ _setSymbol(debtTokenSymbol); ++ _setDecimals(debtTokenDecimals); ++ ++ _underlyingAsset = underlyingAsset; ++ _incentivesController = incentivesController; ++ ++ _domainSeparator = _calculateDomainSeparator(); ++ ++ emit Initialized( ++ underlyingAsset, ++ address(POOL), ++ address(incentivesController), ++ debtTokenDecimals, ++ debtTokenName, ++ debtTokenSymbol, ++ params ++ ); ++ } ++} +``` diff --git a/diffs/MAINNET_ZKSYNC/EMISSION_MANAGER_DIFF.md b/diffs/MAINNET_ZKSYNC/EMISSION_MANAGER_DIFF.md new file mode 100644 index 00000000..47fff128 --- /dev/null +++ b/diffs/MAINNET_ZKSYNC/EMISSION_MANAGER_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/MAINNET/EMISSION_MANAGER.sol b/./downloads/ZKSYNC/EMISSION_MANAGER.sol +index 0f66685..16d9cb7 100644 +--- a/./downloads/MAINNET/EMISSION_MANAGER.sol ++++ b/./downloads/ZKSYNC/EMISSION_MANAGER.sol + +``` diff --git a/diffs/MAINNET_ZKSYNC/EMODE_LOGIC_DIFF.md b/diffs/MAINNET_ZKSYNC/EMODE_LOGIC_DIFF.md new file mode 100644 index 00000000..7a92034b --- /dev/null +++ b/diffs/MAINNET_ZKSYNC/EMODE_LOGIC_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/MAINNET/EMODE_LOGIC.sol b/./downloads/ZKSYNC/EMODE_LOGIC.sol +index ad40d1b..97162e1 100644 +--- a/./downloads/MAINNET/EMODE_LOGIC.sol ++++ b/./downloads/ZKSYNC/EMODE_LOGIC.sol + +``` diff --git a/diffs/MAINNET_ZKSYNC/FLASHLOAN_LOGIC_DIFF.md b/diffs/MAINNET_ZKSYNC/FLASHLOAN_LOGIC_DIFF.md new file mode 100644 index 00000000..82fe71e2 --- /dev/null +++ b/diffs/MAINNET_ZKSYNC/FLASHLOAN_LOGIC_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/MAINNET/FLASHLOAN_LOGIC.sol b/./downloads/ZKSYNC/FLASHLOAN_LOGIC.sol +index 38cfa3b..5c4cbd2 100644 +--- a/./downloads/MAINNET/FLASHLOAN_LOGIC.sol ++++ b/./downloads/ZKSYNC/FLASHLOAN_LOGIC.sol + +``` diff --git a/diffs/MAINNET_ZKSYNC/LIQUIDATION_LOGIC_DIFF.md b/diffs/MAINNET_ZKSYNC/LIQUIDATION_LOGIC_DIFF.md new file mode 100644 index 00000000..370e1137 --- /dev/null +++ b/diffs/MAINNET_ZKSYNC/LIQUIDATION_LOGIC_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/MAINNET/LIQUIDATION_LOGIC.sol b/./downloads/ZKSYNC/LIQUIDATION_LOGIC.sol +index c52ec07..b6c73df 100644 +--- a/./downloads/MAINNET/LIQUIDATION_LOGIC.sol ++++ b/./downloads/ZKSYNC/LIQUIDATION_LOGIC.sol + +``` diff --git a/diffs/MAINNET_ZKSYNC/ORACLE_DIFF.md b/diffs/MAINNET_ZKSYNC/ORACLE_DIFF.md new file mode 100644 index 00000000..7d853fd8 --- /dev/null +++ b/diffs/MAINNET_ZKSYNC/ORACLE_DIFF.md @@ -0,0 +1,7 @@ +```diff +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 + +``` diff --git a/diffs/MAINNET_ZKSYNC/POOL_ADDRESSES_PROVIDER_DIFF.md b/diffs/MAINNET_ZKSYNC/POOL_ADDRESSES_PROVIDER_DIFF.md new file mode 100644 index 00000000..7174ad39 --- /dev/null +++ b/diffs/MAINNET_ZKSYNC/POOL_ADDRESSES_PROVIDER_DIFF.md @@ -0,0 +1,53 @@ +```diff +diff --git a/./downloads/MAINNET/POOL_ADDRESSES_PROVIDER.sol b/./downloads/ZKSYNC/POOL_ADDRESSES_PROVIDER.sol +index f6ec86b..7b370c5 100644 +--- a/./downloads/MAINNET/POOL_ADDRESSES_PROVIDER.sol ++++ b/./downloads/ZKSYNC/POOL_ADDRESSES_PROVIDER.sol + +-// 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 ++ */ ++ receive() external payable { ++ _fallback(); ++ } ++ + /** + * @return The Address of the implementation. + */ +@@ -158,7 +325,7 @@ abstract contract Proxy { + } + } + +-// 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 ++ * @param admin_ The address of the admin + */ +- constructor(address admin) { +- _admin = admin; ++ constructor(address admin_) { ++ _admin = admin_; + } + + modifier ifAdmin() { +@@ -624,7 +791,7 @@ contract BaseImmutableAdminUpgradeabilityProxy is BaseUpgradeabilityProxy { + } + } +``` diff --git a/diffs/MAINNET_ZKSYNC/POOL_ADDRESSES_PROVIDER_REGISTRY_DIFF.md b/diffs/MAINNET_ZKSYNC/POOL_ADDRESSES_PROVIDER_REGISTRY_DIFF.md new file mode 100644 index 00000000..8f3d2ca3 --- /dev/null +++ b/diffs/MAINNET_ZKSYNC/POOL_ADDRESSES_PROVIDER_REGISTRY_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/MAINNET/POOL_ADDRESSES_PROVIDER_REGISTRY.sol b/./downloads/ZKSYNC/POOL_ADDRESSES_PROVIDER_REGISTRY.sol +index 82267cb..84a6931 100644 +--- a/./downloads/MAINNET/POOL_ADDRESSES_PROVIDER_REGISTRY.sol ++++ b/./downloads/ZKSYNC/POOL_ADDRESSES_PROVIDER_REGISTRY.sol + +``` diff --git a/diffs/MAINNET_ZKSYNC/POOL_CONFIGURATOR_IMPL_DIFF.md b/diffs/MAINNET_ZKSYNC/POOL_CONFIGURATOR_IMPL_DIFF.md new file mode 100644 index 00000000..aa329730 --- /dev/null +++ b/diffs/MAINNET_ZKSYNC/POOL_CONFIGURATOR_IMPL_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/MAINNET/POOL_CONFIGURATOR_IMPL.sol b/./downloads/ZKSYNC/POOL_CONFIGURATOR_IMPL.sol +index 4d13939..ff9e514 100644 +--- a/./downloads/MAINNET/POOL_CONFIGURATOR_IMPL.sol ++++ b/./downloads/ZKSYNC/POOL_CONFIGURATOR_IMPL.sol + +``` diff --git a/diffs/MAINNET_ZKSYNC/POOL_LOGIC_DIFF.md b/diffs/MAINNET_ZKSYNC/POOL_LOGIC_DIFF.md new file mode 100644 index 00000000..029bd863 --- /dev/null +++ b/diffs/MAINNET_ZKSYNC/POOL_LOGIC_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/MAINNET/POOL_LOGIC.sol b/./downloads/ZKSYNC/POOL_LOGIC.sol +index 5517e96..43c9a27 100644 +--- a/./downloads/MAINNET/POOL_LOGIC.sol ++++ b/./downloads/ZKSYNC/POOL_LOGIC.sol + +``` diff --git a/diffs/MAINNET_ZKSYNC/SUPPLY_LOGIC_DIFF.md b/diffs/MAINNET_ZKSYNC/SUPPLY_LOGIC_DIFF.md new file mode 100644 index 00000000..dbfe6e5d --- /dev/null +++ b/diffs/MAINNET_ZKSYNC/SUPPLY_LOGIC_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/MAINNET/SUPPLY_LOGIC.sol b/./downloads/ZKSYNC/SUPPLY_LOGIC.sol +index db8902c..5e3116d 100644 +--- a/./downloads/MAINNET/SUPPLY_LOGIC.sol ++++ b/./downloads/ZKSYNC/SUPPLY_LOGIC.sol + +``` diff --git a/diffs/MAINNET_ZKSYNC/UI_INCENTIVE_DATA_PROVIDER_DIFF.md b/diffs/MAINNET_ZKSYNC/UI_INCENTIVE_DATA_PROVIDER_DIFF.md new file mode 100644 index 00000000..359e941d --- /dev/null +++ b/diffs/MAINNET_ZKSYNC/UI_INCENTIVE_DATA_PROVIDER_DIFF.md @@ -0,0 +1,94 @@ +```diff +diff --git a/./downloads/MAINNET/UI_INCENTIVE_DATA_PROVIDER.sol b/./downloads/ZKSYNC/UI_INCENTIVE_DATA_PROVIDER.sol +index df8b21f..8a55fee 100644 +--- a/./downloads/MAINNET/UI_INCENTIVE_DATA_PROVIDER.sol ++++ b/./downloads/ZKSYNC/UI_INCENTIVE_DATA_PROVIDER.sol + +-// 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 { + /** + * @dev Constructor. + * @param pool The reference to the main Pool contract +- * @param name The name of the token +- * @param symbol The symbol of the token +- * @param decimals The number of decimals of the token ++ * @param name_ The name of the token ++ * @param symbol_ The symbol of the token ++ * @param decimals_ The number of decimals of the token + */ +- constructor(IPool pool, string memory name, string memory symbol, uint8 decimals) { ++ constructor(IPool pool, string memory name_, string memory symbol_, uint8 decimals_) { + _addressesProvider = pool.ADDRESSES_PROVIDER(); +- _name = name; +- _symbol = symbol; +- _decimals = decimals; ++ _name = name_; ++ _symbol = symbol_; ++ _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 { + IRewardsController vTokenIncentiveController = IRewardsController( + address(IncentivizedERC20(baseData.variableDebtTokenAddress).getIncentivesController()) + ); +- address[] memory vTokenRewardAddresses = vTokenIncentiveController.getRewardsByAsset( +- baseData.variableDebtTokenAddress +- ); + RewardInfo[] memory vRewardsInformation; +- + if (address(vTokenIncentiveController) != address(0)) { ++ address[] memory vTokenRewardAddresses = vTokenIncentiveController.getRewardsByAsset( ++ baseData.variableDebtTokenAddress ++ ); + vRewardsInformation = new RewardInfo[](vTokenRewardAddresses.length); + for (uint256 j = 0; j < vTokenRewardAddresses.length; ++j) { + RewardInfo memory rewardInformation; +@@ -3785,12 +3964,11 @@ contract UiIncentiveDataProviderV3 is IUiIncentiveDataProviderV3 { + IRewardsController sTokenIncentiveController = IRewardsController( + address(IncentivizedERC20(baseData.stableDebtTokenAddress).getIncentivesController()) + ); +- address[] memory sTokenRewardAddresses = sTokenIncentiveController.getRewardsByAsset( +- baseData.stableDebtTokenAddress +- ); + RewardInfo[] memory sRewardsInformation; +- + if (address(sTokenIncentiveController) != address(0)) { ++ address[] memory sTokenRewardAddresses = sTokenIncentiveController.getRewardsByAsset( ++ baseData.stableDebtTokenAddress ++ ); + sRewardsInformation = new RewardInfo[](sTokenRewardAddresses.length); + for (uint256 j = 0; j < sTokenRewardAddresses.length; ++j) { + RewardInfo memory rewardInformation; +@@ -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 new file mode 100644 index 00000000..d2650cb7 --- /dev/null +++ b/diffs/MAINNET_ZKSYNC/UI_POOL_DATA_PROVIDER_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/MAINNET/UI_POOL_DATA_PROVIDER.sol b/./downloads/ZKSYNC/UI_POOL_DATA_PROVIDER.sol +index a888c89..91ed1e2 100644 +--- a/./downloads/MAINNET/UI_POOL_DATA_PROVIDER.sol ++++ b/./downloads/ZKSYNC/UI_POOL_DATA_PROVIDER.sol + +``` diff --git a/diffs/MAINNET_ZKSYNC/WALLET_BALANCE_PROVIDER_DIFF.md b/diffs/MAINNET_ZKSYNC/WALLET_BALANCE_PROVIDER_DIFF.md new file mode 100644 index 00000000..a4a88d47 --- /dev/null +++ b/diffs/MAINNET_ZKSYNC/WALLET_BALANCE_PROVIDER_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/MAINNET/WALLET_BALANCE_PROVIDER.sol b/./downloads/ZKSYNC/WALLET_BALANCE_PROVIDER.sol +index 5d96b38..0fcc8b1 100644 +--- a/./downloads/MAINNET/WALLET_BALANCE_PROVIDER.sol ++++ b/./downloads/ZKSYNC/WALLET_BALANCE_PROVIDER.sol + +``` diff --git a/diffs/MAINNET_ZKSYNC/WETH_GATEWAY_DIFF.md b/diffs/MAINNET_ZKSYNC/WETH_GATEWAY_DIFF.md new file mode 100644 index 00000000..4cc6c4ab --- /dev/null +++ b/diffs/MAINNET_ZKSYNC/WETH_GATEWAY_DIFF.md @@ -0,0 +1,23 @@ +```diff +diff --git a/./downloads/MAINNET/WETH_GATEWAY.sol b/./downloads/ZKSYNC/WETH_GATEWAY.sol +index 15fdf35..c07f0ff 100644 +--- a/./downloads/MAINNET/WETH_GATEWAY.sol ++++ b/./downloads/ZKSYNC/WETH_GATEWAY.sol + +-// 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. +```