-
Notifications
You must be signed in to change notification settings - Fork 182
/
app_parallel.go
41 lines (35 loc) · 1.27 KB
/
app_parallel.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
package app
import (
sdk "github.com/okex/exchain/libs/cosmos-sdk/types"
"github.com/okex/exchain/libs/cosmos-sdk/x/auth"
authante "github.com/okex/exchain/libs/cosmos-sdk/x/auth/ante"
"github.com/okex/exchain/libs/cosmos-sdk/x/bank"
"github.com/okex/exchain/libs/cosmos-sdk/x/supply"
"github.com/okex/exchain/x/evm"
evmtypes "github.com/okex/exchain/x/evm/types"
)
// feeCollectorHandler set or get the value of feeCollectorAcc
func updateFeeCollectorHandler(bk bank.Keeper, sk supply.Keeper) sdk.UpdateFeeCollectorAccHandler {
return func(ctx sdk.Context, balance sdk.Coins) error {
return bk.SetCoins(ctx, sk.GetModuleAddress(auth.FeeCollectorName), balance)
}
}
// evmTxFeeHandler get tx fee for evm tx
func evmTxFeeHandler() sdk.GetTxFeeHandler {
return func(ctx sdk.Context, tx sdk.Tx) (fee sdk.Coins, isEvm bool, signCache sdk.SigCache) {
if evmTx, ok := tx.(evmtypes.MsgEthereumTx); ok {
isEvm = true
signCache, _ = evmTx.VerifySig(evmTx.ChainID(), ctx.BlockHeight(), nil)
}
if feeTx, ok := tx.(authante.FeeTx); ok {
fee = feeTx.GetFee()
}
return
}
}
// fixLogForParallelTxHandler fix log for parallel tx
func fixLogForParallelTxHandler(ek *evm.Keeper) sdk.LogFix {
return func(execResults [][]string) (logs [][]byte) {
return ek.FixLog(execResults)
}
}