/
keeper.go
49 lines (41 loc) · 1.39 KB
/
keeper.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package keeper
import (
"github.com/cosmos/cosmos-sdk/codec"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
driptypes "github.com/CosmosContracts/juno/v21/x/drip/types"
)
// Keeper of this module maintains distributing tokens to all stakers.
type Keeper struct {
storeKey storetypes.StoreKey
cdc codec.BinaryCodec
bankKeeper driptypes.BankKeeper
feeCollectorName string
// the address capable of executing a MsgUpdateParams message. Typically, this
// should be the x/gov module account.
authority string
}
// NewKeeper creates new instances of the Keeper
func NewKeeper(
storeKey storetypes.StoreKey,
cdc codec.BinaryCodec,
bk driptypes.BankKeeper,
feeCollector string,
authority string,
) Keeper {
return Keeper{
storeKey: storeKey,
cdc: cdc,
bankKeeper: bk,
feeCollectorName: feeCollector,
authority: authority,
}
}
// GetAuthority returns the x/mint module's authority.
func (k Keeper) GetAuthority() string {
return k.authority
}
// SendCoinsFromAccountToFeeCollector transfers amt to the fee collector account, where it will be catch up by the distribution module at the next block
func (k Keeper) SendCoinsFromAccountToFeeCollector(ctx sdk.Context, senderAddr sdk.AccAddress, amt sdk.Coins) error {
return k.bankKeeper.SendCoinsFromAccountToModule(ctx, senderAddr, k.feeCollectorName, amt)
}