/
events.go
87 lines (79 loc) · 2.89 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
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
package keeper
import (
onfttypes "github.com/OmniFlix/omniflixhub/v3/x/onft/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)
func (k Keeper) emitCreateONFTDenomEvent(ctx sdk.Context, denomId, symbol, name, creator string) {
ctx.EventManager().EmitEvent(
sdk.NewEvent(
onfttypes.EventTypeCreateONFTDenom,
sdk.NewAttribute(onfttypes.AttributeKeyDenomID, denomId),
sdk.NewAttribute(onfttypes.AttributeKeySymbol, symbol),
sdk.NewAttribute(onfttypes.AttributeKeyName, name),
sdk.NewAttribute(onfttypes.AttributeKeyCreator, creator),
),
)
}
func (k Keeper) emitUpdateONFTDenomEvent(ctx sdk.Context, denomId, name, description, previewURI, creator string) {
ctx.EventManager().EmitEvent(
sdk.NewEvent(
onfttypes.EventTypeUpdateONFTDenom,
sdk.NewAttribute(onfttypes.AttributeKeyDenomID, denomId),
sdk.NewAttribute(onfttypes.AttributeKeyName, name),
sdk.NewAttribute(onfttypes.AttributeKeyDescription, description),
sdk.NewAttribute(onfttypes.AttributeKeyPreviewURI, previewURI),
sdk.NewAttribute(onfttypes.AttributeKeyCreator, creator),
),
)
}
func (k Keeper) emitTransferONFTDenomEvent(ctx sdk.Context, denomId, symbol, sender, recipient string) {
ctx.EventManager().EmitEvent(
sdk.NewEvent(
onfttypes.EventTypeTransferONFTDenom,
sdk.NewAttribute(onfttypes.AttributeKeyDenomID, denomId),
sdk.NewAttribute(onfttypes.AttributeKeySymbol, symbol),
sdk.NewAttribute(onfttypes.AttributeKeySender, sender),
sdk.NewAttribute(onfttypes.AttributeKeyRecipient, recipient),
),
)
}
func (k Keeper) emitPurgeONFTDenomEvent(ctx sdk.Context, denomId string) {
ctx.EventManager().EmitEvent(
sdk.NewEvent(
onfttypes.EventTypePurgeONFTDenom,
sdk.NewAttribute(onfttypes.AttributeKeyDenomID, denomId),
),
)
}
func (k Keeper) emitMintONFTEvent(ctx sdk.Context, nftId, denomId, uri, owner string) {
ctx.EventManager().EmitEvent(
sdk.NewEvent(
onfttypes.EventTypeMintONFT,
sdk.NewAttribute(onfttypes.AttributeKeyNFTID, nftId),
sdk.NewAttribute(onfttypes.AttributeKeyDenomID, denomId),
sdk.NewAttribute(onfttypes.AttributeKeyMediaURI, uri),
sdk.NewAttribute(onfttypes.AttributeKeyOwner, owner),
),
)
}
func (k Keeper) emitTransferONFTEvent(ctx sdk.Context, nftId, denomId, sender, recipient string) {
ctx.EventManager().EmitEvent(
sdk.NewEvent(
onfttypes.EventTypeTransferONFT,
sdk.NewAttribute(onfttypes.AttributeKeyNFTID, nftId),
sdk.NewAttribute(onfttypes.AttributeKeyDenomID, denomId),
sdk.NewAttribute(onfttypes.AttributeKeySender, sender),
sdk.NewAttribute(onfttypes.AttributeKeyRecipient, recipient),
),
)
}
func (k Keeper) emitBurnONFTEvent(ctx sdk.Context, nftId, denomId, owner string) {
ctx.EventManager().EmitEvent(
sdk.NewEvent(
onfttypes.EventTypeBurnONFT,
sdk.NewAttribute(onfttypes.AttributeKeyNFTID, nftId),
sdk.NewAttribute(onfttypes.AttributeKeyDenomID, denomId),
sdk.NewAttribute(onfttypes.AttributeKeyOwner, owner),
),
)
}