diff --git a/x/tokenfactory/keeper/admins.go b/x/tokenfactory/keeper/admins.go index 2dda568..252c7d5 100644 --- a/x/tokenfactory/keeper/admins.go +++ b/x/tokenfactory/keeper/admins.go @@ -40,12 +40,7 @@ func (k Keeper) setAuthorityMetadata(ctx context.Context, denom string, metadata return nil } -func (k Keeper) setAdmin(ctx context.Context, denom string, admin string) error { - metadata, err := k.GetAuthorityMetadata(sdk.UnwrapSDKContext(ctx), denom) - if err != nil { - return err - } - +func (k Keeper) setAdmin(ctx context.Context, metadata types.DenomAuthorityMetadata, denom string, admin string) error { metadata.Admin = admin return k.setAuthorityMetadata(ctx, denom, metadata) diff --git a/x/tokenfactory/keeper/msg_server.go b/x/tokenfactory/keeper/msg_server.go index d85261d..bb031fa 100644 --- a/x/tokenfactory/keeper/msg_server.go +++ b/x/tokenfactory/keeper/msg_server.go @@ -85,7 +85,7 @@ func (server msgServer) Mint(goCtx context.Context, msg *types.MsgMint) (*types. ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.TypeMsgMint, - sdk.NewAttribute(types.AttributeMintToAddress, msg.Sender), + sdk.NewAttribute(types.AttributeMintToAddress, msg.MintToAddress), sdk.NewAttribute(types.AttributeAmount, msg.Amount.String()), ), }) @@ -119,7 +119,7 @@ func (server msgServer) Burn(goCtx context.Context, msg *types.MsgBurn) (*types. ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.TypeMsgBurn, - sdk.NewAttribute(types.AttributeBurnFromAddress, msg.Sender), + sdk.NewAttribute(types.AttributeBurnFromAddress, msg.BurnFromAddress), sdk.NewAttribute(types.AttributeAmount, msg.Amount.String()), ), }) @@ -172,7 +172,7 @@ func (server msgServer) ChangeAdmin(goCtx context.Context, msg *types.MsgChangeA return nil, types.ErrUnauthorized } - err = server.Keeper.setAdmin(ctx, msg.Denom, msg.NewAdmin) + err = server.Keeper.setAdmin(ctx, authorityMetadata, msg.Denom, msg.NewAdmin) if err != nil { return nil, err } diff --git a/x/tokenfactory/types/capabilities.go b/x/tokenfactory/types/capabilities.go index 2bff522..2a10cb9 100644 --- a/x/tokenfactory/types/capabilities.go +++ b/x/tokenfactory/types/capabilities.go @@ -5,7 +5,10 @@ const ( EnableForceTransfer = "enable_force_transfer" EnableBurnFrom = "enable_burn_from" // Allows addresses of your choosing to mint tokens based on specific conditions. - // via the IsSudoAdminFunc + // via the IsSudoAdminFunc. + // NOTE: with SudoMint enabled, the sudo admin can mint `any` token, not just tokenfactory tokens. + // This is intended behavior as requested by other teams, rather than having its own module with very minor logic. + // If you do not wish for this behavior, write your own and do not use this capability. EnableSudoMint = "enable_admin_sudo_mint" // EnableCommunityPoolFeeFunding sends tokens to the community pool when a new fee is charged (if one is set in params). // This is useful for ICS chains, or networks who wish to just have the fee tokens burned (not gas fees, just the extra on top). @@ -14,7 +17,7 @@ const ( func IsCapabilityEnabled(enabledCapabilities []string, capability string) bool { if len(enabledCapabilities) == 0 { - return true + return false } for _, v := range enabledCapabilities {