aave-protocol-v2/contracts/protocol/tokenization/DelegationAwareAToken.sol

31 lines
1.0 KiB
Solidity
Raw Normal View History

// SPDX-License-Identifier: agpl-3.0
2020-11-20 10:45:20 +00:00
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 {
2020-11-05 11:35:50 +00:00
modifier onlyPoolAdmin {
require(
_msgSender() == ILendingPool(_pool).getAddressesProvider().getPoolAdmin(),
2020-11-05 11:35:50 +00:00
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
**/
2020-11-05 11:35:50 +00:00
function delegateUnderlyingTo(address delegatee) external onlyPoolAdmin {
IDelegationToken(_underlyingAsset).delegate(delegatee);
}
}