-
Notifications
You must be signed in to change notification settings - Fork 0
/
hub.go
165 lines (155 loc) · 9.5 KB
/
hub.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
package paramHub
import (
sdk "github.com/aximchain/axc-cosmos-sdk/types"
"github.com/aximchain/axc-cosmos-sdk/types/fees"
"github.com/aximchain/axc-cosmos-sdk/x/bank"
param "github.com/aximchain/axc-cosmos-sdk/x/paramHub/types"
)
const AbciQueryPrefix = "param"
func RegisterUpgradeBeginBlocker(paramHub *ParamHub) {
sdk.UpgradeMgr.RegisterBeginBlocker(sdk.BEP9, func(ctx sdk.Context) {
timeLockFeeParams := []param.FeeParam{
¶m.FixedFeeParams{MsgType: "timeLock", Fee: TimeLockFee, FeeFor: sdk.FeeForProposer},
¶m.FixedFeeParams{MsgType: "timeUnlock", Fee: TimeUnlockFee, FeeFor: sdk.FeeForProposer},
¶m.FixedFeeParams{MsgType: "timeRelock", Fee: TimeRelockFee, FeeFor: sdk.FeeForProposer},
}
paramHub.UpdateFeeParams(ctx, timeLockFeeParams)
})
sdk.UpgradeMgr.RegisterBeginBlocker(sdk.BEP12, func(ctx sdk.Context) {
accountFlagsFeeParams := []param.FeeParam{
¶m.FixedFeeParams{MsgType: "setAccountFlags", Fee: SetAccountFlagsFee, FeeFor: sdk.FeeForProposer},
}
paramHub.UpdateFeeParams(ctx, accountFlagsFeeParams)
})
sdk.UpgradeMgr.RegisterBeginBlocker(sdk.BEP3, func(ctx sdk.Context) {
swapFeeParams := []param.FeeParam{
¶m.FixedFeeParams{MsgType: "HTLT", Fee: HTLTFee, FeeFor: sdk.FeeForProposer},
¶m.FixedFeeParams{MsgType: "depositHTLT", Fee: DepositHTLTFee, FeeFor: sdk.FeeForProposer},
¶m.FixedFeeParams{MsgType: "claimHTLT", Fee: ClaimHTLTFee, FeeFor: sdk.FeeForProposer},
¶m.FixedFeeParams{MsgType: "refundHTLT", Fee: RefundHTLTFee, FeeFor: sdk.FeeForProposer},
}
paramHub.UpdateFeeParams(ctx, swapFeeParams)
})
sdk.UpgradeMgr.RegisterBeginBlocker(sdk.LaunchAscUpgrade, func(ctx sdk.Context) {
updateFeeParams := []param.FeeParam{
¶m.FixedFeeParams{MsgType: "side_create_validator", Fee: CreateSideChainValidatorFee, FeeFor: sdk.FeeForProposer},
¶m.FixedFeeParams{MsgType: "side_edit_validator", Fee: EditSideChainValidatorFee, FeeFor: sdk.FeeForProposer},
¶m.FixedFeeParams{MsgType: "side_delegate", Fee: SideChainDelegateFee, FeeFor: sdk.FeeForProposer},
¶m.FixedFeeParams{MsgType: "side_redelegate", Fee: SideChainRedelegateFee, FeeFor: sdk.FeeForProposer},
¶m.FixedFeeParams{MsgType: "side_undelegate", Fee: SideChainUndelegateFee, FeeFor: sdk.FeeForProposer},
¶m.FixedFeeParams{MsgType: "asc_submit_evidence", Fee: AscSubmitEvidenceFee, FeeFor: sdk.FeeForProposer},
¶m.FixedFeeParams{MsgType: "side_chain_unjail", Fee: SideChainUnjail, FeeFor: sdk.FeeForProposer},
¶m.FixedFeeParams{MsgType: "side_submit_proposal", Fee: SideProposeFee, FeeFor: sdk.FeeForProposer},
¶m.FixedFeeParams{MsgType: "side_deposit", Fee: SideDepositFee, FeeFor: sdk.FeeForProposer},
¶m.FixedFeeParams{MsgType: "side_vote", Fee: SideVoteFee, FeeFor: sdk.FeeForProposer},
¶m.FixedFeeParams{MsgType: "crossBind", Fee: CrossBindFee, FeeFor: sdk.FeeForProposer},
¶m.FixedFeeParams{MsgType: "crossUnbind", Fee: CrossUnbindFee, FeeFor: sdk.FeeForProposer},
¶m.FixedFeeParams{MsgType: "crossTransferOut", Fee: CrossTransferOutFee, FeeFor: sdk.FeeForProposer},
¶m.FixedFeeParams{MsgType: "oracleClaim", Fee: sdk.ZeroFee, FeeFor: sdk.FeeFree},
// Following fees are charged on FC, and received at ASC, they are still fees in a broad sense, so still
// decide to put it here, rather than in paramset.
¶m.FixedFeeParams{MsgType: "crossBindRelayFee", Fee: CrossBindRelayFee, FeeFor: sdk.FeeForProposer},
¶m.FixedFeeParams{MsgType: "crossUnbindRelayFee", Fee: CrossUnbindRelayFee, FeeFor: sdk.FeeForProposer},
¶m.FixedFeeParams{MsgType: "crossTransferOutRelayFee", Fee: CrossTransferOutRelayFee, FeeFor: sdk.FeeForProposer},
}
paramHub.UpdateFeeParams(ctx, updateFeeParams)
})
sdk.UpgradeMgr.RegisterBeginBlocker(sdk.BEP8, func(ctx sdk.Context) {
miniTokenFeeParams := []param.FeeParam{
¶m.FixedFeeParams{MsgType: "tinyIssueMsg", Fee: TinyIssueFee, FeeFor: sdk.FeeForAll},
¶m.FixedFeeParams{MsgType: "miniIssueMsg", Fee: MiniIssueFee, FeeFor: sdk.FeeForAll},
¶m.FixedFeeParams{MsgType: "miniTokensSetURI", Fee: MiniSetUriFee, FeeFor: sdk.FeeForProposer},
¶m.FixedFeeParams{MsgType: "dexListMini", Fee: MiniListingFee, FeeFor: sdk.FeeForAll},
}
paramHub.UpdateFeeParams(ctx, miniTokenFeeParams)
})
sdk.UpgradeMgr.RegisterBeginBlocker(sdk.BEP82, func(ctx sdk.Context) {
updateFeeParams := []param.FeeParam{
¶m.FixedFeeParams{MsgType: "transferOwnership", Fee: TransferOwnershipFee, FeeFor: sdk.FeeForProposer},
}
paramHub.UpdateFeeParams(ctx, updateFeeParams)
})
sdk.UpgradeMgr.RegisterBeginBlocker(sdk.BEP153, func(ctx sdk.Context) {
crossStakeFeeParams := []param.FeeParam{
¶m.FixedFeeParams{MsgType: "crossDistributeRewardRelayFee", Fee: CrossDistributeRewardRelayFee, FeeFor: sdk.FeeForAll},
¶m.FixedFeeParams{MsgType: "crossDistributeUndelegatedRelayFee", Fee: CrossDistributeUndelegatedRelayFee, FeeFor: sdk.FeeForAll},
}
paramHub.UpdateFeeParams(ctx, crossStakeFeeParams)
})
sdk.UpgradeMgr.RegisterBeginBlocker(sdk.BEP159, func(ctx sdk.Context) {
updateFeeParams := []param.FeeParam{
¶m.FixedFeeParams{MsgType: "create_validator_open", Fee: CreateValidatorFee, FeeFor: sdk.FeeForProposer},
¶m.FixedFeeParams{MsgType: "edit_validator", Fee: EditChainValidatorFee, FeeFor: sdk.FeeForProposer},
¶m.FixedFeeParams{MsgType: "delegate", Fee: ChainDelegateFee, FeeFor: sdk.FeeForProposer},
¶m.FixedFeeParams{MsgType: "redelegate", Fee: ChainRedelegateFee, FeeFor: sdk.FeeForProposer},
¶m.FixedFeeParams{MsgType: "undelegate", Fee: ChainUndelegateFee, FeeFor: sdk.FeeForProposer},
¶m.FixedFeeParams{MsgType: "unjail", Fee: Unjail, FeeFor: sdk.FeeForProposer},
}
paramHub.UpdateFeeParams(ctx, updateFeeParams)
})
}
func EndBreatheBlock(ctx sdk.Context, paramHub *ParamHub) {
paramHub.EndBreatheBlock(ctx)
return
}
func EndBlock(ctx sdk.Context, paramHub *ParamHub) {
paramHub.EndBlock(ctx)
return
}
func init() {
// CalculatorsGen is defined in a common package which can't import app package.
// Reasonable to init here, since fee param drive the calculator.
fees.CalculatorsGen = map[string]fees.FeeCalculatorGenerator{
"submit_proposal": fees.FixedFeeCalculatorGen,
"deposit": fees.FixedFeeCalculatorGen,
"vote": fees.FixedFeeCalculatorGen,
"side_submit_proposal": fees.FixedFeeCalculatorGen,
"side_deposit": fees.FixedFeeCalculatorGen,
"side_vote": fees.FixedFeeCalculatorGen,
"create_validator": fees.FixedFeeCalculatorGen,
"remove_validator": fees.FixedFeeCalculatorGen,
"side_create_validator": fees.FixedFeeCalculatorGen,
"side_edit_validator": fees.FixedFeeCalculatorGen,
"side_delegate": fees.FixedFeeCalculatorGen,
"side_redelegate": fees.FixedFeeCalculatorGen,
"side_undelegate": fees.FixedFeeCalculatorGen,
"asc_submit_evidence": fees.FixedFeeCalculatorGen,
"side_chain_unjail": fees.FixedFeeCalculatorGen,
"dexList": fees.FixedFeeCalculatorGen,
"orderNew": fees.FixedFeeCalculatorGen,
"orderCancel": fees.FixedFeeCalculatorGen,
"issueMsg": fees.FixedFeeCalculatorGen,
"mintMsg": fees.FixedFeeCalculatorGen,
"tokensBurn": fees.FixedFeeCalculatorGen,
"setAccountFlags": fees.FixedFeeCalculatorGen,
"tokensFreeze": fees.FixedFeeCalculatorGen,
"timeLock": fees.FixedFeeCalculatorGen,
"timeUnlock": fees.FixedFeeCalculatorGen,
"timeRelock": fees.FixedFeeCalculatorGen,
"transferOwnership": fees.FixedFeeCalculatorGen,
"send": bank.TransferFeeCalculatorGen,
"HTLT": fees.FixedFeeCalculatorGen,
"depositHTLT": fees.FixedFeeCalculatorGen,
"claimHTLT": fees.FixedFeeCalculatorGen,
"refundHTLT": fees.FixedFeeCalculatorGen,
"crossBind": fees.FixedFeeCalculatorGen,
"crossUnbind": fees.FixedFeeCalculatorGen,
"crossTransferOut": fees.FixedFeeCalculatorGen,
"crossBindRelayFee": fees.FixedFeeCalculatorGen,
"crossUnbindRelayFee": fees.FixedFeeCalculatorGen,
"crossTransferOutRelayFee": fees.FixedFeeCalculatorGen,
"oracleClaim": fees.FixedFeeCalculatorGen,
"miniTokensSetURI": fees.FixedFeeCalculatorGen,
"dexListMini": fees.FixedFeeCalculatorGen,
"tinyIssueMsg": fees.FixedFeeCalculatorGen,
"miniIssueMsg": fees.FixedFeeCalculatorGen,
"crossDistributeRewardRelayFee": fees.FixedFeeCalculatorGen,
"crossDistributeUndelegatedRelayFee": fees.FixedFeeCalculatorGen,
"create_validator_open": fees.FixedFeeCalculatorGen,
"edit_validator": fees.FixedFeeCalculatorGen,
"delegate": fees.FixedFeeCalculatorGen,
"redelegate": fees.FixedFeeCalculatorGen,
"undelegate": fees.FixedFeeCalculatorGen,
"unjail": fees.FixedFeeCalculatorGen,
}
}