diff --git a/testutil/keeper/mock_keepers.go b/testutil/keeper/mock_keepers.go index 2416f0f743..a8e2b7fb6a 100644 --- a/testutil/keeper/mock_keepers.go +++ b/testutil/keeper/mock_keepers.go @@ -43,12 +43,15 @@ type mockStakingKeeperEmpty struct{} func (k mockStakingKeeperEmpty) ValidatorByConsAddr(sdk.Context, sdk.ConsAddress) stakingtypes.ValidatorI { return nil } + func (k mockStakingKeeperEmpty) UnbondingTime(ctx sdk.Context) time.Duration { return time.Duration(0) } + func (k mockStakingKeeperEmpty) GetAllDelegatorDelegations(ctx sdk.Context, delegator sdk.AccAddress) []stakingtypes.Delegation { return nil } + func (k mockStakingKeeperEmpty) GetDelegatorValidator(ctx sdk.Context, delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress) (validator stakingtypes.Validator, err error) { return stakingtypes.Validator{}, nil } diff --git a/x/dualstaking/keeper/delegate_credit.go b/x/dualstaking/keeper/delegate_credit.go index 3e0bfdac82..ed3d3cbefb 100644 --- a/x/dualstaking/keeper/delegate_credit.go +++ b/x/dualstaking/keeper/delegate_credit.go @@ -24,8 +24,10 @@ import ( "github.com/lavanet/lava/v4/x/dualstaking/types" ) -const monthHours = 720 // 30 days * 24 hours -const hourSeconds = 3600 +const ( + monthHours = 720 // 30 days * 24 hours + hourSeconds = 3600 +) // calculate the delegation credit based on the timestamps, and the amounts of delegations // amounts and credits represent daily value, rounded down @@ -100,6 +102,6 @@ func (k Keeper) CalculateMonthlyCredit(ctx sdk.Context, delegation types.Delegat timeStampDiff = monthHours } // normalize credit to 30 days - credit.Amount = credit.Amount.MulRaw(int64(timeStampDiff)).QuoRaw(monthHours) + credit.Amount = credit.Amount.MulRaw(timeStampDiff).QuoRaw(monthHours) return credit }