-
Notifications
You must be signed in to change notification settings - Fork 0
/
pub.go
28 lines (26 loc) · 820 Bytes
/
pub.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
package cross_stake
import (
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/pubsub"
sdk "github.com/cosmos/cosmos-sdk/types"
)
func PublishCrossStakeEvent(ctx sdk.Context, keeper Keeper, from string, to []pubsub.CrossReceiver, symbol string,
eventType string, relayerFee int64) {
if keeper.PbsbServer != nil {
txHash := ctx.Value(baseapp.TxHashKey)
if txHashStr, ok := txHash.(string); ok {
event := pubsub.CrossTransferEvent{
TxHash: txHashStr,
ChainId: keeper.DestChainName,
RelayerFee: relayerFee,
Type: eventType,
From: from,
Denom: symbol,
To: to,
}
keeper.PbsbServer.Publish(event)
} else {
ctx.Logger().With("module", "stake").Error("failed to get txhash, will not publish cross transfer event ")
}
}
}