- Added marketId and setter on LendingPoolAddressesProvider

This commit is contained in:
eboado 2020-11-26 13:09:49 +01:00
parent d5b7df3070
commit fa11327b59
2 changed files with 21 additions and 0 deletions

View File

@ -9,6 +9,7 @@ pragma solidity 0.6.12;
* @author Aave
**/
interface ILendingPoolAddressesProvider {
event MarketIdSet(string newMarketId);
event LendingPoolUpdated(address indexed newAddress);
event ConfigurationAdminUpdated(address indexed newAddress);
event EmergencyAdminUpdated(address indexed newAddress);
@ -19,6 +20,8 @@ interface ILendingPoolAddressesProvider {
event ProxyCreated(bytes32 id, address indexed newAddress);
event AddressSet(bytes32 id, address indexed newAddress, bool hasProxy);
function setMarketId(string calldata marketId) external;
function setAddress(bytes32 id, address newAddress) external;
function setAddressAsProxy(bytes32 id, address impl) external;

View File

@ -17,6 +17,7 @@ import {ILendingPoolAddressesProvider} from '../../interfaces/ILendingPoolAddres
* @author Aave
**/
contract LendingPoolAddressesProvider is Ownable, ILendingPoolAddressesProvider {
string private _marketId;
mapping(bytes32 => address) private _addresses;
bytes32 private constant LENDING_POOL = 'LENDING_POOL';
@ -27,6 +28,18 @@ contract LendingPoolAddressesProvider is Ownable, ILendingPoolAddressesProvider
bytes32 private constant PRICE_ORACLE = 'PRICE_ORACLE';
bytes32 private constant LENDING_RATE_ORACLE = 'LENDING_RATE_ORACLE';
constructor(string memory marketId) public {
_setMarketId(marketId);
}
/**
* @dev Allows to set the market which this LendingPoolAddressesProvider represents
* @param marketId The market id
*/
function setMarketId(string memory marketId) external override onlyOwner {
_setMarketId(marketId);
}
/**
* @dev General function to update the implementation of a proxy registered with
* certain `id`. If there is no proxy registered, it will instantiate one and
@ -186,4 +199,9 @@ contract LendingPoolAddressesProvider is Ownable, ILendingPoolAddressesProvider
proxy.upgradeToAndCall(newAddress, params);
}
}
function _setMarketId(string memory marketId) internal {
_marketId = marketId;
emit MarketIdSet(marketId);
}
}