...
This commit is contained in:
parent
46db96bdb7
commit
dae32a3d65
|
@ -9,6 +9,7 @@ import (
|
|||
// keeper of the stake store
|
||||
type Keeper struct {
|
||||
storeKey sdk.StoreKey
|
||||
storeTKey sdk.StoreKey
|
||||
cdc *wire.Codec
|
||||
coinKeeper types.CoinKeeper
|
||||
stakeKeeper types.StakeKeeper
|
||||
|
@ -17,11 +18,12 @@ type Keeper struct {
|
|||
codespace sdk.CodespaceType
|
||||
}
|
||||
|
||||
func NewKeeper(cdc *wire.Codec, key sdk.StoreKey, ck types.CoinKeeper,
|
||||
func NewKeeper(cdc *wire.Codec, key, tkey sdk.StoreKey, ck types.CoinKeeper,
|
||||
sk types.StakeKeeper, codespace sdk.CodespaceType) Keeper {
|
||||
|
||||
keeper := Keeper{
|
||||
storeKey: key,
|
||||
storeTKey: tkey,
|
||||
cdc: cdc,
|
||||
coinKeeper: ck,
|
||||
codespace: codespace,
|
||||
|
@ -35,7 +37,7 @@ func NewKeeper(cdc *wire.Codec, key sdk.StoreKey, ck types.CoinKeeper,
|
|||
func (k Keeper) GetFeePool(ctx sdk.Context) (feePool types.FeePool) {
|
||||
store := ctx.KVStore(k.storeKey)
|
||||
|
||||
b := store.Get(GlobalKey)
|
||||
b := store.Get(FeePoolKey)
|
||||
if b == nil {
|
||||
panic("Stored fee pool should not have been nil")
|
||||
}
|
||||
|
@ -48,5 +50,14 @@ func (k Keeper) GetFeePool(ctx sdk.Context) (feePool types.FeePool) {
|
|||
func (k Keeper) SetFeePool(ctx sdk.Context, feePool types.FeePool) {
|
||||
store := ctx.KVStore(k.storeKey)
|
||||
b := k.cdc.MustMarshalBinary(feePool)
|
||||
store.Set(GlobalKey, b)
|
||||
store.Set(FeePoolKey, b)
|
||||
}
|
||||
|
||||
//______________________________________________________________________
|
||||
|
||||
// set the global fee pool distribution info
|
||||
func (k Keeper) GetFeePool(ctx sdk.Context, proposerPK sdk.PubKey) {
|
||||
store := ctx.KVStore(k.storeKey)
|
||||
b := k.cdc.MustMarshalBinary(proposerPK)
|
||||
store.Set(ProposerKey, b)
|
||||
}
|
||||
|
|
|
@ -6,9 +6,12 @@ import (
|
|||
|
||||
// keys/key-prefixes
|
||||
var (
|
||||
GlobalKey = []byte{0x00} // key for global distribution state
|
||||
FeePoolKey = []byte{0x00} // key for global distribution state
|
||||
ValidatorDistInfoKey = []byte{0x01} // prefix for each key to a validator distribution
|
||||
DelegatorDistInfoKey = []byte{0x02} // prefix for each key to a delegation distribution
|
||||
|
||||
// transient
|
||||
ProposerKey = []byte{0x00} // key for storing the proposer operator address
|
||||
)
|
||||
|
||||
// gets the key for the validator distribution info from address
|
||||
|
|
Loading…
Reference in New Issue