@@ -21,6 +21,8 @@ error PeriodOffsetInFuture(uint32 periodOffset);
2121// The minimum period length
2222uint32 constant MINIMUM_PERIOD_LENGTH = 1 hours ;
2323
24+ address constant SPONSORSHIP_ADDRESS = address (1 );
25+
2426/**
2527 * @title Time-Weighted Average Balance Controller
2628 * @author PoolTogether Inc.
@@ -37,7 +39,6 @@ contract TwabController {
3739 using SafeCast for uint256 ;
3840
3941 /// @notice Allows users to revoke their chances to win by delegating to the sponsorship address.
40- address public constant SPONSORSHIP_ADDRESS = address (1 );
4142
4243 /// @notice Sets the minimum period length for Observations. When a period elapses, a new Observation is recorded, otherwise the most recent Observation is updated.
4344 uint32 public immutable PERIOD_LENGTH;
@@ -679,7 +680,8 @@ contract TwabController {
679680 (
680681 ObservationLib.Observation memory _observation ,
681682 bool _isNewObservation ,
682- bool _isObservationRecorded
683+ bool _isObservationRecorded ,
684+ TwabLib.AccountDetails memory accountDetails
683685 ) = TwabLib.increaseBalances (PERIOD_LENGTH, PERIOD_OFFSET, _account, _amount, _delegateAmount);
684686
685687 // Always emit the balance change event
@@ -692,8 +694,8 @@ contract TwabController {
692694 emit ObservationRecorded (
693695 _vault,
694696 _user,
695- _account.details .balance,
696- _account.details .delegateBalance,
697+ accountDetails .balance,
698+ accountDetails .delegateBalance,
697699 _isNewObservation,
698700 _observation
699701 );
@@ -717,7 +719,8 @@ contract TwabController {
717719 (
718720 ObservationLib.Observation memory _observation ,
719721 bool _isNewObservation ,
720- bool _isObservationRecorded
722+ bool _isObservationRecorded ,
723+ TwabLib.AccountDetails memory accountDetails
721724 ) = TwabLib.decreaseBalances (
722725 PERIOD_LENGTH,
723726 PERIOD_OFFSET,
@@ -737,8 +740,8 @@ contract TwabController {
737740 emit ObservationRecorded (
738741 _vault,
739742 _user,
740- _account.details .balance,
741- _account.details .delegateBalance,
743+ accountDetails .balance,
744+ accountDetails .delegateBalance,
742745 _isNewObservation,
743746 _observation
744747 );
@@ -761,7 +764,8 @@ contract TwabController {
761764 (
762765 ObservationLib.Observation memory _observation ,
763766 bool _isNewObservation ,
764- bool _isObservationRecorded
767+ bool _isObservationRecorded ,
768+ TwabLib.AccountDetails memory accountDetails
765769 ) = TwabLib.decreaseBalances (
766770 PERIOD_LENGTH,
767771 PERIOD_OFFSET,
@@ -780,8 +784,8 @@ contract TwabController {
780784 if (_isObservationRecorded) {
781785 emit TotalSupplyObservationRecorded (
782786 _vault,
783- _account.details .balance,
784- _account.details .delegateBalance,
787+ accountDetails .balance,
788+ accountDetails .delegateBalance,
785789 _isNewObservation,
786790 _observation
787791 );
@@ -804,7 +808,8 @@ contract TwabController {
804808 (
805809 ObservationLib.Observation memory _observation ,
806810 bool _isNewObservation ,
807- bool _isObservationRecorded
811+ bool _isObservationRecorded ,
812+ TwabLib.AccountDetails memory accountDetails
808813 ) = TwabLib.increaseBalances (PERIOD_LENGTH, PERIOD_OFFSET, _account, _amount, _delegateAmount);
809814
810815 // Always emit the balance change event
@@ -816,8 +821,8 @@ contract TwabController {
816821 if (_isObservationRecorded) {
817822 emit TotalSupplyObservationRecorded (
818823 _vault,
819- _account.details .balance,
820- _account.details .delegateBalance,
824+ accountDetails .balance,
825+ accountDetails .delegateBalance,
821826 _isNewObservation,
822827 _observation
823828 );
0 commit comments