@@ -7,6 +7,7 @@ import {WadRayMath} from "../libraries/math/WadRayMath.sol";
7
7
import {PercentageMath} from "../libraries/math/PercentageMath.sol " ;
8
8
9
9
import {IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol " ;
10
+ import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol " ;
10
11
11
12
/**
12
13
* @title InterestRate contract
@@ -15,42 +16,42 @@ import {IERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20
15
16
* point of utilization and another from that one to 100%
16
17
* @author Bend
17
18
**/
18
- contract InterestRate is IInterestRate {
19
+ contract InterestRate is IInterestRate , Ownable {
19
20
using WadRayMath for uint256 ;
20
21
using PercentageMath for uint256 ;
21
22
22
- ILendPoolAddressesProvider public immutable addressesProvider;
23
+ ILendPoolAddressesProvider public addressesProvider;
23
24
24
25
/**
25
26
* @dev this constant represents the utilization rate at which the pool aims to obtain most competitive borrow rates.
26
27
* Expressed in ray
27
28
**/
28
- uint256 public immutable OPTIMAL_UTILIZATION_RATE;
29
+ uint256 public OPTIMAL_UTILIZATION_RATE;
29
30
30
31
/**
31
32
* @dev This constant represents the excess utilization rate above the optimal. It's always equal to
32
33
* 1-optimal utilization rate. Added as a constant here for gas optimizations.
33
34
* Expressed in ray
34
35
**/
35
36
36
- uint256 public immutable EXCESS_UTILIZATION_RATE;
37
+ uint256 public EXCESS_UTILIZATION_RATE;
37
38
38
39
// Base variable borrow rate when Utilization rate = 0. Expressed in ray
39
- uint256 internal immutable _baseVariableBorrowRate;
40
+ uint256 internal _baseVariableBorrowRate;
40
41
41
42
// Slope of the variable interest curve when utilization rate > 0 and <= OPTIMAL_UTILIZATION_RATE. Expressed in ray
42
- uint256 internal immutable _variableRateSlope1;
43
+ uint256 internal _variableRateSlope1;
43
44
44
45
// Slope of the variable interest curve when utilization rate > OPTIMAL_UTILIZATION_RATE. Expressed in ray
45
- uint256 internal immutable _variableRateSlope2;
46
+ uint256 internal _variableRateSlope2;
46
47
47
48
constructor (
48
49
ILendPoolAddressesProvider provider ,
49
50
uint256 optimalUtilizationRate_ ,
50
51
uint256 baseVariableBorrowRate_ ,
51
52
uint256 variableRateSlope1_ ,
52
53
uint256 variableRateSlope2_
53
- ) {
54
+ ) Ownable () {
54
55
addressesProvider = provider;
55
56
OPTIMAL_UTILIZATION_RATE = optimalUtilizationRate_;
56
57
EXCESS_UTILIZATION_RATE = WadRayMath.ray () - (optimalUtilizationRate_);
@@ -59,6 +60,19 @@ contract InterestRate is IInterestRate {
59
60
_variableRateSlope2 = variableRateSlope2_;
60
61
}
61
62
63
+ function setInterestRateParams (
64
+ uint256 optimalUtilizationRate_ ,
65
+ uint256 baseVariableBorrowRate_ ,
66
+ uint256 variableRateSlope1_ ,
67
+ uint256 variableRateSlope2_
68
+ ) public onlyOwner {
69
+ OPTIMAL_UTILIZATION_RATE = optimalUtilizationRate_;
70
+ EXCESS_UTILIZATION_RATE = WadRayMath.ray () - (optimalUtilizationRate_);
71
+ _baseVariableBorrowRate = baseVariableBorrowRate_;
72
+ _variableRateSlope1 = variableRateSlope1_;
73
+ _variableRateSlope2 = variableRateSlope2_;
74
+ }
75
+
62
76
function variableRateSlope1 () external view returns (uint256 ) {
63
77
return _variableRateSlope1;
64
78
}
0 commit comments