Skip to content

Commit 2f3a2a3

Browse files
committed
improve farming reward estimation
1 parent 7401f32 commit 2f3a2a3

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

x/farming/keeper/reward.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,16 @@ func (k Keeper) GetEstimatedReward(ctx sdk.Context, address string, amount sdk.C
6565

6666
types.UpdateEpochTotalStakings(nextEpoch, staking)
6767

68-
totalStakings := []types.TotalStaking{}
68+
totalStakings := []types.TotalStaking{
69+
types.TotalStaking{
70+
Denom: staking.Amount.Denom,
71+
Amount: staking.Amount,
72+
EffectiveAmount: staking.EffectiveAmount,
73+
},
74+
}
75+
6976
for _, staking := range k.GetStakingsByAddress(ctx, address) {
70-
if !staking.StartTime.Add(staking.LockDuration).Before(nextEpoch.StartTime) {
77+
if staking.Status == types.StakingStatus_STAKING_STATUS_STAKED && !staking.StartTime.Add(staking.LockDuration).Before(nextEpoch.EndTime) {
7178
totalStakings = types.UpdateAccountTotalStakings(totalStakings, staking)
7279
}
7380
}

0 commit comments

Comments
 (0)