-
Notifications
You must be signed in to change notification settings - Fork 0
/
fees.go
45 lines (35 loc) · 1.31 KB
/
fees.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
//nolint
package keeper
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
// deductIssueFee performs fee handling for issuing token
func (k Keeper) deductIssueFee(ctx sdk.Context, authority sdk.AccAddress) error {
params := k.GetParamSet(ctx)
// check if amount is zero
if params.IssueFee.Amount.IsZero() || params.IssueFee.Amount.IsNegative() {
return nil
}
// send issue fantoken fee to community pool
return k.distrKeeper.FundCommunityPool(ctx, sdk.Coins{params.IssueFee}, authority)
}
// deductMintFee performs fee handling for minting token
func (k Keeper) deductMintFee(ctx sdk.Context, authority sdk.AccAddress) error {
params := k.GetParamSet(ctx)
// check if amount is zero
if params.MintFee.Amount.IsZero() || params.MintFee.Amount.IsNegative() {
return nil
}
// send Mint fantoken fee to community pool
return k.distrKeeper.FundCommunityPool(ctx, sdk.Coins{params.MintFee}, authority)
}
// deductBurnFee performs fee handling for burning token
func (k Keeper) deductBurnFee(ctx sdk.Context, authority sdk.AccAddress) error {
params := k.GetParamSet(ctx)
// check if amount is zero
if params.BurnFee.Amount.IsZero() || params.BurnFee.Amount.IsNegative() {
return nil
}
// send Burn fantoken fee to community pool
return k.distrKeeper.FundCommunityPool(ctx, sdk.Coins{params.BurnFee}, authority)
}