Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
omerlavanet committed Nov 28, 2024
1 parent f986516 commit 00dae9f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions testutil/keeper/mock_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
8 changes: 5 additions & 3 deletions x/dualstaking/keeper/delegate_credit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

0 comments on commit 00dae9f

Please sign in to comment.