mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
31 lines
1.0 KiB
Solidity
31 lines
1.0 KiB
Solidity
// 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
|
|
);
|
|
_;
|
|
}
|
|
|
|
/**
|
|
* @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(_underlyingAsset).delegate(delegatee);
|
|
}
|
|
}
|