-
Notifications
You must be signed in to change notification settings - Fork 236
/
events.go
42 lines (35 loc) · 1.26 KB
/
events.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
package types
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
)
const (
AttributeValueCategory = ModuleName
AttributeKeyRecipient = "recipient"
AttributeKeySender = "sender"
AttributeKeyAmount = "amount"
AttributeKeyReceiver = "receiver"
AttributeKeyEthereumTokenContract = "ethereum_token_contract"
// events
EventTypeConvertVouchers = "convert_vouchers"
EventTypeTransferTokens = "transfer_tokens"
EventTypeEthereumSendToCosmosHandled = "ethereum_send_to_cosmos_handled"
)
// NewConvertVouchersEvent constructs a new voucher convert sdk.Event
// nolint: interfacer
func NewConvertVouchersEvent(sender string, amount fmt.Stringer) sdk.Event {
return sdk.NewEvent(
EventTypeConvertVouchers,
sdk.NewAttribute(AttributeKeySender, sender),
sdk.NewAttribute(sdk.AttributeKeyAmount, amount.String()),
)
}
// NewTransferTokensEvent constructs a new transfer sdk.Event
func NewTransferTokensEvent(sender string, recipient string, amount fmt.Stringer) sdk.Event {
return sdk.NewEvent(
EventTypeTransferTokens,
sdk.NewAttribute(AttributeKeySender, sender),
sdk.NewAttribute(AttributeKeyRecipient, recipient),
sdk.NewAttribute(sdk.AttributeKeyAmount, amount.String()),
)
}