Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
forcodedancing committed Aug 14, 2023
1 parent 4bbf20a commit 33f046a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion x/payment/keeper/storage_fee_charge.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (k Keeper) ApplyUserFlowsList(ctx sdk.Context, userFlowsList []types.UserFl
if err != nil {
return err
}
} else { // frozen status, should be called in end block for stop serving (uncharge fee) or for bucket migration (charge fee)
} else { // frozen status, should be called in end block for stop serving (uncharge fee)
err = k.applyFrozenUserFlows(ctx, userFlows, from, streamRecord)
if err != nil {
return err
Expand Down
8 changes: 4 additions & 4 deletions x/sp/keeper/sp_storage_price.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ func (k Keeper) UpdateGlobalSpStorePrice(ctx sdk.Context) error {
func (k Keeper) calculateMedian(prices []sdk.Dec) sdk.Dec {
l := len(prices)
sort.Slice(prices, func(i, j int) bool { return prices[i].LT(prices[j]) })
var storeMedian sdk.Dec
var median sdk.Dec
if l%2 == 0 {
storeMedian = prices[l/2-1].Add(prices[l/2]).QuoInt64(2)
median = prices[l/2-1].Add(prices[l/2]).QuoInt64(2)
} else {
storeMedian = prices[l/2]
median = prices[l/2]
}
return storeMedian
return median
}

func (k Keeper) GetGlobalSpStorePriceByTime(ctx sdk.Context, time int64) (val types.GlobalSpStorePrice, err error) {
Expand Down
2 changes: 1 addition & 1 deletion x/sp/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func SpStoragePriceKey(spId uint32) []byte {
}

func ParseSpStoragePriceKey(key []byte) (spId uint32) {
spId = binary.BigEndian.Uint32(key[0:4])
spId = binary.BigEndian.Uint32(key)
return
}

Expand Down
3 changes: 1 addition & 2 deletions x/storage/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"encoding/binary"
"fmt"

paymenttypes "github.com/bnb-chain/greenfield/x/payment/types"

"cosmossdk.io/errors"
sdkmath "cosmossdk.io/math"
"github.com/cometbft/cometbft/libs/log"
Expand All @@ -19,6 +17,7 @@ import (
gnfdtypes "github.com/bnb-chain/greenfield/types"
"github.com/bnb-chain/greenfield/types/common"
"github.com/bnb-chain/greenfield/types/resource"
paymenttypes "github.com/bnb-chain/greenfield/x/payment/types"
permtypes "github.com/bnb-chain/greenfield/x/permission/types"
sptypes "github.com/bnb-chain/greenfield/x/sp/types"
"github.com/bnb-chain/greenfield/x/storage/types"
Expand Down

0 comments on commit 33f046a

Please sign in to comment.