@@ -6,23 +6,23 @@ import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
66import "./UFragments.sol " ;
77
88
9- interface ExchangeRateAggregator {
10- function aggregate () external returns (uint128 , uint256 );
9+ interface MarketOracle {
10+ function getPriceAndVolume () external returns (uint128 , uint128 );
1111}
1212
1313
1414/**
1515 * @title uFragments Monetary Supply Policy
1616 * @notice This component regulates the token supply of the uFragments ERC20 token in response to
17- * price-feed oracles.
17+ * market oracles.
1818 */
1919contract UFragmentsPolicy is Ownable {
2020 using SafeMath for uint256 ;
2121
22- event Rebase (uint256 indexed epoch , uint128 exchangeRate , uint256 volume , int256 appliedSupplyAdjustment );
22+ event Rebase (uint256 indexed epoch , uint128 exchangeRate , uint128 volume , int256 appliedSupplyAdjustment );
2323
2424 UFragments private uFrags;
25- ExchangeRateAggregator private rateAggregator ;
25+ MarketOracle private marketOracle ;
2626
2727 // Timestamp of last rebase operation
2828 uint256 public lastRebaseTimestamp;
@@ -47,9 +47,9 @@ contract UFragmentsPolicy is Ownable {
4747 // The upper bound on uFragments' supply
4848 uint256 private constant MAX_SUPPLY = 2 ** 128 - 1 ;
4949
50- constructor (UFragments _uFrags , ExchangeRateAggregator _rateAggregator ) public {
50+ constructor (UFragments _uFrags , MarketOracle _marketOracle ) public {
5151 uFrags = _uFrags;
52- rateAggregator = _rateAggregator ;
52+ marketOracle = _marketOracle ;
5353 }
5454
5555 /**
@@ -62,8 +62,8 @@ contract UFragmentsPolicy is Ownable {
6262 lastRebaseTimestamp = now ;
6363
6464 uint128 exchangeRate;
65- uint256 volume;
66- (exchangeRate, volume) = rateAggregator. aggregate ();
65+ uint128 volume;
66+ (exchangeRate, volume) = marketOracle. getPriceAndVolume ();
6767 int256 supplyDelta = calcSupplyDelta (exchangeRate);
6868 supplyDelta = calcDampenedSupplyDelta (supplyDelta);
6969
@@ -76,8 +76,8 @@ contract UFragmentsPolicy is Ownable {
7676 }
7777
7878 /**
79- * @notice Allows setting the Deviation Threshold. If the exchange rate given by the exchange
80- * rate aggregator is within this threshold, then no supply modifications are made.
79+ * @notice Allows setting the Deviation Threshold. If the exchange rate given by the market
80+ * oracle is within this threshold, then no supply modifications are made.
8181 * @param _deviationThreshold The new exchange rate threshold.
8282 * TODO(iles): This should only be modified through distributed governance. #158010389
8383 */
@@ -111,7 +111,7 @@ contract UFragmentsPolicy is Ownable {
111111
112112 /**
113113 * @return The total supply adjustment that should be made in response to the exchange
114- * rate, as read from the aggregator .
114+ * rate, as provided by the market oracle .
115115 */
116116 function calcSupplyDelta (uint128 rate ) private view returns (int256 ) {
117117 if (withinDeviationThreshold (rate)) {
0 commit comments