@@ -2,6 +2,7 @@ package keeper
22
33import (
44 "context"
5+ "fmt"
56
67 errorsmod "cosmossdk.io/errors"
78 sdk "github.com/cosmos/cosmos-sdk/types"
@@ -82,10 +83,21 @@ func (m msgServer) CreateOracle(goCtx context.Context, msg *types.MsgCreateOracl
8283
8384 ctx := sdk .UnwrapSDKContext (goCtx )
8485
85- if err := m .Keeper .CreateOracle (ctx , msg .Participants , msg .Threshold ); err != nil {
86+ oracle , err := m .Keeper .CreateOracle (ctx , msg .Participants , msg .Threshold )
87+ if err != nil {
8688 return nil , err
8789 }
8890
91+ ctx .EventManager ().EmitEvent (
92+ sdk .NewEvent (
93+ types .EventTypeCreateOracle ,
94+ sdk .NewAttribute (types .AttributeKeyId , fmt .Sprintf ("%d" , oracle .Id )),
95+ sdk .NewAttribute (types .AttributeKeyParticipants , fmt .Sprintf ("%s" , oracle .Participants )),
96+ sdk .NewAttribute (types .AttributeKeyThreshold , fmt .Sprintf ("%d" , oracle .Threshold )),
97+ sdk .NewAttribute (types .AttributeKeyExpirationTime , oracle .Time .Add (m .GetDKGTimeoutPeriod (ctx )).String ()),
98+ ),
99+ )
100+
89101 return & types.MsgCreateOracleResponse {}, nil
90102}
91103
@@ -97,10 +109,21 @@ func (m msgServer) CreateAgency(goCtx context.Context, msg *types.MsgCreateAgenc
97109
98110 ctx := sdk .UnwrapSDKContext (goCtx )
99111
100- if err := m .Keeper .CreateAgency (ctx , msg .Participants , msg .Threshold ); err != nil {
112+ agency , err := m .Keeper .CreateAgency (ctx , msg .Participants , msg .Threshold )
113+ if err != nil {
101114 return nil , err
102115 }
103116
117+ ctx .EventManager ().EmitEvent (
118+ sdk .NewEvent (
119+ types .EventTypeCreateAgency ,
120+ sdk .NewAttribute (types .AttributeKeyId , fmt .Sprintf ("%d" , agency .Id )),
121+ sdk .NewAttribute (types .AttributeKeyParticipants , fmt .Sprintf ("%s" , agency .Participants )),
122+ sdk .NewAttribute (types .AttributeKeyThreshold , fmt .Sprintf ("%d" , agency .Threshold )),
123+ sdk .NewAttribute (types .AttributeKeyExpirationTime , agency .Time .Add (m .GetDKGTimeoutPeriod (ctx )).String ()),
124+ ),
125+ )
126+
104127 return & types.MsgCreateAgencyResponse {}, nil
105128}
106129
0 commit comments