Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: celo diffs #103

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions GNOSIS_CELO/AAVE_PROTOCOL_DATA_PROVIDER_DIFF.md
Original file line number Diff line number Diff line change
@@ -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

```
7 changes: 7 additions & 0 deletions GNOSIS_CELO/ACL_MANAGER_DIFF.md
Original file line number Diff line number Diff line change
@@ -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

```
7 changes: 7 additions & 0 deletions GNOSIS_CELO/BORROW_LOGIC_DIFF.md
Original file line number Diff line number Diff line change
@@ -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

```
7 changes: 7 additions & 0 deletions GNOSIS_CELO/BRIDGE_LOGIC_DIFF.md
Original file line number Diff line number Diff line change
@@ -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

```
76 changes: 76 additions & 0 deletions GNOSIS_CELO/COLLECTOR_IMPL_DIFF.md
Original file line number Diff line number Diff line change
@@ -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);
- }
-}
```
7 changes: 7 additions & 0 deletions GNOSIS_CELO/CONFIGURATOR_LOGIC_DIFF.md
Original file line number Diff line number Diff line change
@@ -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

```
157 changes: 157 additions & 0 deletions GNOSIS_CELO/DEFAULT_A_TOKEN_IMPL_DIFF.md
Original file line number Diff line number Diff line change
@@ -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
+ );
+ }
+}
```
123 changes: 123 additions & 0 deletions GNOSIS_CELO/DEFAULT_INCENTIVES_CONTROLLER_IMPL_DIFF.md
Original file line number Diff line number Diff line change
@@ -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));
```
Loading
Loading