@@ -5,6 +5,7 @@ import "./SelfDestructible.sol";
5
5
import "./SafeDecimalMath.sol " ;
6
6
import "./MixinResolver.sol " ;
7
7
import "./Synthetix.sol " ;
8
+ import "./interfaces/ISystemStatus.sol " ;
8
9
import "./interfaces/ISynthetixEscrow.sol " ;
9
10
import "./interfaces/IExchangeRates.sol " ;
10
11
import "./interfaces/ISynthetixState.sol " ;
@@ -16,7 +17,6 @@ import "./FeePoolState.sol";
16
17
import "./FeePoolEternalStorage.sol " ;
17
18
import "./DelegateApprovals.sol " ;
18
19
19
-
20
20
// https://docs.synthetix.io/contracts/FeePool
21
21
contract FeePool is Proxyable , SelfDestructible , LimitedSetup , MixinResolver {
22
22
using SafeMath for uint ;
@@ -69,6 +69,7 @@ contract FeePool is Proxyable, SelfDestructible, LimitedSetup, MixinResolver {
69
69
70
70
/* ========== ADDRESS RESOLVER CONFIGURATION ========== */
71
71
72
+ bytes32 private constant CONTRACT_SYSTEMSTATUS = "SystemStatus " ;
72
73
bytes32 private constant CONTRACT_EXRATES = "ExchangeRates " ;
73
74
bytes32 private constant CONTRACT_SYNTHETIX = "Synthetix " ;
74
75
bytes32 private constant CONTRACT_FEEPOOLSTATE = "FeePoolState " ;
@@ -80,6 +81,7 @@ contract FeePool is Proxyable, SelfDestructible, LimitedSetup, MixinResolver {
80
81
bytes32 private constant CONTRACT_DELEGATEAPPROVALS = "DelegateApprovals " ;
81
82
82
83
bytes32 [24 ] private addressesToCache = [
84
+ CONTRACT_SYSTEMSTATUS,
83
85
CONTRACT_EXRATES,
84
86
CONTRACT_SYNTHETIX,
85
87
CONTRACT_FEEPOOLSTATE,
@@ -114,6 +116,10 @@ contract FeePool is Proxyable, SelfDestructible, LimitedSetup, MixinResolver {
114
116
115
117
/* ========== VIEWS ========== */
116
118
119
+ function systemStatus () internal view returns (ISystemStatus) {
120
+ return ISystemStatus (requireAndGetAddress (CONTRACT_SYSTEMSTATUS, "Missing SystemStatus address " ));
121
+ }
122
+
117
123
function synthetix () internal view returns (ISynthetix) {
118
124
return ISynthetix (requireAndGetAddress (CONTRACT_SYNTHETIX, "Missing Synthetix address " ));
119
125
}
@@ -251,6 +257,8 @@ contract FeePool is Proxyable, SelfDestructible, LimitedSetup, MixinResolver {
251
257
function closeCurrentFeePeriod () external {
252
258
require (_recentFeePeriodsStorage (0 ).startTime <= (now - feePeriodDuration), "Too early to close fee period " );
253
259
260
+ systemStatus ().requireIssuanceActive ();
261
+
254
262
FeePeriod storage secondLastFeePeriod = _recentFeePeriodsStorage (FEE_PERIOD_LENGTH - 2 );
255
263
FeePeriod storage lastFeePeriod = _recentFeePeriodsStorage (FEE_PERIOD_LENGTH - 1 );
256
264
@@ -284,25 +292,27 @@ contract FeePool is Proxyable, SelfDestructible, LimitedSetup, MixinResolver {
284
292
}
285
293
286
294
/**
287
- * @notice Claim fees for last period when available or not already withdrawn.
288
- */
295
+ * @notice Claim fees for last period when available or not already withdrawn.
296
+ */
289
297
function claimFees () external optionalProxy returns (bool ) {
290
298
return _claimFees (messageSender);
291
299
}
292
300
293
301
/**
294
- * @notice Delegated claimFees(). Call from the deletegated address
295
- * and the fees will be sent to the claimingForAddress.
296
- * approveClaimOnBehalf() must be called first to approve the deletage address
297
- * @param claimingForAddress The account you are claiming fees for
298
- */
302
+ * @notice Delegated claimFees(). Call from the deletegated address
303
+ * and the fees will be sent to the claimingForAddress.
304
+ * approveClaimOnBehalf() must be called first to approve the deletage address
305
+ * @param claimingForAddress The account you are claiming fees for
306
+ */
299
307
function claimOnBehalf (address claimingForAddress ) external optionalProxy returns (bool ) {
300
308
require (delegateApprovals ().canClaimFor (claimingForAddress, messageSender), "Not approved to claim on behalf " );
301
309
302
310
return _claimFees (claimingForAddress);
303
311
}
304
312
305
313
function _claimFees (address claimingAddress ) internal returns (bool ) {
314
+ systemStatus ().requireIssuanceActive ();
315
+
306
316
uint rewardsPaid = 0 ;
307
317
uint feesPaid = 0 ;
308
318
uint availableFees;
@@ -345,8 +355,8 @@ contract FeePool is Proxyable, SelfDestructible, LimitedSetup, MixinResolver {
345
355
}
346
356
347
357
/**
348
- * @notice Admin function to import the FeePeriod data from the previous contract
349
- */
358
+ * @notice Admin function to import the FeePeriod data from the previous contract
359
+ */
350
360
function importFeePeriod (
351
361
uint feePeriodIndex ,
352
362
uint feePeriodId ,
@@ -371,10 +381,10 @@ contract FeePool is Proxyable, SelfDestructible, LimitedSetup, MixinResolver {
371
381
}
372
382
373
383
/**
374
- * @notice Owner can escrow SNX. Owner to send the tokens to the RewardEscrow
375
- * @param account Address to escrow tokens for
376
- * @param quantity Amount of tokens to escrow
377
- */
384
+ * @notice Owner can escrow SNX. Owner to send the tokens to the RewardEscrow
385
+ * @param account Address to escrow tokens for
386
+ * @param quantity Amount of tokens to escrow
387
+ */
378
388
function appendVestingEntry (address account , uint quantity ) public optionalProxy_onlyOwner {
379
389
// Transfer SNX from messageSender to the Reward Escrow
380
390
synthetix ().transferFrom (messageSender, rewardEscrow (), quantity);
@@ -462,10 +472,10 @@ contract FeePool is Proxyable, SelfDestructible, LimitedSetup, MixinResolver {
462
472
}
463
473
464
474
/**
465
- * @notice Send the fees to claiming address.
466
- * @param account The address to send the fees to.
467
- * @param sUSDAmount The amount of fees priced in sUSD.
468
- */
475
+ * @notice Send the fees to claiming address.
476
+ * @param account The address to send the fees to.
477
+ * @param sUSDAmount The amount of fees priced in sUSD.
478
+ */
469
479
function _payFees (address account , uint sUSDAmount ) internal notFeeAddress (account) {
470
480
// Checks not really possible but rather gaurds for the internal code.
471
481
require (
@@ -491,10 +501,10 @@ contract FeePool is Proxyable, SelfDestructible, LimitedSetup, MixinResolver {
491
501
}
492
502
493
503
/**
494
- * @notice Send the rewards to claiming address - will be locked in rewardEscrow.
495
- * @param account The address to send the fees to.
496
- * @param snxAmount The amount of SNX.
497
- */
504
+ * @notice Send the rewards to claiming address - will be locked in rewardEscrow.
505
+ * @param account The address to send the fees to.
506
+ * @param snxAmount The amount of SNX.
507
+ */
498
508
function _payRewards (address account , uint snxAmount ) internal notFeeAddress (account) {
499
509
require (account != address (0 ), "Account can't be 0 " );
500
510
require (account != address (this ), "Can't send rewards to fee pool " );
@@ -753,8 +763,8 @@ contract FeePool is Proxyable, SelfDestructible, LimitedSetup, MixinResolver {
753
763
}
754
764
755
765
/**
756
- * @notice Calculate the collateral ratio before user is blocked from claiming.
757
- */
766
+ * @notice Calculate the collateral ratio before user is blocked from claiming.
767
+ */
758
768
function getPenaltyThresholdRatio () public view returns (uint ) {
759
769
uint targetRatio = synthetixState ().issuanceRatio ();
760
770
@@ -787,11 +797,6 @@ contract FeePool is Proxyable, SelfDestructible, LimitedSetup, MixinResolver {
787
797
_;
788
798
}
789
799
790
- modifier onlyExchanger {
791
- require (msg .sender == address (exchanger ()), "FeePool: Only Exchanger Authorised " );
792
- _;
793
- }
794
-
795
800
modifier notFeeAddress (address account ) {
796
801
require (account != FEE_ADDRESS, "Fee address not allowed " );
797
802
_;
0 commit comments