From fa11327b5919a85e6975cc1ee91ff711d5479b2c Mon Sep 17 00:00:00 2001 From: eboado Date: Thu, 26 Nov 2020 13:09:49 +0100 Subject: [PATCH] - Added marketId and setter on LendingPoolAddressesProvider --- .../ILendingPoolAddressesProvider.sol | 3 +++ .../LendingPoolAddressesProvider.sol | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/contracts/interfaces/ILendingPoolAddressesProvider.sol b/contracts/interfaces/ILendingPoolAddressesProvider.sol index e54973c1..3c826c52 100644 --- a/contracts/interfaces/ILendingPoolAddressesProvider.sol +++ b/contracts/interfaces/ILendingPoolAddressesProvider.sol @@ -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; diff --git a/contracts/protocol/configuration/LendingPoolAddressesProvider.sol b/contracts/protocol/configuration/LendingPoolAddressesProvider.sol index f6f7bef2..520a0513 100644 --- a/contracts/protocol/configuration/LendingPoolAddressesProvider.sol +++ b/contracts/protocol/configuration/LendingPoolAddressesProvider.sol @@ -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); + } }