@@ -21,6 +21,8 @@ error PeriodOffsetInFuture(uint32 periodOffset);
21
21
// The minimum period length
22
22
uint32 constant MINIMUM_PERIOD_LENGTH = 1 hours ;
23
23
24
+ address constant SPONSORSHIP_ADDRESS = address (1 );
25
+
24
26
/**
25
27
* @title Time-Weighted Average Balance Controller
26
28
* @author PoolTogether Inc.
@@ -37,7 +39,6 @@ contract TwabController {
37
39
using SafeCast for uint256 ;
38
40
39
41
/// @notice Allows users to revoke their chances to win by delegating to the sponsorship address.
40
- address public constant SPONSORSHIP_ADDRESS = address (1 );
41
42
42
43
/// @notice Sets the minimum period length for Observations. When a period elapses, a new Observation is recorded, otherwise the most recent Observation is updated.
43
44
uint32 public immutable PERIOD_LENGTH;
@@ -679,7 +680,8 @@ contract TwabController {
679
680
(
680
681
ObservationLib.Observation memory _observation ,
681
682
bool _isNewObservation ,
682
- bool _isObservationRecorded
683
+ bool _isObservationRecorded ,
684
+ TwabLib.AccountDetails memory accountDetails
683
685
) = TwabLib.increaseBalances (PERIOD_LENGTH, PERIOD_OFFSET, _account, _amount, _delegateAmount);
684
686
685
687
// Always emit the balance change event
@@ -692,8 +694,8 @@ contract TwabController {
692
694
emit ObservationRecorded (
693
695
_vault,
694
696
_user,
695
- _account.details .balance,
696
- _account.details .delegateBalance,
697
+ accountDetails .balance,
698
+ accountDetails .delegateBalance,
697
699
_isNewObservation,
698
700
_observation
699
701
);
@@ -717,7 +719,8 @@ contract TwabController {
717
719
(
718
720
ObservationLib.Observation memory _observation ,
719
721
bool _isNewObservation ,
720
- bool _isObservationRecorded
722
+ bool _isObservationRecorded ,
723
+ TwabLib.AccountDetails memory accountDetails
721
724
) = TwabLib.decreaseBalances (
722
725
PERIOD_LENGTH,
723
726
PERIOD_OFFSET,
@@ -737,8 +740,8 @@ contract TwabController {
737
740
emit ObservationRecorded (
738
741
_vault,
739
742
_user,
740
- _account.details .balance,
741
- _account.details .delegateBalance,
743
+ accountDetails .balance,
744
+ accountDetails .delegateBalance,
742
745
_isNewObservation,
743
746
_observation
744
747
);
@@ -761,7 +764,8 @@ contract TwabController {
761
764
(
762
765
ObservationLib.Observation memory _observation ,
763
766
bool _isNewObservation ,
764
- bool _isObservationRecorded
767
+ bool _isObservationRecorded ,
768
+ TwabLib.AccountDetails memory accountDetails
765
769
) = TwabLib.decreaseBalances (
766
770
PERIOD_LENGTH,
767
771
PERIOD_OFFSET,
@@ -780,8 +784,8 @@ contract TwabController {
780
784
if (_isObservationRecorded) {
781
785
emit TotalSupplyObservationRecorded (
782
786
_vault,
783
- _account.details .balance,
784
- _account.details .delegateBalance,
787
+ accountDetails .balance,
788
+ accountDetails .delegateBalance,
785
789
_isNewObservation,
786
790
_observation
787
791
);
@@ -804,7 +808,8 @@ contract TwabController {
804
808
(
805
809
ObservationLib.Observation memory _observation ,
806
810
bool _isNewObservation ,
807
- bool _isObservationRecorded
811
+ bool _isObservationRecorded ,
812
+ TwabLib.AccountDetails memory accountDetails
808
813
) = TwabLib.increaseBalances (PERIOD_LENGTH, PERIOD_OFFSET, _account, _amount, _delegateAmount);
809
814
810
815
// Always emit the balance change event
@@ -816,8 +821,8 @@ contract TwabController {
816
821
if (_isObservationRecorded) {
817
822
emit TotalSupplyObservationRecorded (
818
823
_vault,
819
- _account.details .balance,
820
- _account.details .delegateBalance,
824
+ accountDetails .balance,
825
+ accountDetails .delegateBalance,
821
826
_isNewObservation,
822
827
_observation
823
828
);
0 commit comments