Skip to content

Instantly share code, notes, and snippets.

@sakulstra
Created July 15, 2022 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sakulstra/80eec9e5c8f08bbb43f577448524503f to your computer and use it in GitHub Desktop.
Save sakulstra/80eec9e5c8f08bbb43f577448524503f to your computer and use it in GitHub Desktop.
folder diff
```diff
diff --git a/src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/dependencies/openzeppelin/contracts/Address.sol b/src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/dependencies/openzeppelin/contracts/Address.sol
similarity index 100%
rename from src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/dependencies/openzeppelin/contracts/Address.sol
rename to src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/dependencies/openzeppelin/contracts/Address.sol
diff --git a/src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/dependencies/openzeppelin/contracts/Context.sol b/src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/dependencies/openzeppelin/contracts/Context.sol
similarity index 100%
rename from src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/dependencies/openzeppelin/contracts/Context.sol
rename to src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/dependencies/openzeppelin/contracts/Context.sol
diff --git a/src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/dependencies/openzeppelin/contracts/IERC20.sol b/src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/dependencies/openzeppelin/contracts/IERC20.sol
similarity index 100%
rename from src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/dependencies/openzeppelin/contracts/IERC20.sol
rename to src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/dependencies/openzeppelin/contracts/IERC20.sol
diff --git a/src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol b/src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol
similarity index 100%
rename from src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol
rename to src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol
diff --git a/src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/dependencies/openzeppelin/contracts/SafeERC20.sol b/src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/dependencies/openzeppelin/contracts/SafeERC20.sol
similarity index 100%
rename from src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/dependencies/openzeppelin/contracts/SafeERC20.sol
rename to src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/dependencies/openzeppelin/contracts/SafeERC20.sol
diff --git a/src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/dependencies/openzeppelin/contracts/SafeMath.sol b/src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/dependencies/openzeppelin/contracts/SafeMath.sol
similarity index 100%
rename from src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/dependencies/openzeppelin/contracts/SafeMath.sol
rename to src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/dependencies/openzeppelin/contracts/SafeMath.sol
diff --git a/src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/interfaces/IAToken.sol b/src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/interfaces/IAToken.sol
similarity index 100%
rename from src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/interfaces/IAToken.sol
rename to src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/interfaces/IAToken.sol
diff --git a/src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/interfaces/IAaveIncentivesController.sol b/src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/interfaces/IAaveIncentivesController.sol
similarity index 100%
rename from src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/interfaces/IAaveIncentivesController.sol
rename to src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/interfaces/IAaveIncentivesController.sol
diff --git a/src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/interfaces/IDelegationToken.sol b/src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/interfaces/IDelegationToken.sol
new file mode 100644
index 0000000..870e05b
--- /dev/null
+++ b/src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/interfaces/IDelegationToken.sol
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: agpl-3.0
+pragma solidity 0.6.12;
+
+/**
+ * @title IDelegationToken
+ * @dev Implements an interface for tokens with delegation COMP/UNI compatible
+ * @author Aave
+ **/
+interface IDelegationToken {
+ function delegate(address delegatee) external;
+}
diff --git a/src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/interfaces/ILendingPool.sol b/src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/interfaces/ILendingPool.sol
similarity index 100%
rename from src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/interfaces/ILendingPool.sol
rename to src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/interfaces/ILendingPool.sol
diff --git a/src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/interfaces/ILendingPoolAddressesProvider.sol b/src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/interfaces/ILendingPoolAddressesProvider.sol
similarity index 100%
rename from src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/interfaces/ILendingPoolAddressesProvider.sol
rename to src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/interfaces/ILendingPoolAddressesProvider.sol
diff --git a/src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/interfaces/IScaledBalanceToken.sol b/src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/interfaces/IScaledBalanceToken.sol
similarity index 100%
rename from src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/interfaces/IScaledBalanceToken.sol
rename to src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/interfaces/IScaledBalanceToken.sol
diff --git a/src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol b/src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol
similarity index 100%
rename from src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol
rename to src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol
diff --git a/src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/protocol/libraries/helpers/Errors.sol b/src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/protocol/libraries/helpers/Errors.sol
similarity index 100%
rename from src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/protocol/libraries/helpers/Errors.sol
rename to src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/protocol/libraries/helpers/Errors.sol
diff --git a/src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/protocol/libraries/math/WadRayMath.sol b/src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/protocol/libraries/math/WadRayMath.sol
similarity index 100%
rename from src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/protocol/libraries/math/WadRayMath.sol
rename to src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/protocol/libraries/math/WadRayMath.sol
diff --git a/src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/protocol/libraries/types/DataTypes.sol b/src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/protocol/libraries/types/DataTypes.sol
similarity index 100%
rename from src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/protocol/libraries/types/DataTypes.sol
rename to src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/protocol/libraries/types/DataTypes.sol
diff --git a/src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/protocol/tokenization/AToken.sol b/src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/protocol/tokenization/AToken.sol
similarity index 99%
rename from src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/protocol/tokenization/AToken.sol
rename to src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/protocol/tokenization/AToken.sol
index 545d68b..79ebec6 100644
--- a/src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/protocol/tokenization/AToken.sol
+++ b/src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/protocol/tokenization/AToken.sol
@@ -27,7 +27,7 @@ contract AToken is VersionedInitializable, IncentivizedERC20, IAToken {
keccak256('Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)');
uint256 public constant UINT_MAX_VALUE = uint256(-1);
- uint256 public constant ATOKEN_REVISION = 0x2;
+ uint256 public constant ATOKEN_REVISION = 0x1;
address public immutable UNDERLYING_ASSET_ADDRESS;
address public immutable RESERVE_TREASURY_ADDRESS;
ILendingPool public immutable POOL;
diff --git a/src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/protocol/tokenization/DelegationAwareAToken.sol b/src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/protocol/tokenization/DelegationAwareAToken.sol
new file mode 100644
index 0000000..4e49f2b
--- /dev/null
+++ b/src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/protocol/tokenization/DelegationAwareAToken.sol
@@ -0,0 +1,49 @@
+// SPDX-License-Identifier: agpl-3.0
+pragma solidity 0.6.12;
+
+import {ILendingPool} from '../../interfaces/ILendingPool.sol';
+import {IDelegationToken} from '../../interfaces/IDelegationToken.sol';
+import {Errors} from '../libraries/helpers/Errors.sol';
+import {AToken} from './AToken.sol';
+
+/**
+ * @title Aave AToken enabled to delegate voting power of the underlying asset to a different address
+ * @dev The underlying asset needs to be compatible with the COMP delegation interface
+ * @author Aave
+ */
+contract DelegationAwareAToken is AToken {
+ modifier onlyPoolAdmin {
+ require(
+ _msgSender() == ILendingPool(POOL).getAddressesProvider().getPoolAdmin(),
+ Errors.CALLER_NOT_POOL_ADMIN
+ );
+ _;
+ }
+
+ constructor(
+ ILendingPool pool,
+ address underlyingAssetAddress,
+ address reserveTreasury,
+ string memory tokenName,
+ string memory tokenSymbol,
+ address incentivesController
+ )
+ public
+ AToken(
+ pool,
+ underlyingAssetAddress,
+ reserveTreasury,
+ tokenName,
+ tokenSymbol,
+ incentivesController
+ )
+ {}
+
+ /**
+ * @dev Delegates voting power of the underlying asset to a `delegatee` address
+ * @param delegatee The address that will receive the delegation
+ **/
+ function delegateUnderlyingTo(address delegatee) external onlyPoolAdmin {
+ IDelegationToken(UNDERLYING_ASSET_ADDRESS).delegate(delegatee);
+ }
+}
diff --git a/src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/protocol/tokenization/IncentivizedERC20.sol b/src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/protocol/tokenization/IncentivizedERC20.sol
similarity index 100%
rename from src/etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/protocol/tokenization/IncentivizedERC20.sol
rename to src/etherscan/0xB2f4Fb41F01CdeF7c10F0e8aFbeB3cFA79d1686F/DelegationAwareAToken/contracts/protocol/tokenization/IncentivizedERC20.sol
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment