diff --git a/chainio/clients/elcontracts/reader.go b/chainio/clients/elcontracts/reader.go index b11206b2..d0c0c210 100644 --- a/chainio/clients/elcontracts/reader.go +++ b/chainio/clients/elcontracts/reader.go @@ -62,6 +62,8 @@ type ELReader interface { ) ([32]byte, error) GetDistributionRootsLength(opts *bind.CallOpts) (*big.Int, error) + + CurrRewardsCalculationEndTimestamp(opts *bind.CallOpts) (uint32, error) } type Config struct { @@ -238,13 +240,9 @@ func (r *ELChainReader) ServiceManagerCanSlashOperatorUntilBlock( return uint32(0), errors.New("slasher contract not provided") } - serviceManagerCanSlashOperatorUntilBlock, err := r.slasher.ContractCanSlashOperatorUntilBlock( + return r.slasher.ContractCanSlashOperatorUntilBlock( opts, operatorAddr, serviceManagerAddr, ) - if err != nil { - return 0, err - } - return serviceManagerCanSlashOperatorUntilBlock, nil } func (r *ELChainReader) OperatorIsFrozen(opts *bind.CallOpts, operatorAddr gethcommon.Address) (bool, error) { @@ -252,11 +250,7 @@ func (r *ELChainReader) OperatorIsFrozen(opts *bind.CallOpts, operatorAddr gethc return false, errors.New("slasher contract not provided") } - operatorIsFrozen, err := r.slasher.IsFrozen(opts, operatorAddr) - if err != nil { - return false, err - } - return operatorIsFrozen, nil + return r.slasher.IsFrozen(opts, operatorAddr) } func (r *ELChainReader) GetOperatorSharesInStrategy( @@ -268,15 +262,11 @@ func (r *ELChainReader) GetOperatorSharesInStrategy( return &big.Int{}, errors.New("DelegationManager contract not provided") } - operatorSharesInStrategy, err := r.delegationManager.OperatorShares( + return r.delegationManager.OperatorShares( opts, operatorAddr, strategyAddr, ) - if err != nil { - return nil, err - } - return operatorSharesInStrategy, nil } func (r *ELChainReader) CalculateDelegationApprovalDigestHash( @@ -311,3 +301,11 @@ func (r *ELChainReader) GetDistributionRootsLength(opts *bind.CallOpts) (*big.In return r.rewardsCoordinator.GetDistributionRootsLength(opts) } + +func (r *ELChainReader) CurrRewardsCalculationEndTimestamp(opts *bind.CallOpts) (uint32, error) { + if r.rewardsCoordinator == nil { + return 0, errors.New("RewardsCoordinator contract not provided") + } + + return r.rewardsCoordinator.CurrRewardsCalculationEndTimestamp(opts) +} diff --git a/chainio/mocks/elContractsReader.go b/chainio/mocks/elContractsReader.go index 03881c98..d8078172 100644 --- a/chainio/mocks/elContractsReader.go +++ b/chainio/mocks/elContractsReader.go @@ -74,6 +74,21 @@ func (mr *MockELReaderMockRecorder) CalculateOperatorAVSRegistrationDigestHash(a return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CalculateOperatorAVSRegistrationDigestHash", reflect.TypeOf((*MockELReader)(nil).CalculateOperatorAVSRegistrationDigestHash), arg0, arg1, arg2, arg3, arg4) } +// CurrRewardsCalculationEndTimestamp mocks base method. +func (m *MockELReader) CurrRewardsCalculationEndTimestamp(arg0 *bind.CallOpts) (uint32, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CurrRewardsCalculationEndTimestamp", arg0) + ret0, _ := ret[0].(uint32) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CurrRewardsCalculationEndTimestamp indicates an expected call of CurrRewardsCalculationEndTimestamp. +func (mr *MockELReaderMockRecorder) CurrRewardsCalculationEndTimestamp(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CurrRewardsCalculationEndTimestamp", reflect.TypeOf((*MockELReader)(nil).CurrRewardsCalculationEndTimestamp), arg0) +} + // GetDistributionRootsLength mocks base method. func (m *MockELReader) GetDistributionRootsLength(arg0 *bind.CallOpts) (*big.Int, error) { m.ctrl.T.Helper()