address Chris review
This commit is contained in:
parent
4f6c77d8cb
commit
bf02cdcf97
|
@ -5,6 +5,10 @@ import (
|
||||||
wire "github.com/cosmos/cosmos-sdk/wire"
|
wire "github.com/cosmos/cosmos-sdk/wire"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
collectedFeesKey = []byte("collectedFees")
|
||||||
|
)
|
||||||
|
|
||||||
// This FeeCollectionKeeper handles collection of fees in the anteHandler
|
// This FeeCollectionKeeper handles collection of fees in the anteHandler
|
||||||
// and setting of MinFees for different fee tokens
|
// and setting of MinFees for different fee tokens
|
||||||
type FeeCollectionKeeper struct {
|
type FeeCollectionKeeper struct {
|
||||||
|
@ -27,28 +31,21 @@ func NewFeeCollectionKeeper(cdc *wire.Codec, key sdk.StoreKey) FeeCollectionKeep
|
||||||
// Adds to Collected Fee Pool
|
// Adds to Collected Fee Pool
|
||||||
func (fck FeeCollectionKeeper) GetCollectedFees(ctx sdk.Context) sdk.Coins {
|
func (fck FeeCollectionKeeper) GetCollectedFees(ctx sdk.Context) sdk.Coins {
|
||||||
store := ctx.KVStore(fck.key)
|
store := ctx.KVStore(fck.key)
|
||||||
bz := store.Get([]byte("collectedFees"))
|
bz := store.Get(collectedFeesKey)
|
||||||
if bz == nil {
|
if bz == nil {
|
||||||
return sdk.Coins{}
|
return sdk.Coins{}
|
||||||
}
|
}
|
||||||
|
|
||||||
feePool := &(sdk.Coins{})
|
feePool := &(sdk.Coins{})
|
||||||
err := fck.cdc.UnmarshalBinary(bz, feePool)
|
fck.cdc.MustUnmarshalBinary(bz, feePool)
|
||||||
if err != nil {
|
|
||||||
panic("should not happen")
|
|
||||||
}
|
|
||||||
return *feePool
|
return *feePool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets to Collected Fee Pool
|
// Sets to Collected Fee Pool
|
||||||
func (fck FeeCollectionKeeper) setCollectedFees(ctx sdk.Context, coins sdk.Coins) {
|
func (fck FeeCollectionKeeper) setCollectedFees(ctx sdk.Context, coins sdk.Coins) {
|
||||||
bz, err := fck.cdc.MarshalBinary(coins)
|
bz := fck.cdc.MustMarshalBinary(coins)
|
||||||
if err != nil {
|
|
||||||
panic("should not happen")
|
|
||||||
}
|
|
||||||
|
|
||||||
store := ctx.KVStore(fck.key)
|
store := ctx.KVStore(fck.key)
|
||||||
store.Set([]byte("collectedFees"), bz)
|
store.Set(collectedFeesKey, bz)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adds to Collected Fee Pool
|
// Adds to Collected Fee Pool
|
||||||
|
|
Loading…
Reference in New Issue