-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathAssetListingProposalGenericExecutor.sol
73 lines (70 loc) · 2.44 KB
/
AssetListingProposalGenericExecutor.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
import {IERC20} from './interfaces/IERC20.sol';
import {ILendingPoolConfiguratorV2} from './interfaces/ILendingPoolConfiguratorV2.sol';
import {IProposalGenericExecutor} from './interfaces/IProposalGenericExecutor.sol';
import {IOverlyingAsset} from './interfaces/IOverlyingAsset.sol';
import {ILendingPoolAddressesProvider} from './interfaces/ILendingPoolAddressesProvider.sol';
/**
* @title AssetListingProposalGenericExecutor
* @notice Proposal payload to be executed by the Aave Governance contract via DELEGATECALL
* @author Aave
**/
contract AssetListingProposalGenericExecutor is IProposalGenericExecutor {
event ProposalExecuted();
ILendingPoolAddressesProvider public constant LENDING_POOL_ADDRESSES_PROVIDER =
ILendingPoolAddressesProvider(0xB53C1a33016B2DC2fF3653530bfF1848a515c8c5);
/**
* @dev Payload execution function, called once a proposal passed in the Aave governance
*/
function execute(
address token,
address aToken,
address stableDebtToken,
address variablDebtToken,
address interestStrategy,
uint256 ltv,
uint256 liquidationThreshold,
uint256 liquidationBonus,
uint256 reserveFactor,
uint8 decimals,
bool enableBorrow,
bool enableStableBorrow,
bool enableAsCollateral
) external override {
ILendingPoolConfiguratorV2 LENDING_POOL_CONFIGURATOR_V2 =
ILendingPoolConfiguratorV2(LENDING_POOL_ADDRESSES_PROVIDER.getLendingPoolConfigurator());
require(
token == IOverlyingAsset(aToken).UNDERLYING_ASSET_ADDRESS(),
'ATOKEN: WRONG_UNDERLYING_TOKEN'
);
require(
token == IOverlyingAsset(stableDebtToken).UNDERLYING_ASSET_ADDRESS(),
'STABLE_DEBT: WRONG_UNDERLYING_TOKEN'
);
require(
token == IOverlyingAsset(variablDebtToken).UNDERLYING_ASSET_ADDRESS(),
'VARIABLE_DEBT: WRONG_UNDERLYING_TOKEN'
);
LENDING_POOL_CONFIGURATOR_V2.initReserve(
aToken,
stableDebtToken,
variablDebtToken,
decimals,
interestStrategy
);
if (enableBorrow) {
LENDING_POOL_CONFIGURATOR_V2.enableBorrowingOnReserve(token, enableStableBorrow);
}
LENDING_POOL_CONFIGURATOR_V2.setReserveFactor(token, reserveFactor);
if (enableAsCollateral) {
LENDING_POOL_CONFIGURATOR_V2.configureReserveAsCollateral(
token,
ltv,
liquidationThreshold,
liquidationBonus
);
}
emit ProposalExecuted();
}
}