-
Notifications
You must be signed in to change notification settings - Fork 2
/
proposal.go
64 lines (53 loc) · 2.13 KB
/
proposal.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package keeper
import (
"fmt"
"time"
sdk "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/types"
"github.com/fibonacci-chain/fbc/x/feesplit/types"
sdkGov "github.com/fibonacci-chain/fbc/x/gov"
govKeeper "github.com/fibonacci-chain/fbc/x/gov/keeper"
govTypes "github.com/fibonacci-chain/fbc/x/gov/types"
)
var _ govKeeper.ProposalHandler = (*Keeper)(nil)
// GetMinDeposit returns min deposit
func (k Keeper) GetMinDeposit(ctx sdk.Context, content sdkGov.Content) (minDeposit sdk.SysCoins) {
switch content.(type) {
case types.FeeSplitSharesProposal:
minDeposit = k.govKeeper.GetDepositParams(ctx).MinDeposit
}
return
}
// GetMaxDepositPeriod returns max deposit period
func (k Keeper) GetMaxDepositPeriod(ctx sdk.Context, content sdkGov.Content) (maxDepositPeriod time.Duration) {
switch content.(type) {
case types.FeeSplitSharesProposal:
maxDepositPeriod = k.govKeeper.GetDepositParams(ctx).MaxDepositPeriod
}
return
}
// GetVotingPeriod returns voting period
func (k Keeper) GetVotingPeriod(ctx sdk.Context, content sdkGov.Content) (votingPeriod time.Duration) {
switch content.(type) {
case types.FeeSplitSharesProposal:
votingPeriod = k.govKeeper.GetVotingParams(ctx).VotingPeriod
}
return
}
// CheckMsgSubmitProposal validates MsgSubmitProposal
func (k Keeper) CheckMsgSubmitProposal(ctx sdk.Context, msg govTypes.MsgSubmitProposal) sdk.Error {
switch content := msg.Content.(type) {
case types.FeeSplitSharesProposal:
// whole target address list will be added/deleted to/from the contract deployment whitelist/contract blocked list.
// It's not necessary to check the existence in CheckMsgSubmitProposal
return nil
default:
return sdk.ErrUnknownRequest(fmt.Sprintf("unrecognized %s proposal content type: %T", types.DefaultCodespace, content))
}
}
// nolint
func (k Keeper) AfterSubmitProposalHandler(_ sdk.Context, _ govTypes.Proposal) {}
func (k Keeper) AfterDepositPeriodPassed(_ sdk.Context, _ govTypes.Proposal) {}
func (k Keeper) RejectedHandler(_ sdk.Context, _ govTypes.Content) {}
func (k Keeper) VoteHandler(_ sdk.Context, _ govTypes.Proposal, _ govTypes.Vote) (string, sdk.Error) {
return "", nil
}