-
Notifications
You must be signed in to change notification settings - Fork 655
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
209 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,45 @@ | ||
package keeper | ||
|
||
import ( | ||
"context" | ||
"encoding/hex" | ||
"errors" | ||
|
||
"cosmossdk.io/core/event" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
|
||
"github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" | ||
) | ||
|
||
// emitStoreWasmCodeEvent emits a store wasm code event | ||
func emitStoreWasmCodeEvent(ctx sdk.Context, checksum types.Checksum) { | ||
ctx.EventManager().EmitEvents(sdk.Events{ | ||
sdk.NewEvent( | ||
func (k Keeper) emitStoreWasmCodeEvent(ctx context.Context, checksum types.Checksum) error { | ||
em := k.EventService.EventManager(ctx) | ||
return errors.Join( | ||
em.EmitKV( | ||
types.EventTypeStoreWasmCode, | ||
sdk.NewAttribute(types.AttributeKeyWasmChecksum, hex.EncodeToString(checksum)), | ||
event.NewAttribute(types.AttributeKeyWasmChecksum, hex.EncodeToString(checksum)), | ||
), | ||
sdk.NewEvent( | ||
em.EmitKV( | ||
sdk.EventTypeMessage, | ||
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), | ||
event.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), | ||
), | ||
}) | ||
) | ||
} | ||
|
||
// emitMigrateContractEvent emits a migrate contract event | ||
func emitMigrateContractEvent(ctx sdk.Context, clientID string, checksum, newChecksum types.Checksum) { | ||
ctx.EventManager().EmitEvents(sdk.Events{ | ||
sdk.NewEvent( | ||
func (k Keeper) emitMigrateContractEvent(ctx context.Context, clientID string, checksum, newChecksum types.Checksum) error { | ||
em := k.EventService.EventManager(ctx) | ||
return errors.Join( | ||
em.EmitKV( | ||
types.EventTypeMigrateContract, | ||
sdk.NewAttribute(types.AttributeKeyClientID, clientID), | ||
sdk.NewAttribute(types.AttributeKeyWasmChecksum, hex.EncodeToString(checksum)), | ||
sdk.NewAttribute(types.AttributeKeyNewChecksum, hex.EncodeToString(newChecksum)), | ||
event.NewAttribute(types.AttributeKeyClientID, clientID), | ||
event.NewAttribute(types.AttributeKeyWasmChecksum, hex.EncodeToString(checksum)), | ||
event.NewAttribute(types.AttributeKeyNewChecksum, hex.EncodeToString(newChecksum)), | ||
), | ||
sdk.NewEvent( | ||
em.EmitKV( | ||
sdk.EventTypeMessage, | ||
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), | ||
event.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), | ||
), | ||
}) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.