diff --git a/GNOSIS_CELO/AAVE_PROTOCOL_DATA_PROVIDER_DIFF.md b/GNOSIS_CELO/AAVE_PROTOCOL_DATA_PROVIDER_DIFF.md new file mode 100644 index 00000000..42df441f --- /dev/null +++ b/GNOSIS_CELO/AAVE_PROTOCOL_DATA_PROVIDER_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/GNOSIS/AAVE_PROTOCOL_DATA_PROVIDER.sol b/./downloads/CELO/AAVE_PROTOCOL_DATA_PROVIDER.sol +index ef1c828..0540bfa 100644 +--- a/./downloads/GNOSIS/AAVE_PROTOCOL_DATA_PROVIDER.sol ++++ b/./downloads/CELO/AAVE_PROTOCOL_DATA_PROVIDER.sol + +``` diff --git a/GNOSIS_CELO/ACL_MANAGER_DIFF.md b/GNOSIS_CELO/ACL_MANAGER_DIFF.md new file mode 100644 index 00000000..2d8b4075 --- /dev/null +++ b/GNOSIS_CELO/ACL_MANAGER_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/GNOSIS/ACL_MANAGER.sol b/./downloads/CELO/ACL_MANAGER.sol +index 5f26b31..aba09ce 100644 +--- a/./downloads/GNOSIS/ACL_MANAGER.sol ++++ b/./downloads/CELO/ACL_MANAGER.sol + +``` diff --git a/GNOSIS_CELO/BORROW_LOGIC_DIFF.md b/GNOSIS_CELO/BORROW_LOGIC_DIFF.md new file mode 100644 index 00000000..160eff95 --- /dev/null +++ b/GNOSIS_CELO/BORROW_LOGIC_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/GNOSIS/BORROW_LOGIC.sol b/./downloads/CELO/BORROW_LOGIC.sol +index 6281b07..9fc8b47 100644 +--- a/./downloads/GNOSIS/BORROW_LOGIC.sol ++++ b/./downloads/CELO/BORROW_LOGIC.sol + +``` diff --git a/GNOSIS_CELO/BRIDGE_LOGIC_DIFF.md b/GNOSIS_CELO/BRIDGE_LOGIC_DIFF.md new file mode 100644 index 00000000..eaaaf028 --- /dev/null +++ b/GNOSIS_CELO/BRIDGE_LOGIC_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/GNOSIS/BRIDGE_LOGIC.sol b/./downloads/CELO/BRIDGE_LOGIC.sol +index cc4e36b..1347edb 100644 +--- a/./downloads/GNOSIS/BRIDGE_LOGIC.sol ++++ b/./downloads/CELO/BRIDGE_LOGIC.sol + +``` diff --git a/GNOSIS_CELO/COLLECTOR_IMPL_DIFF.md b/GNOSIS_CELO/COLLECTOR_IMPL_DIFF.md new file mode 100644 index 00000000..d2b684fe --- /dev/null +++ b/GNOSIS_CELO/COLLECTOR_IMPL_DIFF.md @@ -0,0 +1,76 @@ +```diff +diff --git a/./downloads/GNOSIS/COLLECTOR_IMPL.sol b/./downloads/CELO/COLLECTOR_IMPL.sol +index 2ac55c8..7a7eb91 100644 +--- a/./downloads/GNOSIS/COLLECTOR_IMPL.sol ++++ b/./downloads/CELO/COLLECTOR_IMPL.sol + +-// downloads/GNOSIS/COLLECTOR_IMPL/CollectorWithCustomImpl/lib/aave-v3-origin/src/contracts/treasury/ICollector.sol ++// downloads/CELO/COLLECTOR_IMPL/Collector/src/contracts/treasury/ICollector.sol + + interface ICollector { + struct Stream { +@@ -722,7 +722,7 @@ interface ICollector { + /** + * @dev Only caller with FUNDS_ADMIN role or stream recipient can call + */ +- error OnlyFundsAdminOrRceipient(); ++ error OnlyFundsAdminOrRecipient(); + + /** + * @dev The provided ID does not belong to an existing stream +@@ -1553,7 +1553,7 @@ library SafeERC20 { + } + } + +-// downloads/GNOSIS/COLLECTOR_IMPL/CollectorWithCustomImpl/lib/aave-v3-origin/src/contracts/treasury/Collector.sol ++// downloads/CELO/COLLECTOR_IMPL/Collector/src/contracts/treasury/Collector.sol + + /** + * @title Collector +@@ -1616,7 +1616,7 @@ contract Collector is AccessControlUpgradeable, ReentrancyGuardUpgradeable, ICol + */ + modifier onlyAdminOrRecipient(uint256 streamId) { + if (_onlyFundsAdmin() == false && msg.sender != _streams[streamId].recipient) { +- revert OnlyFundsAdminOrRceipient(); ++ revert OnlyFundsAdminOrRecipient(); + } + _; + } +@@ -1643,6 +1643,7 @@ contract Collector is AccessControlUpgradeable, ReentrancyGuardUpgradeable, ICol + __AccessControl_init(); + __ReentrancyGuard_init(); + _grantRole(DEFAULT_ADMIN_ROLE, admin); ++ _grantRole(FUNDS_ADMIN_ROLE, admin); + if (nextStreamId != 0) { + _nextStreamId = nextStreamId; + } +@@ -1883,28 +1884,3 @@ contract Collector is AccessControlUpgradeable, ReentrancyGuardUpgradeable, ICol + /// @dev needed in order to receive ETH from the Aave v1 ecosystem reserve + receive() external payable {} + } +- +-// downloads/GNOSIS/COLLECTOR_IMPL/CollectorWithCustomImpl/src/CollectorWithCustomImpl.sol +- +-/** +- * @title Collector +- * Custom modifications of this implementation: +- * - the initialize function manually alters private storage slots via assembly +- * - storage slot 0 (previously revision) is reset to zero +- * - storage slot 51 (previously _status) is set to zero +- * - storage slot 52 (previously _fundsAdmin) is set to zero +- * @author BGD Labs +- * +- */ +-contract CollectorWithCustomImpl is Collector { +- function initialize(uint256, address admin) external virtual override initializer { +- assembly { +- sstore(0, 0) // this slot was revision, which is no longer used +- sstore(51, 0) // this slot was _status, but is now part of the gap +- sstore(52, 0) // this slot was _fundsAdmin, but is now unused +- } +- __AccessControl_init(); +- __ReentrancyGuard_init(); +- _grantRole(DEFAULT_ADMIN_ROLE, admin); +- } +-} +``` diff --git a/GNOSIS_CELO/CONFIGURATOR_LOGIC_DIFF.md b/GNOSIS_CELO/CONFIGURATOR_LOGIC_DIFF.md new file mode 100644 index 00000000..fb6804ed --- /dev/null +++ b/GNOSIS_CELO/CONFIGURATOR_LOGIC_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/GNOSIS/CONFIGURATOR_LOGIC.sol b/./downloads/CELO/CONFIGURATOR_LOGIC.sol +index a05116a..98c05e0 100644 +--- a/./downloads/GNOSIS/CONFIGURATOR_LOGIC.sol ++++ b/./downloads/CELO/CONFIGURATOR_LOGIC.sol + +``` diff --git a/GNOSIS_CELO/DEFAULT_A_TOKEN_IMPL_DIFF.md b/GNOSIS_CELO/DEFAULT_A_TOKEN_IMPL_DIFF.md new file mode 100644 index 00000000..f469dc14 --- /dev/null +++ b/GNOSIS_CELO/DEFAULT_A_TOKEN_IMPL_DIFF.md @@ -0,0 +1,157 @@ +```diff +diff --git a/./downloads/GNOSIS/DEFAULT_A_TOKEN_IMPL.sol b/./downloads/CELO/DEFAULT_A_TOKEN_IMPL.sol +index 5f19e1c..66219c7 100644 +--- a/./downloads/GNOSIS/DEFAULT_A_TOKEN_IMPL.sol ++++ b/./downloads/CELO/DEFAULT_A_TOKEN_IMPL.sol + +-// downloads/GNOSIS/DEFAULT_A_TOKEN_IMPL/AToken/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol ++// downloads/CELO/DEFAULT_A_TOKEN_IMPL/ATokenInstance/src/contracts/protocol/tokenization/base/IncentivizedERC20.sol + + /** + * @title IncentivizedERC20 +@@ -2564,8 +2766,7 @@ abstract contract IncentivizedERC20 is Context, IERC20Detailed { + /** + * @dev UserState - additionalData is a flexible field. + * ATokens and VariableDebtTokens use this field store the index of the +- * user's last supply/withdrawal/borrow/repayment. StableDebtTokens use +- * this field to store the user's stable rate. ++ * user's last supply/withdrawal/borrow/repayment. + */ + struct UserState { + uint128 balance; +@@ -2588,15 +2789,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; + } + +-// downloads/GNOSIS/DEFAULT_A_TOKEN_IMPL/AToken/src/core/contracts/protocol/tokenization/AToken.sol ++// downloads/CELO/DEFAULT_A_TOKEN_IMPL/ATokenInstance/src/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; +@@ -2983,16 +3184,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 +@@ -3013,29 +3207,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( +@@ -3209,3 +3381,50 @@ contract AToken is VersionedInitializable, ScaledBalanceTokenBase, EIP712Base, I + IERC20(token).safeTransfer(to, amount); + } + } ++ ++// downloads/CELO/DEFAULT_A_TOKEN_IMPL/ATokenInstance/src/contracts/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/GNOSIS_CELO/DEFAULT_INCENTIVES_CONTROLLER_IMPL_DIFF.md b/GNOSIS_CELO/DEFAULT_INCENTIVES_CONTROLLER_IMPL_DIFF.md new file mode 100644 index 00000000..8e393b3a --- /dev/null +++ b/GNOSIS_CELO/DEFAULT_INCENTIVES_CONTROLLER_IMPL_DIFF.md @@ -0,0 +1,123 @@ +```diff +diff --git a/./downloads/GNOSIS/DEFAULT_INCENTIVES_CONTROLLER_IMPL.sol b/./downloads/CELO/DEFAULT_INCENTIVES_CONTROLLER_IMPL.sol +index 470a2d4..ade74e4 100644 +--- a/./downloads/GNOSIS/DEFAULT_INCENTIVES_CONTROLLER_IMPL.sol ++++ b/./downloads/CELO/DEFAULT_INCENTIVES_CONTROLLER_IMPL.sol + +-// downloads/GNOSIS/DEFAULT_INCENTIVES_CONTROLLER_IMPL/RewardsController/src/periphery/contracts/rewards/libraries/RewardsDataTypes.sol ++// downloads/CELO/DEFAULT_INCENTIVES_CONTROLLER_IMPL/RewardsController/src/contracts/rewards/libraries/RewardsDataTypes.sol + + library RewardsDataTypes { + struct RewardsConfigInput { +@@ -736,7 +765,7 @@ library RewardsDataTypes { + address asset; + address reward; + ITransferStrategyBase transferStrategy; +- IEACAggregatorProxy rewardOracle; ++ AggregatorInterface rewardOracle; + } + + struct UserAssetBalance { +@@ -777,7 +806,7 @@ library RewardsDataTypes { + } + } + +-// downloads/GNOSIS/DEFAULT_INCENTIVES_CONTROLLER_IMPL/RewardsController/src/periphery/contracts/rewards/interfaces/IRewardsController.sol ++// downloads/CELO/DEFAULT_INCENTIVES_CONTROLLER_IMPL/RewardsController/src/contracts/rewards/interfaces/IRewardsController.sol + + /** + * @title IRewardsController +@@ -843,9 +872,9 @@ interface IRewardsController is IRewardsDistributor { + * This check is enforced for integrators to be able to show incentives at + * the current Aave UI without the need to setup an external price registry + * @param reward The address of the reward to set the price aggregator +- * @param rewardOracle The address of price aggregator that follows IEACAggregatorProxy interface ++ * @param rewardOracle The address of price aggregator that follows AggregatorInterface interface + */ +- function setRewardOracle(address reward, IEACAggregatorProxy rewardOracle) external; ++ function setRewardOracle(address reward, AggregatorInterface rewardOracle) external; + + /** + * @dev Get the price aggregator oracle address +@@ -877,8 +906,8 @@ interface IRewardsController is IRewardsDistributor { + * address asset: The asset address to incentivize + * address reward: The reward token address + * ITransferStrategy transferStrategy: The TransferStrategy address with the install hook and claim logic. +- * IEACAggregatorProxy rewardOracle: The Price Oracle of a reward to visualize the incentives at the UI Frontend. +- * Must follow Chainlink Aggregator IEACAggregatorProxy interface to be compatible. ++ * AggregatorInterface rewardOracle: The Price Oracle of a reward to visualize the incentives at the UI Frontend. ++ * Must follow Chainlink Aggregator AggregatorInterface interface to be compatible. + */ + function configureAssets(RewardsDataTypes.RewardsConfigInput[] memory config) external; + +@@ -975,7 +1004,7 @@ interface IRewardsController is IRewardsDistributor { + ) external returns (address[] memory rewardsList, uint256[] memory claimedAmounts); + } + +-// downloads/GNOSIS/DEFAULT_INCENTIVES_CONTROLLER_IMPL/RewardsController/src/periphery/contracts/rewards/RewardsDistributor.sol ++// downloads/CELO/DEFAULT_INCENTIVES_CONTROLLER_IMPL/RewardsController/src/contracts/rewards/RewardsDistributor.sol + + /** + * @title RewardsDistributor +@@ -1015,7 +1044,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 +1096,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 +1535,7 @@ abstract contract RewardsDistributor is IRewardsDistributor { + } + } + +-// downloads/GNOSIS/DEFAULT_INCENTIVES_CONTROLLER_IMPL/RewardsController/src/periphery/contracts/rewards/RewardsController.sol ++// downloads/CELO/DEFAULT_INCENTIVES_CONTROLLER_IMPL/RewardsController/src/contracts/rewards/RewardsController.sol + + /** + * @title RewardsController +@@ -1532,7 +1561,7 @@ contract RewardsController is RewardsDistributor, VersionedInitializable, IRewar + // the current Aave UI without the need to setup an external price registry + // At the moment of reward configuration, the Incentives Controller performs + // a check to see if the provided reward oracle contains `latestAnswer`. +- mapping(address => IEACAggregatorProxy) internal _rewardOracle; ++ mapping(address => AggregatorInterface) internal _rewardOracle; + + modifier onlyAuthorizedClaimers(address claimer, address user) { + require(_authorizedClaimers[user] == claimer, 'CLAIMER_UNAUTHORIZED'); +@@ -1598,7 +1627,7 @@ contract RewardsController is RewardsDistributor, VersionedInitializable, IRewar + /// @inheritdoc IRewardsController + function setRewardOracle( + address reward, +- IEACAggregatorProxy rewardOracle ++ AggregatorInterface rewardOracle + ) external onlyEmissionManager { + _setRewardOracle(reward, rewardOracle); + } +@@ -1839,13 +1868,13 @@ contract RewardsController is RewardsDistributor, VersionedInitializable, IRewar + } + + /** +- * @dev Update the Price Oracle of a reward token. The Price Oracle must follow Chainlink IEACAggregatorProxy interface. ++ * @dev Update the Price Oracle of a reward token. The Price Oracle must follow Chainlink AggregatorInterface interface. + * @notice The Price Oracle of a reward is used for displaying correct data about the incentives at the UI frontend. + * @param reward The address of the reward token + * @param rewardOracle The address of the price oracle + */ + +- function _setRewardOracle(address reward, IEACAggregatorProxy rewardOracle) internal { ++ function _setRewardOracle(address reward, AggregatorInterface rewardOracle) internal { + require(rewardOracle.latestAnswer() > 0, 'ORACLE_MUST_RETURN_PRICE'); + _rewardOracle[reward] = rewardOracle; + emit RewardOracleUpdated(reward, address(rewardOracle)); +``` diff --git a/GNOSIS_CELO/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL_DIFF.md b/GNOSIS_CELO/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL_DIFF.md new file mode 100644 index 00000000..e7c34b99 --- /dev/null +++ b/GNOSIS_CELO/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL_DIFF.md @@ -0,0 +1,165 @@ +```diff +diff --git a/./downloads/GNOSIS/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL.sol b/./downloads/CELO/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL.sol +index aa145c3..ba3ffd3 100644 +--- a/./downloads/GNOSIS/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL.sol ++++ b/./downloads/CELO/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL.sol + +-// downloads/GNOSIS/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtToken/src/core/contracts/protocol/tokenization/base/DebtTokenBase.sol ++// downloads/CELO/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtTokenInstance/src/contracts/protocol/tokenization/base/DebtTokenBase.sol + + /** + * @title DebtTokenBase + * @author Aave +- * @notice Base contract for different types of debt tokens, like StableDebtToken or VariableDebtToken ++ * @notice Base contract for different types of debt tokens, like VariableDebtToken + */ + abstract contract DebtTokenBase is + VersionedInitializable, +@@ -2438,7 +2640,7 @@ abstract contract DebtTokenBase is + } + } + +-// downloads/GNOSIS/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtToken/src/core/contracts/protocol/tokenization/base/IncentivizedERC20.sol ++// downloads/CELO/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtTokenInstance/src/contracts/protocol/tokenization/base/IncentivizedERC20.sol + + /** + * @title IncentivizedERC20 +@@ -2512,8 +2714,7 @@ abstract contract IncentivizedERC20 is Context, IERC20Detailed { + /** + * @dev UserState - additionalData is a flexible field. + * ATokens and VariableDebtTokens use this field store the index of the +- * user's last supply/withdrawal/borrow/repayment. StableDebtTokens use +- * this field to store the user's stable rate. ++ * user's last supply/withdrawal/borrow/repayment. + */ + struct UserState { + uint128 balance; +@@ -2536,15 +2737,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; + } + +@@ -2705,7 +2906,7 @@ abstract contract IncentivizedERC20 is Context, IERC20Detailed { + } + } + +-// downloads/GNOSIS/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtToken/src/core/contracts/protocol/tokenization/VariableDebtToken.sol ++// downloads/CELO/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtTokenInstance/src/contracts/protocol/tokenization/VariableDebtToken.sol + + /** + * @title VariableDebtToken +@@ -2925,12 +3126,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 +@@ -2953,32 +3152,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) { +@@ -3057,3 +3231,47 @@ contract VariableDebtToken is DebtTokenBase, ScaledBalanceTokenBase, IVariableDe + return _underlyingAsset; + } + } ++ ++// downloads/CELO/DEFAULT_VARIABLE_DEBT_TOKEN_IMPL/VariableDebtTokenInstance/src/contracts/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/GNOSIS_CELO/EMISSION_MANAGER_DIFF.md b/GNOSIS_CELO/EMISSION_MANAGER_DIFF.md new file mode 100644 index 00000000..13583c7f --- /dev/null +++ b/GNOSIS_CELO/EMISSION_MANAGER_DIFF.md @@ -0,0 +1,108 @@ +```diff +diff --git a/./downloads/GNOSIS/EMISSION_MANAGER.sol b/./downloads/CELO/EMISSION_MANAGER.sol +index 65dd5d6..fc34c5f 100644 +--- a/./downloads/GNOSIS/EMISSION_MANAGER.sol ++++ b/./downloads/CELO/EMISSION_MANAGER.sol + +-// downloads/GNOSIS/EMISSION_MANAGER/EmissionManager/src/periphery/contracts/rewards/libraries/RewardsDataTypes.sol ++// downloads/CELO/EMISSION_MANAGER/EmissionManager/src/contracts/rewards/libraries/RewardsDataTypes.sol + + library RewardsDataTypes { + struct RewardsConfigInput { +@@ -334,7 +363,7 @@ library RewardsDataTypes { + address asset; + address reward; + ITransferStrategyBase transferStrategy; +- IEACAggregatorProxy rewardOracle; ++ AggregatorInterface rewardOracle; + } + + struct UserAssetBalance { +@@ -375,7 +404,7 @@ library RewardsDataTypes { + } + } + +-// downloads/GNOSIS/EMISSION_MANAGER/EmissionManager/src/periphery/contracts/rewards/interfaces/IRewardsController.sol ++// downloads/CELO/EMISSION_MANAGER/EmissionManager/src/contracts/rewards/interfaces/IRewardsController.sol + + /** + * @title IRewardsController +@@ -441,9 +470,9 @@ interface IRewardsController is IRewardsDistributor { + * This check is enforced for integrators to be able to show incentives at + * the current Aave UI without the need to setup an external price registry + * @param reward The address of the reward to set the price aggregator +- * @param rewardOracle The address of price aggregator that follows IEACAggregatorProxy interface ++ * @param rewardOracle The address of price aggregator that follows AggregatorInterface interface + */ +- function setRewardOracle(address reward, IEACAggregatorProxy rewardOracle) external; ++ function setRewardOracle(address reward, AggregatorInterface rewardOracle) external; + + /** + * @dev Get the price aggregator oracle address +@@ -475,8 +504,8 @@ interface IRewardsController is IRewardsDistributor { + * address asset: The asset address to incentivize + * address reward: The reward token address + * ITransferStrategy transferStrategy: The TransferStrategy address with the install hook and claim logic. +- * IEACAggregatorProxy rewardOracle: The Price Oracle of a reward to visualize the incentives at the UI Frontend. +- * Must follow Chainlink Aggregator IEACAggregatorProxy interface to be compatible. ++ * AggregatorInterface rewardOracle: The Price Oracle of a reward to visualize the incentives at the UI Frontend. ++ * Must follow Chainlink Aggregator AggregatorInterface interface to be compatible. + */ + function configureAssets(RewardsDataTypes.RewardsConfigInput[] memory config) external; + +@@ -573,7 +602,7 @@ interface IRewardsController is IRewardsDistributor { + ) external returns (address[] memory rewardsList, uint256[] memory claimedAmounts); + } + +-// downloads/GNOSIS/EMISSION_MANAGER/EmissionManager/src/periphery/contracts/rewards/interfaces/IEmissionManager.sol ++// downloads/CELO/EMISSION_MANAGER/EmissionManager/src/contracts/rewards/interfaces/IEmissionManager.sol + + /** + * @title IEmissionManager +@@ -603,8 +632,8 @@ interface IEmissionManager { + * address asset: The asset address to incentivize + * address reward: The reward token address + * ITransferStrategy transferStrategy: The TransferStrategy address with the install hook and claim logic. +- * IEACAggregatorProxy rewardOracle: The Price Oracle of a reward to visualize the incentives at the UI Frontend. +- * Must follow Chainlink Aggregator IEACAggregatorProxy interface to be compatible. ++ * AggregatorInterface rewardOracle: The Price Oracle of a reward to visualize the incentives at the UI Frontend. ++ * Must follow Chainlink Aggregator AggregatorInterface interface to be compatible. + */ + function configureAssets(RewardsDataTypes.RewardsConfigInput[] memory config) external; + +@@ -620,13 +649,13 @@ interface IEmissionManager { + * @dev Sets an Aave Oracle contract to enforce rewards with a source of value. + * @dev Only callable by the emission admin of the given reward + * @notice At the moment of reward configuration, the Incentives Controller performs +- * a check to see if the reward asset oracle is compatible with IEACAggregator proxy. ++ * a check to see if the reward asset oracle is compatible with AggregatorInterface proxy. + * This check is enforced for integrators to be able to show incentives at + * the current Aave UI without the need to setup an external price registry + * @param reward The address of the reward to set the price aggregator +- * @param rewardOracle The address of price aggregator that follows IEACAggregatorProxy interface ++ * @param rewardOracle The address of price aggregator that follows AggregatorInterface interface + */ +- function setRewardOracle(address reward, IEACAggregatorProxy rewardOracle) external; ++ function setRewardOracle(address reward, AggregatorInterface rewardOracle) external; + + /** + * @dev Sets the end date for the distribution +@@ -686,7 +715,7 @@ interface IEmissionManager { + function getEmissionAdmin(address reward) external view returns (address); + } + +-// downloads/GNOSIS/EMISSION_MANAGER/EmissionManager/src/periphery/contracts/rewards/EmissionManager.sol ++// downloads/CELO/EMISSION_MANAGER/EmissionManager/src/contracts/rewards/EmissionManager.sol + + /** + * @title EmissionManager +@@ -734,7 +763,7 @@ contract EmissionManager is Ownable, IEmissionManager { + /// @inheritdoc IEmissionManager + function setRewardOracle( + address reward, +- IEACAggregatorProxy rewardOracle ++ AggregatorInterface rewardOracle + ) external override onlyEmissionAdmin(reward) { + _rewardsController.setRewardOracle(reward, rewardOracle); + } +``` diff --git a/GNOSIS_CELO/EMODE_LOGIC_DIFF.md b/GNOSIS_CELO/EMODE_LOGIC_DIFF.md new file mode 100644 index 00000000..8124bf07 --- /dev/null +++ b/GNOSIS_CELO/EMODE_LOGIC_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/GNOSIS/EMODE_LOGIC.sol b/./downloads/CELO/EMODE_LOGIC.sol +index d8db78a..867ce2d 100644 +--- a/./downloads/GNOSIS/EMODE_LOGIC.sol ++++ b/./downloads/CELO/EMODE_LOGIC.sol + +``` diff --git a/GNOSIS_CELO/FLASHLOAN_LOGIC_DIFF.md b/GNOSIS_CELO/FLASHLOAN_LOGIC_DIFF.md new file mode 100644 index 00000000..dbf966e4 --- /dev/null +++ b/GNOSIS_CELO/FLASHLOAN_LOGIC_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/GNOSIS/FLASHLOAN_LOGIC.sol b/./downloads/CELO/FLASHLOAN_LOGIC.sol +index 67fc4e7..a0a5763 100644 +--- a/./downloads/GNOSIS/FLASHLOAN_LOGIC.sol ++++ b/./downloads/CELO/FLASHLOAN_LOGIC.sol + +``` diff --git a/GNOSIS_CELO/LIQUIDATION_LOGIC_DIFF.md b/GNOSIS_CELO/LIQUIDATION_LOGIC_DIFF.md new file mode 100644 index 00000000..24ec3c5f --- /dev/null +++ b/GNOSIS_CELO/LIQUIDATION_LOGIC_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/GNOSIS/LIQUIDATION_LOGIC.sol b/./downloads/CELO/LIQUIDATION_LOGIC.sol +index 40c0173..e9ff01e 100644 +--- a/./downloads/GNOSIS/LIQUIDATION_LOGIC.sol ++++ b/./downloads/CELO/LIQUIDATION_LOGIC.sol + +``` diff --git a/GNOSIS_CELO/ORACLE_DIFF.md b/GNOSIS_CELO/ORACLE_DIFF.md new file mode 100644 index 00000000..0593adf2 --- /dev/null +++ b/GNOSIS_CELO/ORACLE_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/GNOSIS/ORACLE.sol b/./downloads/CELO/ORACLE.sol +index ac0cf84..0d5df16 100644 +--- a/./downloads/GNOSIS/ORACLE.sol ++++ b/./downloads/CELO/ORACLE.sol + +``` diff --git a/GNOSIS_CELO/POOL_ADDRESSES_PROVIDER_DIFF.md b/GNOSIS_CELO/POOL_ADDRESSES_PROVIDER_DIFF.md new file mode 100644 index 00000000..e36887e5 --- /dev/null +++ b/GNOSIS_CELO/POOL_ADDRESSES_PROVIDER_DIFF.md @@ -0,0 +1,53 @@ +```diff +diff --git a/./downloads/GNOSIS/POOL_ADDRESSES_PROVIDER.sol b/./downloads/CELO/POOL_ADDRESSES_PROVIDER.sol +index ac6b143..6c08fed 100644 +--- a/./downloads/GNOSIS/POOL_ADDRESSES_PROVIDER.sol ++++ b/./downloads/CELO/POOL_ADDRESSES_PROVIDER.sol + +-// downloads/GNOSIS/POOL_ADDRESSES_PROVIDER/PoolAddressesProvider/src/core/contracts/dependencies/openzeppelin/upgradeability/Proxy.sol ++// downloads/CELO/POOL_ADDRESSES_PROVIDER/PoolAddressesProvider/src/contracts/dependencies/openzeppelin/upgradeability/Proxy.sol + + /** + * @title Proxy +@@ -490,6 +490,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. + */ +@@ -544,7 +552,7 @@ abstract contract Proxy { + } + } + +-// downloads/GNOSIS/POOL_ADDRESSES_PROVIDER/PoolAddressesProvider/src/core/contracts/protocol/libraries/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol ++// downloads/CELO/POOL_ADDRESSES_PROVIDER/PoolAddressesProvider/src/contracts/misc/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol + + /** + * @title BaseImmutableAdminUpgradeabilityProxy +@@ -690,10 +698,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() { +@@ -756,7 +764,7 @@ contract BaseImmutableAdminUpgradeabilityProxy is BaseUpgradeabilityProxy { + } + } +``` diff --git a/GNOSIS_CELO/POOL_ADDRESSES_PROVIDER_REGISTRY_DIFF.md b/GNOSIS_CELO/POOL_ADDRESSES_PROVIDER_REGISTRY_DIFF.md new file mode 100644 index 00000000..7d8a5d34 --- /dev/null +++ b/GNOSIS_CELO/POOL_ADDRESSES_PROVIDER_REGISTRY_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/GNOSIS/POOL_ADDRESSES_PROVIDER_REGISTRY.sol b/./downloads/CELO/POOL_ADDRESSES_PROVIDER_REGISTRY.sol +index e53c84f..8086e31 100644 +--- a/./downloads/GNOSIS/POOL_ADDRESSES_PROVIDER_REGISTRY.sol ++++ b/./downloads/CELO/POOL_ADDRESSES_PROVIDER_REGISTRY.sol + +``` diff --git a/GNOSIS_CELO/POOL_CONFIGURATOR_IMPL_DIFF.md b/GNOSIS_CELO/POOL_CONFIGURATOR_IMPL_DIFF.md new file mode 100644 index 00000000..83eeb0c2 --- /dev/null +++ b/GNOSIS_CELO/POOL_CONFIGURATOR_IMPL_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/GNOSIS/POOL_CONFIGURATOR_IMPL.sol b/./downloads/CELO/POOL_CONFIGURATOR_IMPL.sol +index 4b3c4ad..f370587 100644 +--- a/./downloads/GNOSIS/POOL_CONFIGURATOR_IMPL.sol ++++ b/./downloads/CELO/POOL_CONFIGURATOR_IMPL.sol + +``` diff --git a/GNOSIS_CELO/POOL_IMPL_DIFF.md b/GNOSIS_CELO/POOL_IMPL_DIFF.md new file mode 100644 index 00000000..0133eeae --- /dev/null +++ b/GNOSIS_CELO/POOL_IMPL_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/GNOSIS/POOL_IMPL.sol b/./downloads/CELO/POOL_IMPL.sol +index c910368..adf0527 100644 +--- a/./downloads/GNOSIS/POOL_IMPL.sol ++++ b/./downloads/CELO/POOL_IMPL.sol + +``` diff --git a/GNOSIS_CELO/POOL_LOGIC_DIFF.md b/GNOSIS_CELO/POOL_LOGIC_DIFF.md new file mode 100644 index 00000000..1ac33071 --- /dev/null +++ b/GNOSIS_CELO/POOL_LOGIC_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/GNOSIS/POOL_LOGIC.sol b/./downloads/CELO/POOL_LOGIC.sol +index 512173a..f3384e9 100644 +--- a/./downloads/GNOSIS/POOL_LOGIC.sol ++++ b/./downloads/CELO/POOL_LOGIC.sol + +``` diff --git a/GNOSIS_CELO/SUPPLY_LOGIC_DIFF.md b/GNOSIS_CELO/SUPPLY_LOGIC_DIFF.md new file mode 100644 index 00000000..5b7d85ab --- /dev/null +++ b/GNOSIS_CELO/SUPPLY_LOGIC_DIFF.md @@ -0,0 +1,7 @@ +```diff +diff --git a/./downloads/GNOSIS/SUPPLY_LOGIC.sol b/./downloads/CELO/SUPPLY_LOGIC.sol +index f92a961..cdb3a7c 100644 +--- a/./downloads/GNOSIS/SUPPLY_LOGIC.sol ++++ b/./downloads/CELO/SUPPLY_LOGIC.sol + +``` diff --git a/GNOSIS_CELO/UI_INCENTIVE_DATA_PROVIDER_DIFF.md b/GNOSIS_CELO/UI_INCENTIVE_DATA_PROVIDER_DIFF.md new file mode 100644 index 00000000..32cd1110 --- /dev/null +++ b/GNOSIS_CELO/UI_INCENTIVE_DATA_PROVIDER_DIFF.md @@ -0,0 +1,96 @@ +```diff +diff --git a/./downloads/GNOSIS/UI_INCENTIVE_DATA_PROVIDER.sol b/./downloads/CELO/UI_INCENTIVE_DATA_PROVIDER.sol +index 62824f1..63bc81b 100644 +--- a/./downloads/GNOSIS/UI_INCENTIVE_DATA_PROVIDER.sol ++++ b/./downloads/CELO/UI_INCENTIVE_DATA_PROVIDER.sol + +-// downloads/GNOSIS/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/src/contracts/rewards/interfaces/IRewardsController.sol ++// downloads/CELO/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/src/contracts/rewards/interfaces/IRewardsController.sol + + /** + * @title IRewardsController +@@ -3404,9 +3483,9 @@ interface IRewardsController is IRewardsDistributor { + * This check is enforced for integrators to be able to show incentives at + * the current Aave UI without the need to setup an external price registry + * @param reward The address of the reward to set the price aggregator +- * @param rewardOracle The address of price aggregator that follows IEACAggregatorProxy interface ++ * @param rewardOracle The address of price aggregator that follows AggregatorInterface interface + */ +- function setRewardOracle(address reward, IEACAggregatorProxy rewardOracle) external; ++ function setRewardOracle(address reward, AggregatorInterface rewardOracle) external; + + /** + * @dev Get the price aggregator oracle address +@@ -3438,8 +3517,8 @@ interface IRewardsController is IRewardsDistributor { + * address asset: The asset address to incentivize + * address reward: The reward token address + * ITransferStrategy transferStrategy: The TransferStrategy address with the install hook and claim logic. +- * IEACAggregatorProxy rewardOracle: The Price Oracle of a reward to visualize the incentives at the UI Frontend. +- * Must follow Chainlink Aggregator IEACAggregatorProxy interface to be compatible. ++ * AggregatorInterface rewardOracle: The Price Oracle of a reward to visualize the incentives at the UI Frontend. ++ * Must follow Chainlink Aggregator AggregatorInterface interface to be compatible. + */ + function configureAssets(RewardsDataTypes.RewardsConfigInput[] memory config) external; + +@@ -3536,7 +3615,7 @@ interface IRewardsController is IRewardsDistributor { + ) external returns (address[] memory rewardsList, uint256[] memory claimedAmounts); + } + +-// downloads/GNOSIS/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/src/contracts/helpers/UiIncentiveDataProviderV3.sol ++// downloads/CELO/UI_INCENTIVE_DATA_PROVIDER/UiIncentiveDataProviderV3/src/contracts/helpers/UiIncentiveDataProviderV3.sol + + contract UiIncentiveDataProviderV3 is IUiIncentiveDataProviderV3 { + using UserConfiguration for DataTypes.UserConfigurationMap; +@@ -3834,10 +3913,10 @@ contract UiIncentiveDataProviderV3 is IUiIncentiveDataProviderV3 { + rewardInformation.rewardOracleAddress = aTokenIncentiveController.getRewardOracle( + rewardInformation.rewardTokenAddress + ); +- rewardInformation.priceFeedDecimals = IEACAggregatorProxy( ++ rewardInformation.priceFeedDecimals = AggregatorInterface( + rewardInformation.rewardOracleAddress + ).decimals(); +- rewardInformation.rewardPriceFeed = IEACAggregatorProxy( ++ rewardInformation.rewardPriceFeed = AggregatorInterface( + rewardInformation.rewardOracleAddress + ).latestAnswer(); + +@@ -3888,10 +3967,10 @@ contract UiIncentiveDataProviderV3 is IUiIncentiveDataProviderV3 { + rewardInformation.rewardOracleAddress = vTokenIncentiveController.getRewardOracle( + rewardInformation.rewardTokenAddress + ); +- rewardInformation.priceFeedDecimals = IEACAggregatorProxy( ++ rewardInformation.priceFeedDecimals = AggregatorInterface( + rewardInformation.rewardOracleAddress + ).decimals(); +- rewardInformation.rewardPriceFeed = IEACAggregatorProxy( ++ rewardInformation.rewardPriceFeed = AggregatorInterface( + rewardInformation.rewardOracleAddress + ).latestAnswer(); + +@@ -3968,10 +4047,10 @@ contract UiIncentiveDataProviderV3 is IUiIncentiveDataProviderV3 { + userRewardInformation.rewardOracleAddress = aTokenIncentiveController.getRewardOracle( + userRewardInformation.rewardTokenAddress + ); +- userRewardInformation.priceFeedDecimals = IEACAggregatorProxy( ++ userRewardInformation.priceFeedDecimals = AggregatorInterface( + userRewardInformation.rewardOracleAddress + ).decimals(); +- userRewardInformation.rewardPriceFeed = IEACAggregatorProxy( ++ userRewardInformation.rewardPriceFeed = AggregatorInterface( + userRewardInformation.rewardOracleAddress + ).latestAnswer(); + +@@ -4021,10 +4100,10 @@ contract UiIncentiveDataProviderV3 is IUiIncentiveDataProviderV3 { + userRewardInformation.rewardOracleAddress = vTokenIncentiveController.getRewardOracle( + userRewardInformation.rewardTokenAddress + ); +- userRewardInformation.priceFeedDecimals = IEACAggregatorProxy( ++ userRewardInformation.priceFeedDecimals = AggregatorInterface( + userRewardInformation.rewardOracleAddress + ).decimals(); +- userRewardInformation.rewardPriceFeed = IEACAggregatorProxy( ++ userRewardInformation.rewardPriceFeed = AggregatorInterface( + userRewardInformation.rewardOracleAddress + ).latestAnswer(); + +``` diff --git a/GNOSIS_CELO/UI_POOL_DATA_PROVIDER_DIFF.md b/GNOSIS_CELO/UI_POOL_DATA_PROVIDER_DIFF.md new file mode 100644 index 00000000..385144ee --- /dev/null +++ b/GNOSIS_CELO/UI_POOL_DATA_PROVIDER_DIFF.md @@ -0,0 +1,51 @@ +```diff +diff --git a/./downloads/GNOSIS/UI_POOL_DATA_PROVIDER.sol b/./downloads/CELO/UI_POOL_DATA_PROVIDER.sol +index 9db6a74..18a6e75 100644 +--- a/./downloads/GNOSIS/UI_POOL_DATA_PROVIDER.sol ++++ b/./downloads/CELO/UI_POOL_DATA_PROVIDER.sol + +-// downloads/GNOSIS/UI_POOL_DATA_PROVIDER/UiPoolDataProviderV3/src/contracts/helpers/interfaces/IUiPoolDataProviderV3.sol ++// downloads/CELO/UI_POOL_DATA_PROVIDER/UiPoolDataProviderV3/src/contracts/helpers/interfaces/IUiPoolDataProviderV3.sol + + interface IUiPoolDataProviderV3 { + struct AggregatedReserveData { +@@ -2241,6 +2324,8 @@ interface IUiPoolDataProviderV3 { + // v3.1 + bool virtualAccActive; + uint128 virtualUnderlyingBalance; ++ // v3.3 ++ uint128 deficit; + } + +-// downloads/GNOSIS/UI_POOL_DATA_PROVIDER/UiPoolDataProviderV3/src/contracts/helpers/UiPoolDataProviderV3.sol ++// downloads/CELO/UI_POOL_DATA_PROVIDER/UiPoolDataProviderV3/src/contracts/helpers/UiPoolDataProviderV3.sol + + contract UiPoolDataProviderV3 is IUiPoolDataProviderV3 { + using WadRayMath for uint256; + using ReserveConfiguration for DataTypes.ReserveConfigurationMap; + using UserConfiguration for DataTypes.UserConfigurationMap; + +- IEACAggregatorProxy public immutable networkBaseTokenPriceInUsdProxyAggregator; +- IEACAggregatorProxy public immutable marketReferenceCurrencyPriceInUsdProxyAggregator; ++ AggregatorInterface public immutable networkBaseTokenPriceInUsdProxyAggregator; ++ AggregatorInterface public immutable marketReferenceCurrencyPriceInUsdProxyAggregator; + uint256 public constant ETH_CURRENCY_UNIT = 1 ether; + address public constant MKR_ADDRESS = 0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2; + + constructor( +- IEACAggregatorProxy _networkBaseTokenPriceInUsdProxyAggregator, +- IEACAggregatorProxy _marketReferenceCurrencyPriceInUsdProxyAggregator ++ AggregatorInterface _networkBaseTokenPriceInUsdProxyAggregator, ++ AggregatorInterface _marketReferenceCurrencyPriceInUsdProxyAggregator + ) { + networkBaseTokenPriceInUsdProxyAggregator = _networkBaseTokenPriceInUsdProxyAggregator; + marketReferenceCurrencyPriceInUsdProxyAggregator = _marketReferenceCurrencyPriceInUsdProxyAggregator; +@@ -3930,6 +4018,7 @@ contract UiPoolDataProviderV3 is IUiPoolDataProviderV3 { + } catch {} + + // v3 only ++ reserveData.deficit = uint128(pool.getReserveDeficit(reserveData.underlyingAsset)); + reserveData.debtCeiling = reserveConfigurationMap.getDebtCeiling(); + reserveData.debtCeilingDecimals = poolDataProvider.getDebtCeilingDecimals(); + (reserveData.borrowCap, reserveData.supplyCap) = reserveConfigurationMap.getCaps(); +``` diff --git a/GNOSIS_CELO/WALLET_BALANCE_PROVIDER_DIFF.md b/GNOSIS_CELO/WALLET_BALANCE_PROVIDER_DIFF.md new file mode 100644 index 00000000..7bf04f35 --- /dev/null +++ b/GNOSIS_CELO/WALLET_BALANCE_PROVIDER_DIFF.md @@ -0,0 +1,21 @@ +```diff +diff --git a/./downloads/GNOSIS/WALLET_BALANCE_PROVIDER.sol b/./downloads/CELO/WALLET_BALANCE_PROVIDER.sol +index cc18346..71277ff 100644 +--- a/./downloads/GNOSIS/WALLET_BALANCE_PROVIDER.sol ++++ b/./downloads/CELO/WALLET_BALANCE_PROVIDER.sol + +-// downloads/GNOSIS/WALLET_BALANCE_PROVIDER/WalletBalanceProvider/src/periphery/contracts/misc/WalletBalanceProvider.sol ++// downloads/CELO/WALLET_BALANCE_PROVIDER/WalletBalanceProvider/src/contracts/helpers/WalletBalanceProvider.sol + + /** + * @title WalletBalanceProvider contract +@@ -2433,7 +2611,7 @@ contract WalletBalanceProvider { + reservesWithEth[j] + ); + +- (bool isActive, , , , ) = configuration.getFlags(); ++ (bool isActive, , , ) = configuration.getFlags(); + + if (!isActive) { + balances[j] = 0; +``` diff --git a/diff.ts b/diff.ts new file mode 100644 index 00000000..a3875800 --- /dev/null +++ b/diff.ts @@ -0,0 +1,127 @@ +#!/usr/bin/env node + +import {ethers} from 'ethers'; +import {CONTRACTS, PROXIES, CHAIN_ID, Networks} from './diff_config'; +import {AaveV3Gnosis} from '@bgd-labs/aave-address-book'; +import child_process from 'child_process'; +import dotenv from 'dotenv'; +import fs from 'fs'; +dotenv.config(); + +function runCmd(cmd: string) { + var resp = child_process.execSync(cmd); + var result = resp.toString(); + return result; +} + +const API_KEYS = { + [Networks.GNOSIS]: process.env.ETHERSCAN_API_KEY_GNOSIS, + [Networks.CELO]: process.env.ETHERSCAN_API_KEY_CELO, + [Networks.FACTORY_LOCAL]: undefined, +}; + +const RPC_URLS = { + [Networks.GNOSIS]: process.env.RPC_GNOSIS, + [Networks.CELO]: process.env.RPC_CELO, + [Networks.FACTORY_LOCAL]: undefined, +}; + +function download(network: Networks, contractName: string, address: string) { + if (!fs.existsSync(`downloads/${network}/${contractName}`)) { + console.log('downloading', contractName); + runCmd( + `cast source --chain-id ${CHAIN_ID[network]} -d downloads/${network}/${contractName} ${address} --etherscan-api-key ${API_KEYS[network]}` + ); + } +} + +function getImpl(network: Networks, address: string) { + // as v3.3 proposal is not yet executed + if (address == AaveV3Gnosis.POOL) return '0x77C874799E9564A0D0670ED40bf023D249E7bb21'; + if (address == AaveV3Gnosis.POOL_CONFIGURATOR) return '0xE5e48Ad1F9D1A894188b483DcF91f4FaD6AbA43b'; + + const x = runCmd( + `cast storage --rpc-url ${RPC_URLS[network]} ${address} 24440054405305269366569402256811496959409073762505157381672968839269610695612 --etherscan-api-key ${API_KEYS[network]}` + ).replace('\n', ''); + return ethers.getAddress(x.slice(-40)); +} + +function diffContracts(commonContracts: string[], network1: string, network2: string) { + try { + commonContracts.map((contractName) => { + PROXIES.includes(contractName) && (contractName = contractName + '_IMPL'); + const sourcePathNetwork1 = + network1 != 'FACTORY_LOCAL' + ? `./downloads/${network1}/${contractName}.sol` + : `./downloads/FACTORY_LOCAL/${contractName}.sol`; + const sourcePathNetwork2 = + network2 != 'FACTORY_LOCAL' + ? `./downloads/${network2}/${contractName}.sol` + : `./downloads/FACTORY_LOCAL/${contractName}.sol`; + const outPath = `${network1}_${network2}/${contractName}_DIFF`; + runCmd( + `make git-diff before=${sourcePathNetwork1} after=${sourcePathNetwork2} out=${outPath}` + ); + }); + } catch (e) { + console.log(e); + throw new Error('oops... failed to diff contracts'); + } +} + +function flatten(network: string, name: string, path: string) { + console.log('flattening contract', name); + const sourcePath = + network != 'FACTORY_LOCAL' ? `./downloads/${network}/${name}/${path}` : `./${path}`; + const outPath = + network != 'FACTORY_LOCAL' + ? `./downloads/${network}/${name}.sol` + : `./downloads/FACTORY_LOCAL/${name}.sol`; + runCmd(`forge flatten ${sourcePath} --output ${outPath}`); +} + +function downloadContracts(commonContracts: string[], network: Networks) { + commonContracts.map((key) => { + const isProxy = PROXIES.includes(key); + const contractName = isProxy ? `${key}_IMPL` : key; + const address = isProxy + ? getImpl(network, CONTRACTS[network][key].address as string) + : CONTRACTS[network][key].address; + download(network, contractName, address as string); + }); +} + +function flattenContracts(commonContracts: string[], network: Networks) { + commonContracts.map((key) => { + const isProxy = PROXIES.includes(key); + const contractName = isProxy ? `${key}_IMPL` : key; + flatten(network, contractName, CONTRACTS[network as keyof typeof CONTRACTS][key].path); + }); +} + +async function main() { + // get networks to diff against from the command line input + const network1 = process.argv[2] as Networks; + const network2 = process.argv[3] as Networks; + + console.log(`comparing diffs between ${network1}, ${network2}`); + + // find all the common contracts to compare between both the networks. + const commonContracts = Object.keys(CONTRACTS[network1 as keyof typeof CONTRACTS]).filter((key) => + CONTRACTS[network2 as keyof typeof CONTRACTS].hasOwnProperty(key) + ); + + if (network1 != 'FACTORY_LOCAL') { + downloadContracts(commonContracts, network1); + } + if (network2 != 'FACTORY_LOCAL') { + downloadContracts(commonContracts, network2); + } + + flattenContracts(commonContracts, network1); + flattenContracts(commonContracts, network2); + + diffContracts(commonContracts, network1, network2); +} + +main(); diff --git a/diff_config.ts b/diff_config.ts new file mode 100644 index 00000000..041174f5 --- /dev/null +++ b/diff_config.ts @@ -0,0 +1,272 @@ +import {AaveV3Celo, AaveV3Gnosis} from '@bgd-labs/aave-address-book'; + +enum Networks { + GNOSIS = 'GNOSIS', + CELO = 'CELO', + FACTORY_LOCAL = 'FACTORY_LOCAL' +} + +const CONTRACTS: ContractsType = { + [Networks.GNOSIS]: { + POOL_ADDRESSES_PROVIDER: { + name: 'PoolAddressesProvider', + path: 'PoolAddressesProvider/src/core/contracts/protocol/configuration/PoolAddressesProvider.sol', + address: AaveV3Gnosis.POOL_ADDRESSES_PROVIDER, + }, + POOL: { + name: 'Pool', + path: 'PoolInstance/lib/aave-v3-origin/src/contracts/instances/PoolInstance.sol', + address: AaveV3Gnosis.POOL, + }, + POOL_CONFIGURATOR: { + name: 'PoolConfigurator', + path: 'PoolConfiguratorInstance/lib/aave-v3-origin/src/contracts/instances/PoolConfiguratorInstance.sol', + address: AaveV3Gnosis.POOL_CONFIGURATOR, + }, + ORACLE: { + name: 'AaveOracle', + path: 'AaveOracle/src/core/contracts/misc/AaveOracle.sol', + address: AaveV3Gnosis.ORACLE, + }, + AAVE_PROTOCOL_DATA_PROVIDER: { + name: 'AaveProtocolDataProvider', + path: 'AaveProtocolDataProvider/lib/aave-v3-origin/src/contracts/helpers/AaveProtocolDataProvider.sol', + address: '0xA2d323DBc43F445aD2d8974F17Be5dab32aAD474', + }, + ACL_MANAGER: { + name: 'ACLManager', + path: 'ACLManager/src/core/contracts/protocol/configuration/ACLManager.sol', + address: AaveV3Gnosis.ACL_MANAGER, + }, + COLLECTOR: { + name: 'Collector', + path: 'CollectorWithCustomImpl/src/CollectorWithCustomImpl.sol', + address: AaveV3Gnosis.COLLECTOR, + }, + DEFAULT_INCENTIVES_CONTROLLER: { + name: 'RewardsController', + path: 'RewardsController/src/periphery/contracts/rewards/RewardsController.sol', + address: AaveV3Gnosis.DEFAULT_INCENTIVES_CONTROLLER, + }, + DEFAULT_A_TOKEN_IMPL: { + name: 'AToken', + path: 'AToken/src/core/contracts/protocol/tokenization/AToken.sol', + address: AaveV3Gnosis.DEFAULT_A_TOKEN_IMPL_REV_1, + }, + DEFAULT_VARIABLE_DEBT_TOKEN_IMPL: { + name: 'VariableDebtToken', + path: 'VariableDebtToken/src/core/contracts/protocol/tokenization/VariableDebtToken.sol', + address: AaveV3Gnosis.DEFAULT_VARIABLE_DEBT_TOKEN_IMPL_REV_1, + }, + EMISSION_MANAGER: { + name: 'EmissionManager', + path: 'EmissionManager/src/periphery/contracts/rewards/EmissionManager.sol', + address: AaveV3Gnosis.EMISSION_MANAGER, + }, + POOL_ADDRESSES_PROVIDER_REGISTRY: { + name: 'PoolAddressesProviderRegistry', + path: 'PoolAddressesProviderRegistry/src/core/contracts/protocol/configuration/PoolAddressesProviderRegistry.sol', + address: AaveV3Gnosis.POOL_ADDRESSES_PROVIDER_REGISTRY, + }, + WALLET_BALANCE_PROVIDER: { + name: 'WalletBalanceProvider', + path: 'WalletBalanceProvider/src/periphery/contracts/misc/WalletBalanceProvider.sol', + address: AaveV3Gnosis.WALLET_BALANCE_PROVIDER, + }, + UI_POOL_DATA_PROVIDER: { + name: 'UiPoolDataProviderV3', + path: 'UiPoolDataProviderV3/src/contracts/helpers/UiPoolDataProviderV3.sol', + address: AaveV3Gnosis.UI_POOL_DATA_PROVIDER, + }, + UI_INCENTIVE_DATA_PROVIDER: { + name: 'UiIncentiveDataProviderV3', + path: 'UiIncentiveDataProviderV3/src/contracts/helpers/UiIncentiveDataProviderV3.sol', + address: AaveV3Gnosis.UI_INCENTIVE_DATA_PROVIDER, + }, + BORROW_LOGIC: { + name: 'BorrowLogic', + path: 'BorrowLogic/src/contracts/protocol/libraries/logic/BorrowLogic.sol', + address: '0x62325c94E1c49dcDb5937726aB5D8A4c37bCAd36', + }, + BRIDGE_LOGIC: { + name: 'BridgeLogic', + path: 'BridgeLogic/src/contracts/protocol/libraries/logic/BridgeLogic.sol', + address: '0x621Ef86D8A5C693a06295BC288B95C12D4CE4994', + }, + CONFIGURATOR_LOGIC: { + name: 'ConfiguratorLogic', + path: 'ConfiguratorLogic/src/contracts/protocol/libraries/logic/ConfiguratorLogic.sol', + address: '0x09e88e877B39D883BAFd46b65E7B06CC56963041', + }, + EMODE_LOGIC: { + name: 'EModeLogic', + path: 'EModeLogic/src/contracts/protocol/libraries/logic/EModeLogic.sol', + address: '0xC31d2362fAeD85dF79d0bec99693D0EB0Abd3f74', + }, + FLASHLOAN_LOGIC: { + name: 'FlashLoanLogic', + path: 'FlashLoanLogic/src/contracts/protocol/libraries/logic/FlashLoanLogic.sol', + address: '0x34039100cc9584Ae5D741d322e16d0d18CEE8770', + }, + LIQUIDATION_LOGIC: { + name: 'LiquidationLogic', + path: 'LiquidationLogic/src/contracts/protocol/libraries/logic/LiquidationLogic.sol', + address: '0x4731bF01583F991278692E8727d0700a00A1fBBf', + }, + POOL_LOGIC: { + name: 'PoolLogic', + path: 'PoolLogic/src/contracts/protocol/libraries/logic/PoolLogic.sol', + address: '0xf8C97539934ee66a67C26010e8e027D77E821B0C', + }, + SUPPLY_LOGIC: { + name: 'SupplyLogic', + path: 'SupplyLogic/src/contracts/protocol/libraries/logic/SupplyLogic.sol', + address: '0x185477906B46D9b8DE0DEB73A1bBfb87b5b51BC3', + }, + }, + [Networks.CELO]: { + POOL_ADDRESSES_PROVIDER: { + name: 'PoolAddressesProvider', + path: 'PoolAddressesProvider/src/contracts/protocol/configuration/PoolAddressesProvider.sol', + address: AaveV3Celo.POOL_ADDRESSES_PROVIDER, + }, + POOL: { + name: 'Pool', + path: 'PoolInstance/src/contracts/instances/PoolInstance.sol', + address: AaveV3Celo.POOL, + }, + POOL_CONFIGURATOR: { + name: 'PoolConfigurator', + path: 'PoolConfiguratorInstance/src/contracts/instances/PoolConfiguratorInstance.sol', + address: AaveV3Celo.POOL_CONFIGURATOR, + }, + ORACLE: { + name: 'AaveOracle', + path: 'AaveOracle/src/contracts/misc/AaveOracle.sol', + address: AaveV3Celo.ORACLE, + }, + AAVE_PROTOCOL_DATA_PROVIDER: { + name: 'AaveProtocolDataProvider', + path: 'AaveProtocolDataProvider/src/contracts/helpers/AaveProtocolDataProvider.sol', + address: AaveV3Celo.AAVE_PROTOCOL_DATA_PROVIDER, + }, + ACL_MANAGER: { + name: 'ACLManager', + path: 'ACLManager/src/contracts/protocol/configuration/ACLManager.sol', + address: AaveV3Celo.ACL_MANAGER, + }, + COLLECTOR: { + name: 'Collector', + path: 'Collector/src/contracts/treasury/Collector.sol', + address: AaveV3Celo.COLLECTOR, + }, + DEFAULT_INCENTIVES_CONTROLLER: { + name: 'RewardsController', + path: 'RewardsController/src/contracts/rewards/RewardsController.sol', + address: AaveV3Celo.DEFAULT_INCENTIVES_CONTROLLER, + }, + DEFAULT_A_TOKEN_IMPL: { + name: 'AToken', + path: 'ATokenInstance/src/contracts/instances/ATokenInstance.sol', + address: AaveV3Celo.DEFAULT_A_TOKEN_IMPL_REV_1, + }, + DEFAULT_VARIABLE_DEBT_TOKEN_IMPL: { + name: 'VariableDebtToken', + path: 'VariableDebtTokenInstance/src/contracts/instances/VariableDebtTokenInstance.sol', + address: AaveV3Celo.DEFAULT_VARIABLE_DEBT_TOKEN_IMPL_REV_1, + }, + EMISSION_MANAGER: { + name: 'EmissionManager', + path: 'EmissionManager/src/contracts/rewards/EmissionManager.sol', + address: AaveV3Celo.EMISSION_MANAGER, + }, + POOL_ADDRESSES_PROVIDER_REGISTRY: { + name: 'PoolAddressesProviderRegistry', + path: 'PoolAddressesProviderRegistry/src/contracts/protocol/configuration/PoolAddressesProviderRegistry.sol', + address: AaveV3Celo.POOL_ADDRESSES_PROVIDER_REGISTRY, + }, + WALLET_BALANCE_PROVIDER: { + name: 'WalletBalanceProvider', + path: 'WalletBalanceProvider/src/contracts/helpers/WalletBalanceProvider.sol', + address: AaveV3Celo.WALLET_BALANCE_PROVIDER, + }, + UI_POOL_DATA_PROVIDER: { + name: 'UiPoolDataProviderV3', + path: 'UiPoolDataProviderV3/src/contracts/helpers/UiPoolDataProviderV3.sol', + address: AaveV3Celo.UI_POOL_DATA_PROVIDER, + }, + UI_INCENTIVE_DATA_PROVIDER: { + name: 'UiIncentiveDataProviderV3', + path: 'UiIncentiveDataProviderV3/src/contracts/helpers/UiIncentiveDataProviderV3.sol', + address: AaveV3Celo.UI_INCENTIVE_DATA_PROVIDER, + }, + BORROW_LOGIC: { + name: 'BorrowLogic', + path: 'BorrowLogic/src/contracts/protocol/libraries/logic/BorrowLogic.sol', + address: '0xAB3218d0900Ba992084a6592b43f66926D4F5757', + }, + BRIDGE_LOGIC: { + name: 'BridgeLogic', + path: 'BridgeLogic/src/contracts/protocol/libraries/logic/BridgeLogic.sol', + address: '0x028a1Bc3769209345C9476aFBa72EE4274Cd2A5A', + }, + CONFIGURATOR_LOGIC: { + name: 'ConfiguratorLogic', + path: 'ConfiguratorLogic/src/contracts/protocol/libraries/logic/ConfiguratorLogic.sol', + address: '0x411A4940774E793916e705F83fb0876AcC581f6d', + }, + EMODE_LOGIC: { + name: 'EModeLogic', + path: 'EModeLogic/src/contracts/protocol/libraries/logic/EModeLogic.sol', + address: '0xc463D0Ef209A60318F6aF2e8D29958a665d89B1e', + }, + FLASHLOAN_LOGIC: { + name: 'FlashLoanLogic', + path: 'FlashLoanLogic/src/contracts/protocol/libraries/logic/FlashLoanLogic.sol', + address: '0x0b3486805D3bda7ACb2d5aa7E26f0b68aF647bc5', + }, + LIQUIDATION_LOGIC: { + name: 'LiquidationLogic', + path: 'LiquidationLogic/src/contracts/protocol/libraries/logic/LiquidationLogic.sol', + address: '0x70Ac8F684eED3769960b2f863e405afc90CabCD4', + }, + POOL_LOGIC: { + name: 'PoolLogic', + path: 'PoolLogic/src/contracts/protocol/libraries/logic/PoolLogic.sol', + address: '0x50B8ed003a371cc498c57518e3581a059834c70c', + }, + SUPPLY_LOGIC: { + name: 'SupplyLogic', + path: 'SupplyLogic/src/contracts/protocol/libraries/logic/SupplyLogic.sol', + address: '0x0742d8afd443B9D9B0587536d3750Ef94d69e4b7', + }, + }, + [Networks.FACTORY_LOCAL]: {} +}; + +interface ContractInfo { + name: string; + path: string; + address?: string; +} + +type ContractsType = { + [key in Networks]: { + [contractName: string]: ContractInfo; + }; +}; + +const PROXIES = [ + 'DEFAULT_INCENTIVES_CONTROLLER', + 'POOL', + 'POOL_CONFIGURATOR', + 'COLLECTOR', +]; + +const CHAIN_ID = { + [Networks.CELO]: 42220, + [Networks.GNOSIS]: 100, + [Networks.FACTORY_LOCAL]: undefined +}; + +export {CONTRACTS, PROXIES, CHAIN_ID, Networks};