added function to update the aToken instance

This commit is contained in:
The3D 2020-08-10 15:29:18 +02:00
parent fb5377a63e
commit 734d125cd7

View File

@ -180,7 +180,6 @@ contract LendingPoolConfigurator is VersionedInitializable {
uint8 _underlyingAssetDecimals,
address _interestRateStrategyAddress
) public onlyLendingPoolManager {
InitializableAdminUpgradeabilityProxy aTokenProxy = new InitializableAdminUpgradeabilityProxy();
bytes memory params = abi.encodeWithSignature(
@ -212,6 +211,25 @@ contract LendingPoolConfigurator is VersionedInitializable {
emit ReserveInitialized(_reserve, address(aTokenProxy), _interestRateStrategyAddress);
}
function updateAToken(address _reserve, address _implementation) external onlyLendingPoolManager {
(address aTokenAddress, , ) = pool.getReserveTokensAddresses(_reserve);
uint8 decimals = IERC20Detailed(aTokenAddress).decimals();
InitializableAdminUpgradeabilityProxy aTokenProxy = InitializableAdminUpgradeabilityProxy(
payable(aTokenAddress)
);
bytes memory params = abi.encodeWithSignature(
'initialize(uint8,string,string)',
decimals,
IERC20Detailed(aTokenAddress).name(),
IERC20Detailed(aTokenAddress).symbol()
);
aTokenProxy.upgradeToAndCall(_implementation, params);
}
/**
* @dev enables borrowing on a reserve
* @param _reserve the address of the reserve